44
44
#include "drizzled/internal/my_pthread.h"
45
45
#include "drizzled/plugin/event_observer.h"
47
#include "drizzled/table.h"
48
#include "drizzled/table/shell.h"
47
50
#include "drizzled/session.h"
49
52
#include "drizzled/charset.h"
1445
1448
// This needs to go, we should be setting the "use" on the field so that
1446
1449
// it does not reference the share/table.
1447
Table temp_table; /* Use this so that BLOB DEFAULT '' works */
1448
temp_table.setShare(this);
1450
table::Shell temp_table(*this); /* Use this so that BLOB DEFAULT '' works */
1449
1451
temp_table.in_use= &session;
1451
1453
f->init(&temp_table); /* blob default values need table obj */
1825
1827
5 Error (see open_table_error: charset unavailable)
1826
1828
7 Table definition has changed in engine
1829
1830
int TableShare::open_table_from_share(Session *session,
1830
1831
const TableIdentifier &identifier,
1831
1832
const char *alias,
1832
1833
uint32_t db_stat, uint32_t ha_open_flags,
1833
1834
Table &outparam)
1836
bool error_reported= false;
1837
int ret= open_table_from_share_inner(session, alias, db_stat, ha_open_flags, outparam, error_reported);
1840
ret= open_table_cursor_inner(session, identifier, alias, db_stat, ha_open_flags, outparam, error_reported);
1845
if (not error_reported)
1846
open_table_error(ret, errno, 0);
1848
delete outparam.cursor;
1849
outparam.cursor= 0; // For easier error checking
1850
outparam.db_stat= 0;
1851
outparam.getMemRoot()->free_root(MYF(0)); // Safe to call on zeroed root
1852
free((char*) outparam.alias);
1857
int TableShare::open_table_from_share_inner(Session *session,
1859
uint32_t db_stat, uint32_t ,
1835
1863
int local_error;
1836
1864
uint32_t records;
1837
bool error_reported= false;
1838
1865
unsigned char *record= NULL;
1839
1866
Field **field_ptr;
1927
1954
uint32_t n_length;
1928
1955
n_length= keys*sizeof(KeyInfo) + key_parts*sizeof(KeyPartInfo);
1929
1956
if (!(local_key_info= (KeyInfo*) outparam.alloc_root(n_length)))
1931
1958
outparam.key_info= local_key_info;
1932
1959
key_part= (reinterpret_cast<KeyPartInfo*> (local_key_info+keys));
1971
1998
outparam.tmp_set.resize(fields);
1972
1999
outparam.default_column_bitmaps();
2004
int TableShare::open_table_cursor_inner(Session *,
2005
const TableIdentifier &identifier,
2007
uint32_t db_stat, uint32_t ha_open_flags,
2009
bool &error_reported)
1974
2011
/* The table struct is now initialized; Open the table */
1978
2015
assert(!(db_stat & HA_WAIT_IF_LOCKED));
2007
2044
local_error= 7;
2017
if (!error_reported)
2018
open_table_error(local_error, errno, 0);
2020
delete outparam.cursor;
2021
outparam.cursor= 0; // For easier error checking
2022
outparam.db_stat= 0;
2023
outparam.getMemRoot()->free_root(MYF(0)); // Safe to call on zeroed root
2024
free((char*) outparam.alias);
2026
return (local_error);
2029
2054
/* error message when opening a form cursor */