71
71
***********************************************************************/
75
75
#include <drizzled/table.h>
76
76
#include <drizzled/error.h>
77
#include "drizzled/internal/my_pthread.h"
77
#include <drizzled/internal/my_pthread.h>
78
78
#include <drizzled/plugin/transactional_storage_engine.h>
79
79
#include <drizzled/plugin/error_message.h>
90
90
#include <drizzled/message/table.pb.h>
91
#include "drizzled/internal/m_string.h"
91
#include <drizzled/internal/m_string.h>
93
#include "drizzled/global_charset_info.h"
93
#include <drizzled/global_charset_info.h>
95
95
#include "haildb_datadict_dump_func.h"
96
96
#include "config_table_function.h"
101
101
#include "haildb_engine.h"
103
103
#include <drizzled/field.h>
104
#include "drizzled/field/timestamp.h" // needed for UPDATE NOW()
105
#include "drizzled/field/blob.h"
106
#include "drizzled/field/enum.h"
104
#include <drizzled/field/blob.h>
105
#include <drizzled/field/enum.h>
107
106
#include <drizzled/session.h>
108
#include <boost/program_options.hpp>
109
107
#include <drizzled/module/option_map.h>
108
#include <drizzled/charset.h>
109
#include <drizzled/current_session.h>
110
111
#include <iostream>
111
#include <drizzled/charset.h>
113
113
namespace po= boost::program_options;
114
#include <boost/program_options.hpp>
114
115
#include <boost/algorithm/string.hpp>
116
117
using namespace std;
117
118
using namespace google;
118
119
using namespace drizzled;
120
int read_row_from_haildb(unsigned char* buf, ib_crsr_t cursor, ib_tpl_t tuple, Table* table, bool has_hidden_primary_key, uint64_t *hidden_pkey, drizzled::memory::Root **blobroot= NULL);
121
int read_row_from_haildb(Session *session, unsigned char* buf, ib_crsr_t cursor, ib_tpl_t tuple, Table* table, bool has_hidden_primary_key, uint64_t *hidden_pkey, drizzled::memory::Root **blobroot= NULL);
121
122
static void fill_ib_search_tpl_from_drizzle_key(ib_tpl_t search_tuple,
122
123
const drizzled::KeyInfo *key_info,
123
124
const unsigned char *key_ptr,
167
168
int doCreateTable(Session&,
168
169
Table& table_arg,
169
const drizzled::TableIdentifier &identifier,
170
const drizzled::identifier::Table &identifier,
170
171
drizzled::message::Table& proto);
172
int doDropTable(Session&, const TableIdentifier &identifier);
173
int doDropTable(Session&, const identifier::Table &identifier);
174
175
int doRenameTable(drizzled::Session&,
175
const drizzled::TableIdentifier&,
176
const drizzled::TableIdentifier&);
176
const drizzled::identifier::Table&,
177
const drizzled::identifier::Table&);
178
179
int doGetTableDefinition(Session& session,
179
const TableIdentifier &identifier,
180
const identifier::Table &identifier,
180
181
drizzled::message::Table &table_proto);
182
bool doDoesTableExist(Session&, const TableIdentifier &identifier);
183
bool doDoesTableExist(Session&, const identifier::Table &identifier);
185
void getTableNamesInSchemaFromHailDB(const drizzled::SchemaIdentifier &schema,
186
void getTableNamesInSchemaFromHailDB(const drizzled::identifier::Schema &schema,
186
187
drizzled::plugin::TableNameList *set_of_names,
187
drizzled::TableIdentifier::vector *identifiers);
188
drizzled::identifier::Table::vector *identifiers);
190
191
void doGetTableIdentifiers(drizzled::CachedDirectory &,
191
const drizzled::SchemaIdentifier &schema,
192
drizzled::TableIdentifier::vector &identifiers);
192
const drizzled::identifier::Schema &schema,
193
drizzled::identifier::Table::vector &identifiers);
194
195
/* The following defines can be increased if necessary */
195
196
uint32_t max_supported_keys() const { return 1000; }
240
241
/* This is a superset of the map from innobase plugin.
241
242
Unlike innobase plugin we don't act on errors here, we just
242
243
map error codes. */
243
static int ib_err_t_to_drizzle_error(ib_err_t err)
244
static int ib_err_t_to_drizzle_error(Session* session, ib_err_t err)
270
271
return HA_ERR_NO_ACTIVE_RECORD;
272
273
case DB_DEADLOCK:
274
/* HailDB will roll back a transaction itself due to DB_DEADLOCK.
275
This means we have to tell Drizzle about it */
276
session->markTransactionForRollback(true);
273
277
return HA_ERR_LOCK_DEADLOCK;
275
279
case DB_LOCK_WAIT_TIMEOUT:
280
session->markTransactionForRollback(false);
276
281
return HA_ERR_LOCK_WAIT_TIMEOUT;
278
283
case DB_NO_REFERENCED_ROW:
353
358
transaction= get_trx(session);
354
isolation_level= tx_isolation_to_ib_trx_level((enum_tx_isolation)session_tx_isolation(session));
359
isolation_level= tx_isolation_to_ib_trx_level(session->getTxIsolation());
355
360
*transaction= ib_trx_begin(isolation_level);
357
362
return *transaction == NULL;
388
393
err= ib_savepoint_rollback(*transaction, savepoint.getName().c_str(),
389
394
savepoint.getName().length());
391
return ib_err_t_to_drizzle_error(err);
396
return ib_err_t_to_drizzle_error(session, err);
394
399
int HailDBEngine::doReleaseSavepoint(Session* session,
400
405
err= ib_savepoint_release(*transaction, savepoint.getName().c_str(),
401
406
savepoint.getName().length());
402
407
if (err != DB_SUCCESS)
403
return ib_err_t_to_drizzle_error(err);
408
return ib_err_t_to_drizzle_error(session, err);
411
416
ib_trx_t *transaction= get_trx(session);
413
if (all || (!session_test_options(session, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
415
420
err= ib_trx_commit(*transaction);
417
422
if (err != DB_SUCCESS)
418
return ib_err_t_to_drizzle_error(err);
423
return ib_err_t_to_drizzle_error(session, err);
420
425
*transaction= NULL;
429
434
ib_trx_t *transaction= get_trx(session);
431
if (all || !session_test_options(session, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
433
err= ib_trx_rollback(*transaction);
438
if (ib_trx_state(*transaction) == IB_TRX_NOT_STARTED)
439
err= ib_trx_release(*transaction);
441
err= ib_trx_rollback(*transaction);
435
443
if (err != DB_SUCCESS)
436
return ib_err_t_to_drizzle_error(err);
444
return ib_err_t_to_drizzle_error(session, err);
438
446
*transaction= NULL;
450
if (ib_trx_state(*transaction) == IB_TRX_NOT_STARTED)
442
453
err= ib_savepoint_rollback(*transaction, statement_savepoint_name.c_str(),
443
454
statement_savepoint_name.length());
444
455
if (err != DB_SUCCESS)
445
return ib_err_t_to_drizzle_error(err);
456
return ib_err_t_to_drizzle_error(session, err);
488
499
assert (err == DB_SUCCESS);
489
err= ib_tuple_read_u64(tuple, getTable()->getShare()->fields, &nr);
500
err= ib_tuple_read_u64(tuple, getTable()->getShare()->sizeFields(), &nr);
492
503
ib_tuple_delete(tuple);
527
538
doEndIndexScan();
528
539
(void) extra(HA_EXTRA_NO_KEYREAD);
530
if (getTable()->getShare()->getTableProto()->options().auto_increment_value() > nr)
531
nr= getTable()->getShare()->getTableProto()->options().auto_increment_value();
541
if (getTable()->getShare()->getTableMessage()->options().auto_increment_value() > nr)
542
nr= getTable()->getShare()->getTableMessage()->options().auto_increment_value();
672
683
unexpected if an obsolete consistent read view would be
675
enum_tx_isolation isolation_level= session_tx_isolation(session);
686
enum_tx_isolation isolation_level= session->getTxIsolation();
677
688
if (isolation_level != ISO_SERIALIZABLE
678
689
&& (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT)
716
727
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT
717
728
&& lock_type <= TL_WRITE)
718
&& !session_tablespace_op(session)
729
&& ! session->doing_tablespace_operation()
719
730
&& sql_command != SQLCOM_TRUNCATE
720
731
&& sql_command != SQLCOM_CREATE_TABLE) {
795
static void TableIdentifier_to_haildb_name(const TableIdentifier &identifier, std::string *str)
806
static void TableIdentifier_to_haildb_name(const identifier::Table &identifier, std::string *str)
797
808
str->assign(table_path_to_haildb_name(identifier.getPath().c_str()));
828
839
if (err != DB_SUCCESS)
829
return ib_err_t_to_drizzle_error(err);
840
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
831
842
err= ib_cursor_open_table_using_id(table_id, NULL, &cursor);
832
843
cursor_is_sec_index= false;
834
845
if (err != DB_SUCCESS)
835
return ib_err_t_to_drizzle_error(err);
846
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
837
848
err= ib_index_get_id(haildb_table_name, "HIDDEN_PRIMARY", &idx_id);
927
938
*err= ib_table_schema_add_col(schema, field.name().c_str(), IB_INT,
928
939
column_attr, 0, 4);
930
case message::Table::Field::TIMESTAMP:
941
case message::Table::Field::EPOCH:
931
942
*err= ib_table_schema_add_col(schema, field.name().c_str(), IB_INT,
932
943
column_attr, 0, 8);
1028
1039
int HailDBEngine::doCreateTable(Session &session,
1029
1040
Table& table_obj,
1030
const drizzled::TableIdentifier &identifier,
1041
const drizzled::identifier::Table &identifier,
1031
1042
drizzled::message::Table& table_message)
1033
1044
ib_tbl_sch_t haildb_table_schema= NULL;
1071
1082
ER_CANT_CREATE_TABLE,
1072
1083
_("Cannot create table %s. HailDB Error %d (%s)\n"),
1073
1084
haildb_table_name.c_str(), haildb_err, ib_strerror(haildb_err));
1074
return ib_err_t_to_drizzle_error(haildb_err);
1085
return ib_err_t_to_drizzle_error(&session, haildb_err);
1077
1088
for (int colnr= 0; colnr < table_message.field_size() ; colnr++)
1092
1103
" HailDB Error %d (%s)\n"),
1093
1104
field.name().c_str(), haildb_table_name.c_str(),
1094
1105
haildb_err, ib_strerror(haildb_err));
1095
return ib_err_t_to_drizzle_error(haildb_err);
1106
return ib_err_t_to_drizzle_error(&session, haildb_err);
1097
1108
if (field_err != 0)
1098
1109
return field_err;
1240
1251
_("Cannot create table %s. HailDB Error %d (%s)\n"),
1241
1252
haildb_table_name.c_str(),
1242
1253
haildb_err, ib_strerror(haildb_err));
1243
return ib_err_t_to_drizzle_error(haildb_err);
1254
return ib_err_t_to_drizzle_error(&session, haildb_err);
1285
1296
int HailDBEngine::doDropTable(Session &session,
1286
const TableIdentifier &identifier)
1297
const identifier::Table &identifier)
1288
1299
ib_trx_t haildb_schema_transaction;
1289
1300
ib_err_t haildb_err;
1368
static ib_err_t rename_table_message(ib_trx_t transaction, const TableIdentifier &from_identifier, const TableIdentifier &to_identifier)
1379
static ib_err_t rename_table_message(ib_trx_t transaction, const identifier::Table &from_identifier, const identifier::Table &to_identifier)
1370
1381
ib_crsr_t cursor;
1371
1382
ib_tpl_t search_tuple;
1458
1469
int HailDBEngine::doRenameTable(drizzled::Session &session,
1459
const drizzled::TableIdentifier &from,
1460
const drizzled::TableIdentifier &to)
1470
const drizzled::identifier::Table &from,
1471
const drizzled::identifier::Table &to)
1462
1473
ib_trx_t haildb_schema_transaction;
1507
1518
assert(rollback_err == DB_SUCCESS);
1508
1519
rollback_err= ib_trx_rollback(haildb_schema_transaction);
1509
1520
assert(rollback_err == DB_SUCCESS);
1510
return ib_err_t_to_drizzle_error(err);
1521
return ib_err_t_to_drizzle_error(&session, err);
1513
1524
void HailDBEngine::getTableNamesInSchemaFromHailDB(
1514
const drizzled::SchemaIdentifier &schema,
1525
const drizzled::identifier::Schema &schema,
1515
1526
drizzled::plugin::TableNameList *set_of_names,
1516
drizzled::TableIdentifier::vector *identifiers)
1527
drizzled::identifier::Table::vector *identifiers)
1518
1529
ib_trx_t transaction;
1519
1530
ib_crsr_t cursor;
1544
1555
BOOST_FOREACH(std::string table_name, haildb_system_table_names)
1546
identifiers->push_back(TableIdentifier(schema.getSchemaName(),
1557
identifiers->push_back(identifier::Table(schema.getSchemaName(),
1607
1618
void HailDBEngine::doGetTableIdentifiers(drizzled::CachedDirectory &,
1608
const drizzled::SchemaIdentifier &schema,
1609
drizzled::TableIdentifier::vector &identifiers)
1619
const drizzled::identifier::Schema &schema,
1620
drizzled::identifier::Table::vector &identifiers)
1611
1622
getTableNamesInSchemaFromHailDB(schema, NULL, &identifiers);
1733
1744
int HailDBEngine::doGetTableDefinition(Session &session,
1734
const TableIdentifier &identifier,
1745
const identifier::Table &identifier,
1735
1746
drizzled::message::Table &table)
1737
1748
ib_crsr_t haildb_cursor= NULL;
1762
1773
bool HailDBEngine::doDoesTableExist(Session &,
1763
const TableIdentifier& identifier)
1774
const identifier::Table& identifier)
1765
1776
ib_crsr_t haildb_cursor;
1766
1777
string haildb_table_name;
1902
1913
err= ib_cursor_open_table_using_id(table_id, transaction, &cursor);
1904
1915
if (err != DB_SUCCESS)
1905
return ib_err_t_to_drizzle_error(err);
1916
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
1907
1918
cursor_is_sec_index= false;
1914
1925
err= ib_cursor_first(cursor);
1915
if (current_session->lex->sql_command == SQLCOM_CREATE_TABLE
1926
if (current_session->getLex()->sql_command == SQLCOM_CREATE_TABLE
1916
1927
&& err == DB_MISSING_HISTORY)
1918
1929
/* See https://bugs.launchpad.net/drizzle/+bug/556978
1973
1984
if (share->has_hidden_primary_key)
1975
err= ib_tuple_write_u64(tuple, getTable()->getShare()->fields, share->hidden_pkey_auto_increment_value.fetch_and_increment());
1986
err= ib_tuple_write_u64(tuple, getTable()->getShare()->sizeFields(),
1987
share->hidden_pkey_auto_increment_value.fetch_and_increment());
1978
1990
err= ib_cursor_insert_row(cursor, tuple);
2010
2022
ret= HA_ERR_FOUND_DUPP_KEY;
2012
2024
else if (err != DB_SUCCESS)
2013
ret= ib_err_t_to_drizzle_error(err);
2025
ret= ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2015
2027
tuple= ib_tuple_clear(tuple);
2016
2028
ib_tuple_delete(tuple);
2041
2053
err= ib_cursor_open_table_using_id(table_id, transaction, &cursor);
2043
2055
if (err != DB_SUCCESS)
2044
return ib_err_t_to_drizzle_error(err);
2056
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2045
2057
cursor_is_sec_index= false;
2114
2126
so only support TRUNCATE and not DELETE FROM t;
2115
2127
(this is what ha_innodb does)
2117
if (session_sql_command(getTable()->in_use) != SQLCOM_TRUNCATE)
2129
if (getTable()->in_use->getSqlCommand() != SQLCOM_TRUNCATE)
2118
2130
return HA_ERR_WRONG_COMMAND;
2130
2142
err= ib_cursor_open_table_using_id(table_id, transaction, &cursor);
2132
2144
if (err != DB_SUCCESS)
2133
return ib_err_t_to_drizzle_error(err);
2145
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2134
2146
cursor_is_sec_index= false;
2172
2184
ib_schema_unlock(transaction);
2173
2185
ib_err_t rollback_err= ib_trx_rollback(transaction);
2174
2186
assert(rollback_err == DB_SUCCESS);
2175
return ib_err_t_to_drizzle_error(err);
2187
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2178
2190
int HailDBCursor::doStartTableScan(bool)
2204
2216
if (err != DB_SUCCESS)
2205
return ib_err_t_to_drizzle_error(err);
2217
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2207
2219
err= ib_cursor_set_lock_mode(cursor, ib_lock_mode);
2208
2220
assert(err == DB_SUCCESS); // FIXME
2212
2224
err= ib_cursor_first(cursor);
2213
2225
if (err != DB_SUCCESS && err != DB_END_OF_INDEX)
2215
previous_error= ib_err_t_to_drizzle_error(err);
2216
err= ib_cursor_reset(cursor);
2217
return previous_error;
2227
int reset_err= ib_cursor_reset(cursor);
2228
assert(reset_err == DB_SUCCESS);
2229
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2220
2232
advance_cursor= false;
2226
int read_row_from_haildb(unsigned char* buf, ib_crsr_t cursor, ib_tpl_t tuple, Table* table, bool has_hidden_primary_key, uint64_t *hidden_pkey, drizzled::memory::Root **blobroot)
2237
int read_row_from_haildb(Session *session, unsigned char* buf, ib_crsr_t cursor, ib_tpl_t tuple, Table* table, bool has_hidden_primary_key, uint64_t *hidden_pkey, drizzled::memory::Root **blobroot)
2229
2240
ptrdiff_t row_offset= buf - table->getInsertRecord();
2233
2244
if (err == DB_RECORD_NOT_FOUND)
2234
2245
return HA_ERR_END_OF_FILE;
2235
2246
if (err != DB_SUCCESS)
2236
return ib_err_t_to_drizzle_error(err);
2247
return ib_err_t_to_drizzle_error(session, err);
2299
2310
(**field).move_field_offset(-row_offset);
2301
2312
if (err != DB_SUCCESS)
2302
return ib_err_t_to_drizzle_error(err);
2313
return ib_err_t_to_drizzle_error(session, err);
2305
2316
if (has_hidden_primary_key)
2307
2318
err= ib_tuple_read_u64(tuple, colnr, hidden_pkey);
2310
return ib_err_t_to_drizzle_error(err);
2321
return ib_err_t_to_drizzle_error(session, err);
2313
2324
int HailDBCursor::rnd_next(unsigned char *buf)
2319
return previous_error;
2321
2329
if (advance_cursor)
2323
2331
err= ib_cursor_next(cursor);
2324
2332
if (err != DB_SUCCESS)
2325
return ib_err_t_to_drizzle_error(err);
2333
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2328
2336
tuple= ib_tuple_clear(tuple);
2329
ret= read_row_from_haildb(buf, cursor, tuple, getTable(),
2337
ret= read_row_from_haildb(getTable()->getSession(), buf, cursor, tuple,
2330
2339
share->has_hidden_primary_key,
2331
2340
&hidden_autoinc_pkey_position);
2343
2352
err= ib_cursor_reset(cursor);
2344
2353
assert(err == DB_SUCCESS);
2345
2354
in_table_scan= false;
2347
return ib_err_t_to_drizzle_error(err);
2355
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2350
2358
int HailDBCursor::rnd_pos(unsigned char *buf, unsigned char *pos)
2359
2367
err= ib_col_set_value(search_tuple, 0,
2360
2368
((uint64_t*)(pos)), sizeof(uint64_t));
2361
2369
if (err != DB_SUCCESS)
2362
return ib_err_t_to_drizzle_error(err);
2370
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2377
2385
err= ib_cursor_moveto(cursor, search_tuple, IB_CUR_GE, &res);
2378
2386
if (err != DB_SUCCESS)
2379
return ib_err_t_to_drizzle_error(err);
2387
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2381
2389
assert(res==0);
2387
2395
tuple= ib_tuple_clear(tuple);
2390
ret= read_row_from_haildb(buf, cursor, tuple, getTable(),
2398
ret= read_row_from_haildb(getTable()->getSession(), buf, cursor, tuple,
2391
2400
share->has_hidden_primary_key,
2392
2401
&hidden_autoinc_pkey_position);
2538
if (flag & HA_STATUS_CONST)
2540
for (unsigned int i = 0; i < getTable()->getShare()->sizeKeys(); i++)
2542
const char* index_name= getTable()->key_info[i].name;
2545
ha_rows rec_per_key;
2547
err= ib_get_index_stat_n_diff_key_vals(cursor, index_name,
2550
if (err != DB_SUCCESS)
2551
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2553
for (unsigned int j=0; j < getTable()->key_info[i].key_parts; j++)
2555
if (n_diff[j+1] == 0)
2556
rec_per_key= stats.records;
2558
rec_per_key= stats.records / n_diff[j+1];
2560
/* We import this heuristic from ha_innodb, which says
2561
that MySQL favours table scans too much over index searches,
2562
so we pretend our index selectivity is 2 times better. */
2564
rec_per_key= rec_per_key / 2;
2566
if (rec_per_key == 0)
2569
getTable()->key_info[i].rec_per_key[j]=
2570
rec_per_key >= ~(ulong) 0 ? ~(ulong) 0 :
2571
(ulong) rec_per_key;
2546
2595
err= ib_cursor_open_table_using_id(table_id, transaction, &cursor);
2548
2597
if (err != DB_SUCCESS)
2549
return ib_err_t_to_drizzle_error(err);
2598
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2564
2613
getShare()->getKeyInfo(keynr).name,
2566
2615
if (err != DB_SUCCESS)
2567
return ib_err_t_to_drizzle_error(err);
2616
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2569
2618
err= ib_cursor_close(cursor);
2570
2619
assert(err == DB_SUCCESS);
2572
2621
err= ib_cursor_open_index_using_id(index_id, transaction, &cursor);
2574
2623
if (err != DB_SUCCESS)
2575
return ib_err_t_to_drizzle_error(err);
2624
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2577
2626
cursor_is_sec_index= true;
2726
2775
if (err != DB_SUCCESS)
2728
return ib_err_t_to_drizzle_error(err);
2777
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2731
2780
tuple= ib_tuple_clear(tuple);
2732
ret= read_row_from_haildb(buf, cursor, tuple, getTable(),
2781
ret= read_row_from_haildb(getTable()->getSession(), buf, cursor, tuple,
2733
2783
share->has_hidden_primary_key,
2734
2784
&hidden_autoinc_pkey_position,
2735
2785
(allocate_blobs)? &blobroot : NULL);
2859
int HailDBCursor::analyze(Session*)
2863
err= ib_update_table_statistics(cursor);
2865
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2809
2868
int HailDBCursor::index_next(unsigned char *buf)
2811
2870
int ret= HA_ERR_END_OF_FILE;
2820
2879
tuple= ib_tuple_clear(tuple);
2821
ret= read_row_from_haildb(buf, cursor, tuple, getTable(),
2880
ret= read_row_from_haildb(getTable()->getSession(), buf, cursor, tuple,
2822
2882
share->has_hidden_primary_key,
2823
2883
&hidden_autoinc_pkey_position);
2846
2906
if (err == DB_END_OF_INDEX)
2847
2907
return HA_ERR_END_OF_FILE;
2849
return ib_err_t_to_drizzle_error(err);
2909
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2853
2913
tuple= ib_tuple_clear(tuple);
2854
ret= read_row_from_haildb(buf, cursor, tuple, getTable(),
2914
ret= read_row_from_haildb(getTable()->getSession(), buf, cursor, tuple,
2855
2916
share->has_hidden_primary_key,
2856
2917
&hidden_autoinc_pkey_position);
2869
2930
err= ib_cursor_first(cursor);
2870
2931
if (err != DB_SUCCESS)
2871
return ib_err_t_to_drizzle_error(err);
2932
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2873
2934
tuple= ib_tuple_clear(tuple);
2874
ret= read_row_from_haildb(buf, cursor, tuple, getTable(),
2935
ret= read_row_from_haildb(getTable()->getSession(), buf, cursor, tuple,
2875
2937
share->has_hidden_primary_key,
2876
2938
&hidden_autoinc_pkey_position);
2889
2951
err= ib_cursor_last(cursor);
2890
2952
if (err != DB_SUCCESS)
2891
return ib_err_t_to_drizzle_error(err);
2953
return ib_err_t_to_drizzle_error(getTable()->getSession(), err);
2893
2955
tuple= ib_tuple_clear(tuple);
2894
ret= read_row_from_haildb(buf, cursor, tuple, getTable(),
2956
ret= read_row_from_haildb(getTable()->getSession(), buf, cursor, tuple,
2895
2958
share->has_hidden_primary_key,
2896
2959
&hidden_autoinc_pkey_position);
2897
2960
advance_cursor= true;
3086
3149
va_start(args, fmt);
3087
if (! shutdown_in_progress)
3088
r= plugin::ErrorMessage::vprintf(NULL, ERRMSG_LVL_WARN, fmt, args);
3150
if (not shutdown_in_progress)
3152
r= plugin::ErrorMessage::vprintf(error::WARN, fmt, args);
3090
3156
vfprintf(stderr, fmt, args);
3093
3160
return (! r==true);
3472
3539
"Transactional Storage Engine using the HailDB Library",
3473
3540
PLUGIN_LICENSE_GPL,
3474
3541
haildb_init, /* Plugin Init */
3475
NULL, /* system variables */
3476
3543
init_options /* config options */
3478
3545
DRIZZLE_DECLARE_PLUGIN_END;