Commit 1218bbc6 authored by unknown's avatar unknown

Merge mysql.com:/home/stewart/Documents/MySQL/5.0/ndb

into mysql.com:/home/stewart/Documents/MySQL/5.0/ndb-dynamic-port

parents 269e0397 ff4d272e
...@@ -2896,7 +2896,7 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags) ...@@ -2896,7 +2896,7 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
/* Allocate array with bind structs, lengths and NULL flags */ /* Allocate array with bind structs, lengths and NULL flags */
bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND), bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND),
MYF(MY_WME | MY_FAE)); MYF(MY_WME | MY_FAE | MY_ZEROFILL));
length= (unsigned long*) my_malloc(num_fields * sizeof(unsigned long), length= (unsigned long*) my_malloc(num_fields * sizeof(unsigned long),
MYF(MY_WME | MY_FAE)); MYF(MY_WME | MY_FAE));
is_null= (my_bool*) my_malloc(num_fields * sizeof(my_bool), is_null= (my_bool*) my_malloc(num_fields * sizeof(my_bool),
......
...@@ -53,6 +53,7 @@ int resize_queue(QUEUE *queue, uint max_elements); ...@@ -53,6 +53,7 @@ int resize_queue(QUEUE *queue, uint max_elements);
void delete_queue(QUEUE *queue); void delete_queue(QUEUE *queue);
void queue_insert(QUEUE *queue,byte *element); void queue_insert(QUEUE *queue,byte *element);
byte *queue_remove(QUEUE *queue,uint idx); byte *queue_remove(QUEUE *queue,uint idx);
#define queue_remove_all(queue) { (queue)->elements= 0; }
void _downheap(QUEUE *queue,uint idx); void _downheap(QUEUE *queue,uint idx);
void queue_fix(QUEUE *queue); void queue_fix(QUEUE *queue);
#define is_queue_inited(queue) ((queue)->root != 0) #define is_queue_inited(queue) ((queue)->root != 0)
......
...@@ -612,6 +612,8 @@ extern lock_sys_t* lock_sys; ...@@ -612,6 +612,8 @@ extern lock_sys_t* lock_sys;
#define LOCK_TABLE 16 /* these type values should be so high that */ #define LOCK_TABLE 16 /* these type values should be so high that */
#define LOCK_REC 32 /* they can be ORed to the lock mode */ #define LOCK_REC 32 /* they can be ORed to the lock mode */
#define LOCK_TABLE_EXP 80 /* explicit table lock (80 = 16 + 64) */ #define LOCK_TABLE_EXP 80 /* explicit table lock (80 = 16 + 64) */
#define LOCK_TABLE_TRANSACTIONAL 144
/* transactional table lock (144 = 16 + 128)*/
#define LOCK_TYPE_MASK 0xF0UL /* mask used to extract lock type from the #define LOCK_TYPE_MASK 0xF0UL /* mask used to extract lock type from the
type_mode field in a lock */ type_mode field in a lock */
/* Waiting lock flag */ /* Waiting lock flag */
......
...@@ -464,6 +464,10 @@ struct trx_struct{ ...@@ -464,6 +464,10 @@ struct trx_struct{
ulint n_lock_table_exp;/* number of explicit table locks ulint n_lock_table_exp;/* number of explicit table locks
(LOCK TABLES) reserved by the (LOCK TABLES) reserved by the
transaction, stored in trx_locks */ transaction, stored in trx_locks */
ulint n_lock_table_transactional;
/* number of transactional table locks
(LOCK TABLES..WHERE ENGINE) reserved by
the transaction, stored in trx_locks */
UT_LIST_NODE_T(trx_t) UT_LIST_NODE_T(trx_t)
trx_list; /* list of transactions */ trx_list; /* list of transactions */
UT_LIST_NODE_T(trx_t) UT_LIST_NODE_T(trx_t)
......
...@@ -2207,7 +2207,8 @@ lock_grant( ...@@ -2207,7 +2207,8 @@ lock_grant(
release it at the end of the SQL statement */ release it at the end of the SQL statement */
lock->trx->auto_inc_lock = lock; lock->trx->auto_inc_lock = lock;
} else if (lock_get_type(lock) == LOCK_TABLE_EXP) { } else if (lock_get_type(lock) == LOCK_TABLE_EXP ||
lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL) {
ut_a(lock_get_mode(lock) == LOCK_S ut_a(lock_get_mode(lock) == LOCK_S
|| lock_get_mode(lock) == LOCK_X); || lock_get_mode(lock) == LOCK_X);
} }
...@@ -3421,6 +3422,10 @@ lock_table_create( ...@@ -3421,6 +3422,10 @@ lock_table_create(
lock->trx->n_lock_table_exp++; lock->trx->n_lock_table_exp++;
} }
if (lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL) {
lock->trx->n_lock_table_transactional++;
}
lock->un_member.tab_lock.table = table; lock->un_member.tab_lock.table = table;
UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock); UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock);
...@@ -3458,7 +3463,11 @@ lock_table_remove_low( ...@@ -3458,7 +3463,11 @@ lock_table_remove_low(
} }
if (lock_get_type(lock) == LOCK_TABLE_EXP) { if (lock_get_type(lock) == LOCK_TABLE_EXP) {
lock->trx->n_lock_table_exp--; trx->n_lock_table_exp--;
}
if (lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL) {
trx->n_lock_table_transactional--;
} }
UT_LIST_REMOVE(trx_locks, trx->trx_locks, lock); UT_LIST_REMOVE(trx_locks, trx->trx_locks, lock);
...@@ -3592,7 +3601,8 @@ lock_table( ...@@ -3592,7 +3601,8 @@ lock_table(
DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */ DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set, ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set,
does nothing; does nothing;
if LOCK_TABLE_EXP bits are set, if LOCK_TABLE_EXP|LOCK_TABLE_TRANSACTIONAL
bits are set,
creates an explicit table lock */ creates an explicit table lock */
dict_table_t* table, /* in: database table in dictionary cache */ dict_table_t* table, /* in: database table in dictionary cache */
ulint mode, /* in: lock mode */ ulint mode, /* in: lock mode */
...@@ -3608,7 +3618,8 @@ lock_table( ...@@ -3608,7 +3618,8 @@ lock_table(
return(DB_SUCCESS); return(DB_SUCCESS);
} }
ut_a(flags == 0 || flags == LOCK_TABLE_EXP); ut_a(flags == 0 || flags == LOCK_TABLE_EXP ||
flags == LOCK_TABLE_TRANSACTIONAL);
trx = thr_get_trx(thr); trx = thr_get_trx(thr);
...@@ -3631,7 +3642,7 @@ lock_table( ...@@ -3631,7 +3642,7 @@ lock_table(
/* Another trx has a request on the table in an incompatible /* Another trx has a request on the table in an incompatible
mode: this trx may have to wait */ mode: this trx may have to wait */
err = lock_table_enqueue_waiting(mode, table, thr); err = lock_table_enqueue_waiting(mode | flags, table, thr);
lock_mutex_exit_kernel(); lock_mutex_exit_kernel();
...@@ -3722,7 +3733,8 @@ lock_table_dequeue( ...@@ -3722,7 +3733,8 @@ lock_table_dequeue(
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_a(lock_get_type(in_lock) == LOCK_TABLE || ut_a(lock_get_type(in_lock) == LOCK_TABLE ||
lock_get_type(in_lock) == LOCK_TABLE_EXP); lock_get_type(in_lock) == LOCK_TABLE_EXP ||
lock_get_type(in_lock) == LOCK_TABLE_TRANSACTIONAL);
lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, in_lock); lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, in_lock);
...@@ -3826,7 +3838,9 @@ lock_release_off_kernel( ...@@ -3826,7 +3838,9 @@ lock_release_off_kernel(
} }
lock_table_dequeue(lock); lock_table_dequeue(lock);
if (lock_get_type(lock) == LOCK_TABLE_EXP) {
if (lock_get_type(lock) == LOCK_TABLE_EXP ||
lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL) {
ut_a(lock_get_mode(lock) == LOCK_S ut_a(lock_get_mode(lock) == LOCK_S
|| lock_get_mode(lock) == LOCK_X); || lock_get_mode(lock) == LOCK_X);
} }
...@@ -3850,6 +3864,7 @@ lock_release_off_kernel( ...@@ -3850,6 +3864,7 @@ lock_release_off_kernel(
ut_a(trx->auto_inc_lock == NULL); ut_a(trx->auto_inc_lock == NULL);
ut_a(trx->n_lock_table_exp == 0); ut_a(trx->n_lock_table_exp == 0);
ut_a(trx->n_lock_table_transactional == 0);
} }
/************************************************************************* /*************************************************************************
...@@ -3915,6 +3930,7 @@ lock_release_tables_off_kernel( ...@@ -3915,6 +3930,7 @@ lock_release_tables_off_kernel(
} }
ut_a(trx->n_lock_table_exp == 0); ut_a(trx->n_lock_table_exp == 0);
ut_a(trx->n_lock_table_transactional == 0);
} }
/************************************************************************* /*************************************************************************
...@@ -4028,11 +4044,15 @@ lock_table_print( ...@@ -4028,11 +4044,15 @@ lock_table_print(
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_a(lock_get_type(lock) == LOCK_TABLE || ut_a(lock_get_type(lock) == LOCK_TABLE ||
lock_get_type(lock) == LOCK_TABLE_EXP); lock_get_type(lock) == LOCK_TABLE_EXP ||
lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL);
if (lock_get_type(lock) == LOCK_TABLE_EXP) { if (lock_get_type(lock) == LOCK_TABLE_EXP) {
fputs("EXPLICIT ", file); fputs("EXPLICIT ", file);
} else if (lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL) {
fputs("TRANSACTIONAL ", file);
} }
fputs("TABLE LOCK table ", file); fputs("TABLE LOCK table ", file);
ut_print_name(file, lock->trx, lock->un_member.tab_lock.table->name); ut_print_name(file, lock->trx, lock->un_member.tab_lock.table->name);
fprintf(file, " trx id %lu %lu", fprintf(file, " trx id %lu %lu",
...@@ -4418,6 +4438,7 @@ lock_table_queue_validate( ...@@ -4418,6 +4438,7 @@ lock_table_queue_validate(
while (lock) { while (lock) {
ut_a(((lock->trx)->conc_state == TRX_ACTIVE) ut_a(((lock->trx)->conc_state == TRX_ACTIVE)
|| ((lock->trx)->conc_state == TRX_PREPARED)
|| ((lock->trx)->conc_state == TRX_COMMITTED_IN_MEMORY)); || ((lock->trx)->conc_state == TRX_COMMITTED_IN_MEMORY));
if (!lock_get_wait(lock)) { if (!lock_get_wait(lock)) {
...@@ -4465,6 +4486,7 @@ lock_rec_queue_validate( ...@@ -4465,6 +4486,7 @@ lock_rec_queue_validate(
while (lock) { while (lock) {
ut_a(lock->trx->conc_state == TRX_ACTIVE ut_a(lock->trx->conc_state == TRX_ACTIVE
|| lock->trx->conc_state == TRX_PREPARED
|| lock->trx->conc_state || lock->trx->conc_state
== TRX_COMMITTED_IN_MEMORY); == TRX_COMMITTED_IN_MEMORY);
...@@ -4519,6 +4541,7 @@ lock_rec_queue_validate( ...@@ -4519,6 +4541,7 @@ lock_rec_queue_validate(
while (lock) { while (lock) {
ut_a(lock->trx->conc_state == TRX_ACTIVE ut_a(lock->trx->conc_state == TRX_ACTIVE
|| lock->trx->conc_state == TRX_PREPARED
|| lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY); || lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
ut_a(trx_in_trx_list(lock->trx)); ut_a(trx_in_trx_list(lock->trx));
...@@ -4601,6 +4624,7 @@ loop: ...@@ -4601,6 +4624,7 @@ loop:
ut_a(trx_in_trx_list(lock->trx)); ut_a(trx_in_trx_list(lock->trx));
ut_a(lock->trx->conc_state == TRX_ACTIVE ut_a(lock->trx->conc_state == TRX_ACTIVE
|| lock->trx->conc_state == TRX_PREPARED
|| lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY); || lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) { for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) {
......
...@@ -784,7 +784,7 @@ row_lock_table_for_mysql( ...@@ -784,7 +784,7 @@ row_lock_table_for_mysql(
table handle */ table handle */
dict_table_t* table, /* in: table to lock, or NULL dict_table_t* table, /* in: table to lock, or NULL
if prebuilt->table should be if prebuilt->table should be
locked as LOCK_TABLE_EXP | locked or a
prebuilt->select_lock_type */ prebuilt->select_lock_type */
ulint mode) /* in: lock mode of table */ ulint mode) /* in: lock mode of table */
{ {
...@@ -821,10 +821,16 @@ run_again: ...@@ -821,10 +821,16 @@ run_again:
if (table) { if (table) {
err = lock_table(0, table, mode, thr); err = lock_table(0, table, mode, thr);
} else {
if (mode == LOCK_TABLE_TRANSACTIONAL) {
err = lock_table(LOCK_TABLE_TRANSACTIONAL,
prebuilt->table,
prebuilt->select_lock_type, thr);
} else { } else {
err = lock_table(LOCK_TABLE_EXP, prebuilt->table, err = lock_table(LOCK_TABLE_EXP, prebuilt->table,
prebuilt->select_lock_type, thr); prebuilt->select_lock_type, thr);
} }
}
trx->error_state = err; trx->error_state = err;
......
...@@ -153,6 +153,7 @@ trx_create( ...@@ -153,6 +153,7 @@ trx_create(
trx->auto_inc_lock = NULL; trx->auto_inc_lock = NULL;
trx->n_lock_table_exp = 0; trx->n_lock_table_exp = 0;
trx->n_lock_table_transactional = 0;
trx->read_view_heap = mem_heap_create(256); trx->read_view_heap = mem_heap_create(256);
trx->read_view = NULL; trx->read_view = NULL;
...@@ -285,6 +286,7 @@ trx_free( ...@@ -285,6 +286,7 @@ trx_free(
ut_a(!trx->has_search_latch); ut_a(!trx->has_search_latch);
ut_a(!trx->auto_inc_lock); ut_a(!trx->auto_inc_lock);
ut_a(!trx->n_lock_table_exp); ut_a(!trx->n_lock_table_exp);
ut_a(!trx->n_lock_table_transactional);
ut_a(trx->dict_operation_lock_mode == 0); ut_a(trx->dict_operation_lock_mode == 0);
...@@ -1645,12 +1647,17 @@ trx_print( ...@@ -1645,12 +1647,17 @@ trx_print(
putc('\n', f); putc('\n', f);
if (trx->n_mysql_tables_in_use > 0 || trx->mysql_n_tables_locked > 0) { if (trx->n_mysql_tables_in_use > 0 || trx->mysql_n_tables_locked > 0) {
fprintf(f, "mysql tables in use %lu, locked %lu\n", fprintf(f, "mysql tables in use %lu, locked %lu\n",
(ulong) trx->n_mysql_tables_in_use, (ulong) trx->n_mysql_tables_in_use,
(ulong) trx->mysql_n_tables_locked); (ulong) trx->mysql_n_tables_locked);
} }
if (trx->n_lock_table_transactional > 0 || trx->n_lock_table_exp > 0) {
fprintf(f, "mysql explicit table locks %lu, transactional table locks %lu\n",
(ulong) trx->n_lock_table_exp,
(ulong) trx->n_lock_table_transactional);
}
newline = TRUE; newline = TRUE;
switch (trx->que_state) { switch (trx->que_state) {
......
...@@ -330,3 +330,8 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA ...@@ -330,3 +330,8 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA
min max avg min max avg
10.00 10.00 10 10.00 10.00 10
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a char(10), b char(10));
INSERT INTO t1 VALUES ('root','localhost'), ('root','%');
SELECT * FROM (SELECT (SELECT a.a FROM t1 AS a WHERE a.a = b.a) FROM t1 AS b) AS c;
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1;
drop table if exists t0, t1, t2, t3,t4; drop table if exists t0, t1, t2, t3, t4;
create table t0 create table t0
( (
key1 int not null, key1 int not null,
...@@ -335,4 +335,55 @@ key1 key2 key3 key4 key5 key6 key7 key8 ...@@ -335,4 +335,55 @@ key1 key2 key3 key4 key5 key6 key7 key8
select count(*) from t0; select count(*) from t0;
count(*) count(*)
1021 1021
drop table t4;
create table t4 (a int);
insert into t4 values (1),(4),(3);
set @save_join_buffer_size=@@join_buffer_size;
set join_buffer_size= 4000;
show variables like 'join_buffer_size';
Variable_name Value
join_buffer_size 8228
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 < 500000 or A.key2 < 3)
and (B.key1 < 500000 or B.key2 < 3);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1016 Using sort_union(i1,i2); Using where
1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1016 Using sort_union(i1,i2); Using where
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 < 500000 or A.key2 < 3)
and (B.key1 < 500000 or B.key2 < 3);
max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
10240
update t0 set key1=1;
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 = 1 or A.key2 = 1)
and (B.key1 = 1 or B.key2 = 1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1020 Using union(i1,i2); Using where
1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1020 Using union(i1,i2); Using where
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 = 1 or A.key2 = 1)
and (B.key1 = 1 or B.key2 = 1);
max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
8194
alter table t0 add filler1 char(200), add filler2 char(200), add filler3 char(200);
update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A, t0 as B
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE A index_merge i1,i2,i3,i4,i5,i6,i7,i8 i2,i3,i4,i5,i6,i8 4,4,4,4,4,4 NULL 16 Using union(intersect(i2,i3,i4,i5,i6),i8); Using where
1 SIMPLE B index_merge i1,i2,i3,i4,i5,i6,i7,i8 i2,i3,i4,i5,i6,i8 4,4,4,4,4,4 NULL 16 Using union(intersect(i2,i3,i4,i5,i6),i8); Using where
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A, t0 as B
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
8186
set join_buffer_size= @save_join_buffer_size;
drop table t0, t1, t2, t3, t4; drop table t0, t1, t2, t3, t4;
...@@ -853,4 +853,19 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -853,4 +853,19 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 1 SIMPLE t3 ALL NULL NULL NULL NULL 2
drop table t1,t2;
create table t1 (a int, b int);
insert into t1 values (1,1),(2,2),(3,3);
create table t2 (a int, b int);
insert into t2 values (1,1), (2,2);
select * from t2 right join t1 on t2.a=t1.a;
a b a b
1 1 1 1
2 2 2 2
NULL NULL 3 3
select straight_join * from t2 right join t1 on t2.a=t1.a;
a b a b
1 1 1 1
2 2 2 2
NULL NULL 3 3
DROP TABLE t0,t1,t2,t3; DROP TABLE t0,t1,t2,t3;
...@@ -214,3 +214,16 @@ CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) N ...@@ -214,3 +214,16 @@ CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) N
insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10); insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10);
SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices; SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices;
DROP TABLE t1; DROP TABLE t1;
#
# Test for bug #7413 "Subquery with non-scalar results participating in
# select list of derived table crashes server" aka "VIEW with sub query can
# cause the MySQL server to crash". If we have encountered problem during
# filling of derived table we should report error and perform cleanup
# properly.
#
CREATE TABLE t1 (a char(10), b char(10));
INSERT INTO t1 VALUES ('root','localhost'), ('root','%');
--error 1242
SELECT * FROM (SELECT (SELECT a.a FROM t1 AS a WHERE a.a = b.a) FROM t1 AS b) AS c;
DROP TABLE t1;
# #
# Index merge tests # Index merge tests
# #
--disable_warnings --disable_warnings
drop table if exists t0, t1, t2, t3,t4; drop table if exists t0, t1, t2, t3, t4;
--enable_warnings --enable_warnings
# Create and fill a table with simple keys # Create and fill a table with simple keys
...@@ -278,4 +277,48 @@ delete from t0 where key1 < 3 or key2 < 4; ...@@ -278,4 +277,48 @@ delete from t0 where key1 < 3 or key2 < 4;
select * from t0 where key1 < 3 or key2 < 4; select * from t0 where key1 < 3 or key2 < 4;
select count(*) from t0; select count(*) from t0;
# Test for BUG#4177
drop table t4;
create table t4 (a int);
insert into t4 values (1),(4),(3);
set @save_join_buffer_size=@@join_buffer_size;
set join_buffer_size= 4000;
show variables like 'join_buffer_size';
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 < 500000 or A.key2 < 3)
and (B.key1 < 500000 or B.key2 < 3);
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 < 500000 or A.key2 < 3)
and (B.key1 < 500000 or B.key2 < 3);
update t0 set key1=1;
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 = 1 or A.key2 = 1)
and (B.key1 = 1 or B.key2 = 1);
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 = 1 or A.key2 = 1)
and (B.key1 = 1 or B.key2 = 1);
alter table t0 add filler1 char(200), add filler2 char(200), add filler3 char(200);
update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A, t0 as B
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A, t0 as B
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
set join_buffer_size= @save_join_buffer_size;
# Test for BUG#4177 ends
drop table t0, t1, t2, t3, t4; drop table t0, t1, t2, t3, t4;
...@@ -606,4 +606,14 @@ INSERT INTO t1 VALUES (0); ...@@ -606,4 +606,14 @@ INSERT INTO t1 VALUES (0);
SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1; SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1;
EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1; EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1;
# Test for BUG#4480
drop table t1,t2;
create table t1 (a int, b int);
insert into t1 values (1,1),(2,2),(3,3);
create table t2 (a int, b int);
insert into t2 values (1,1), (2,2);
select * from t2 right join t1 on t2.a=t1.a;
select straight_join * from t2 right join t1 on t2.a=t1.a;
DROP TABLE t0,t1,t2,t3; DROP TABLE t0,t1,t2,t3;
DOXYDIR = doxygen DOXYDIR = doxygen
noinst_HEADERS = $(DOXYDIR)/predoxy.pl $(DOXYDIR)/postdoxy.pl $(DOXYDIR)/Doxyfile.ndbapi $(DOXYDIR)/Doxyfile.mgmapi $(DOXYDIR)/header.ndbapi.tex $(DOXYDIR)/header.mgmapi.tex noinst_HEADERS = $(DOXYDIR)/predoxy.pl $(DOXYDIR)/postdoxy.pl $(DOXYDIR)/Doxyfile.ndbapi $(DOXYDIR)/Doxyfile.mgmapi $(DOXYDIR)/header.ndbapi.tex $(DOXYDIR)/header.mgmapi.tex
all: do-check ndbapidoc mgmapidoc all: do-check-html ndbapidoc-html mgmapidoc-html
all-pdf: do-check-pdf ndbapidoc-pdf mgmapidoc-pdf
DOXYTMP = .doxytmp DOXYTMP = .doxytmp
DOXYOUT = .doxyout DOXYOUT = .doxyout
...@@ -12,7 +13,7 @@ clean: ...@@ -12,7 +13,7 @@ clean:
rm -rf ndbapi.pdf ndbapi.html mgmapi.pdf mgmapi.html rm -rf ndbapi.pdf ndbapi.html mgmapi.pdf mgmapi.html
rm -rf $(DOXYTMP) $(DOXYOUT) rm -rf $(DOXYTMP) $(DOXYOUT)
do-check: do-check-html:
@set -x; \ @set -x; \
if test @PERL@ = no ; then \ if test @PERL@ = no ; then \
echo "Perl needed to make docs"; \ echo "Perl needed to make docs"; \
...@@ -22,6 +23,8 @@ do-check: ...@@ -22,6 +23,8 @@ do-check:
echo "Doxygen needed to make docs"; \ echo "Doxygen needed to make docs"; \
exit 1; \ exit 1; \
fi; \ fi; \
do-check-pdf: do-check-html
if test @PDFLATEX@ = no ; then \ if test @PDFLATEX@ = no ; then \
echo "Pdflatex needed to make docs"; \ echo "Pdflatex needed to make docs"; \
exit 1; \ exit 1; \
...@@ -30,13 +33,15 @@ do-check: ...@@ -30,13 +33,15 @@ do-check:
echo "Makeindex needed to make docs"; \ echo "Makeindex needed to make docs"; \
exit 1; \ exit 1; \
fi; fi;
### ###
# #
# NDB API Programmer's Guide # NDB API Programmer's Guide
# #
ndbapidoc: ndbapi.pdf ndbapidoc-html: ndbapi.html
ndbapidoc-pdf: ndbapi.pdf
ndbapi.pdf: $(noinst_HEADERS) ndbapi.html: $(noinst_HEADERS)
@set -x; \ @set -x; \
export NDB_RELEASE=$(NDB_RELEASE) \ export NDB_RELEASE=$(NDB_RELEASE) \
@RM@ -f ndbapi.pdf ndbapi.html; \ @RM@ -f ndbapi.pdf ndbapi.html; \
...@@ -47,9 +52,11 @@ ndbapi.pdf: $(noinst_HEADERS) ...@@ -47,9 +52,11 @@ ndbapi.pdf: $(noinst_HEADERS)
@PERL@ $(DOXYDIR)/predoxy.pl; \ @PERL@ $(DOXYDIR)/predoxy.pl; \
mv footer.html $(DOXYTMP); \ mv footer.html $(DOXYTMP); \
(cd $(DOXYTMP) ; @DOXYGEN@ ../$(DOXYDIR)/Doxyfile.ndbapi); \ (cd $(DOXYTMP) ; @DOXYGEN@ ../$(DOXYDIR)/Doxyfile.ndbapi); \
@PERL@ $(DOXYDIR)/postdoxy.pl $(DOXYOUT)/ndbapi.latex "NDB API Programmer Guide"; \ @PERL@ $(DOXYDIR)/postdoxy.pl $(DOXYOUT)/ndbapi.latex "MySQL Cluster NDB API Programmer Guide"; \
(cd $(DOXYOUT) && \ (cd $(DOXYOUT) && \
find ndbapi.html -print | cpio -pdm ..); \ find ndbapi.html -print | cpio -pdm ..); \
ndbapi.pdf: ndbapi.html
(cd $(DOXYOUT)/ndbapi.latex && \ (cd $(DOXYOUT)/ndbapi.latex && \
@PDFLATEX@ refman.tex && @MAKEINDEX@ refman && @PDFLATEX@ refman.tex && \ @PDFLATEX@ refman.tex && @MAKEINDEX@ refman && @PDFLATEX@ refman.tex && \
cp -p refman.pdf ../../ndbapi.pdf); cp -p refman.pdf ../../ndbapi.pdf);
...@@ -58,9 +65,10 @@ ndbapi.pdf: $(noinst_HEADERS) ...@@ -58,9 +65,10 @@ ndbapi.pdf: $(noinst_HEADERS)
# #
# MGM API Guide # MGM API Guide
# #
mgmapidoc: mgmapi.pdf mgmapidoc-html: mgmapi.html
mgmapidoc-pdf: mgmapi.pdf
mgmapi.pdf: $(noinst_HEADERS) mgmapi.html: $(noinst_HEADERS)
@set -x; \ @set -x; \
export NDB_RELEASE=$(NDB_RELEASE) \ export NDB_RELEASE=$(NDB_RELEASE) \
@RM@ -f mgmapi.pdf mgmapi.html; \ @RM@ -f mgmapi.pdf mgmapi.html; \
...@@ -70,9 +78,11 @@ mgmapi.pdf: $(noinst_HEADERS) ...@@ -70,9 +78,11 @@ mgmapi.pdf: $(noinst_HEADERS)
@PERL@ $(DOXYDIR)/predoxy.pl; \ @PERL@ $(DOXYDIR)/predoxy.pl; \
mv footer.html $(DOXYTMP); \ mv footer.html $(DOXYTMP); \
(cd $(DOXYTMP) ; @DOXYGEN@ ../$(DOXYDIR)/Doxyfile.mgmapi); \ (cd $(DOXYTMP) ; @DOXYGEN@ ../$(DOXYDIR)/Doxyfile.mgmapi); \
@PERL@ $(DOXYDIR)/postdoxy.pl $(DOXYOUT)/mgmapi.latex "NDB Cluster MGM API Guide"; \ @PERL@ $(DOXYDIR)/postdoxy.pl $(DOXYOUT)/mgmapi.latex "MySQL Cluster MGM API Guide"; \
(cd $(DOXYOUT) && \ (cd $(DOXYOUT) && \
find mgmapi.html -print | cpio -pdm ..); \ find mgmapi.html -print | cpio -pdm ..); \
mgmapi.pdf: mgmapi.html
(cd $(DOXYOUT)/mgmapi.latex && \ (cd $(DOXYOUT)/mgmapi.latex && \
@PDFLATEX@ refman.tex && @MAKEINDEX@ refman && @PDFLATEX@ refman.tex && \ @PDFLATEX@ refman.tex && @MAKEINDEX@ refman && @PDFLATEX@ refman.tex && \
cp -p refman.pdf ../../mgmapi.pdf); cp -p refman.pdf ../../mgmapi.pdf);
......
...@@ -105,7 +105,7 @@ ALWAYS_DETAILED_SEC = NO ...@@ -105,7 +105,7 @@ ALWAYS_DETAILED_SEC = NO
# ordinary class members. Constructors, destructors and assignment operators of # ordinary class members. Constructors, destructors and assignment operators of
# the base classes will not be shown. # the base classes will not be shown.
INLINE_INHERITED_MEMB = NO INLINE_INHERITED_MEMB = YES
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set # path before files name in the file list and in the header files. If set
...@@ -163,7 +163,7 @@ VERBATIM_HEADERS = NO ...@@ -163,7 +163,7 @@ VERBATIM_HEADERS = NO
# will put list of the files that are included by a file in the documentation # will put list of the files that are included by a file in the documentation
# of that file. # of that file.
SHOW_INCLUDE_FILES = YES SHOW_INCLUDE_FILES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style # will interpret the first line (until the first dot) of a JavaDoc-style
...@@ -256,7 +256,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO ...@@ -256,7 +256,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO
# at the bottom of the documentation of classes and structs. If set to YES the # at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation. # list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES SHOW_USED_FILES = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to warning and progress messages # configuration options related to warning and progress messages
...@@ -794,21 +794,21 @@ PERL_PATH = /usr/bin/perl ...@@ -794,21 +794,21 @@ PERL_PATH = /usr/bin/perl
# option is superceded by the HAVE_DOT option below. This is only a fallback. It is # option is superceded by the HAVE_DOT option below. This is only a fallback. It is
# recommended to install and use dot, since it yield more powerful graphs. # recommended to install and use dot, since it yield more powerful graphs.
CLASS_DIAGRAMS = YES CLASS_DIAGRAMS = NO
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz, a graph visualization # available from the path. This tool is part of Graphviz, a graph visualization
# toolkit from AT&T and Lucent Bell Labs. The other options in this section # toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default) # have no effect if this option is set to NO (the default)
HAVE_DOT = YES HAVE_DOT = NO
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and # will generate a graph for each documented class showing the direct and
# indirect inheritance relations. Setting this tag to YES will force the # indirect inheritance relations. Setting this tag to YES will force the
# the CLASS_DIAGRAMS tag to NO. # the CLASS_DIAGRAMS tag to NO.
CLASS_GRAPH = YES CLASS_GRAPH = NO
# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and # will generate a graph for each documented class showing the direct and
...@@ -820,7 +820,7 @@ COLLABORATION_GRAPH = YES ...@@ -820,7 +820,7 @@ COLLABORATION_GRAPH = YES
# If set to YES, the inheritance and collaboration graphs will show the # If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances. # relations between templates and their instances.
TEMPLATE_RELATIONS = YES TEMPLATE_RELATIONS = NO
# If set to YES, the inheritance and collaboration graphs will hide # If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented # inheritance and usage relations if the target is undocumented
......
...@@ -18,7 +18,7 @@ print OUTFILE<<EOT; ...@@ -18,7 +18,7 @@ print OUTFILE<<EOT;
<center> <center>
EOT EOT
print OUTFILE "Documentation generated " . localtime() . print OUTFILE "Documentation generated " . localtime() .
" from NDB Cluster source files."; " from mysql source files.";
print OUTFILE<<EOT; print OUTFILE<<EOT;
<br> <br>
&copy; 2003-2004 &copy; 2003-2004
......
...@@ -9,8 +9,7 @@ ndbapiinclude_HEADERS = \ ...@@ -9,8 +9,7 @@ ndbapiinclude_HEADERS = \
ndbapi/ndbapi_limits.h \ ndbapi/ndbapi_limits.h \
ndbapi/Ndb.hpp \ ndbapi/Ndb.hpp \
ndbapi/NdbApi.hpp \ ndbapi/NdbApi.hpp \
ndbapi/NdbConnection.hpp \ ndbapi/NdbTransaction.hpp \
ndbapi/NdbCursorOperation.hpp \
ndbapi/NdbDictionary.hpp \ ndbapi/NdbDictionary.hpp \
ndbapi/NdbError.hpp \ ndbapi/NdbError.hpp \
ndbapi/NdbEventOperation.hpp \ ndbapi/NdbEventOperation.hpp \
......
...@@ -33,7 +33,7 @@ class ScanTabReq { ...@@ -33,7 +33,7 @@ class ScanTabReq {
/** /**
* Sender(s) * Sender(s)
*/ */
friend class NdbConnection; friend class NdbTransaction;
friend class NdbScanOperation; friend class NdbScanOperation;
friend class NdbIndexScanOperation; friend class NdbIndexScanOperation;
...@@ -277,7 +277,7 @@ class ScanTabConf { ...@@ -277,7 +277,7 @@ class ScanTabConf {
/** /**
* Reciver(s) * Reciver(s)
*/ */
friend class NdbConnection; // Reciver friend class NdbTransaction; // Reciver
/** /**
* Sender(s) * Sender(s)
...@@ -345,7 +345,7 @@ class ScanTabRef { ...@@ -345,7 +345,7 @@ class ScanTabRef {
/** /**
* Reciver(s) * Reciver(s)
*/ */
friend class NdbConnection; // Reciver friend class NdbTransaction; // Reciver
/** /**
* Sender(s) * Sender(s)
......
...@@ -33,7 +33,7 @@ class TcCommitConf { ...@@ -33,7 +33,7 @@ class TcCommitConf {
* Reciver(s) * Reciver(s)
*/ */
friend class Ndb; friend class Ndb;
friend class NdbConnection; friend class NdbTransaction;
public: public:
STATIC_CONST( SignalLength = 3 ); STATIC_CONST( SignalLength = 3 );
...@@ -60,7 +60,7 @@ class TcCommitRef { ...@@ -60,7 +60,7 @@ class TcCommitRef {
/** /**
* Reciver(s) * Reciver(s)
*/ */
friend class NdbConnection; friend class NdbTransaction;
public: public:
STATIC_CONST( SignalLength = 4 ); STATIC_CONST( SignalLength = 4 );
......
...@@ -36,7 +36,7 @@ class TcHbRep { ...@@ -36,7 +36,7 @@ class TcHbRep {
/** /**
* Sender(s) * Sender(s)
*/ */
friend class NdbConnection; friend class NdbTransaction;
/** /**
* For printing * For printing
......
...@@ -26,7 +26,7 @@ class TcIndxConf { ...@@ -26,7 +26,7 @@ class TcIndxConf {
* Reciver(s) * Reciver(s)
*/ */
friend class Ndb; friend class Ndb;
friend class NdbConnection; friend class NdbTransaction;
/** /**
* Sender(s) * Sender(s)
......
...@@ -27,7 +27,7 @@ class TcKeyConf { ...@@ -27,7 +27,7 @@ class TcKeyConf {
* Reciver(s) * Reciver(s)
*/ */
friend class Ndb; friend class Ndb;
friend class NdbConnection; friend class NdbTransaction;
friend class Ndbcntr; friend class Ndbcntr;
friend class DbUtil; friend class DbUtil;
......
...@@ -33,7 +33,7 @@ class TcKeyFailConf { ...@@ -33,7 +33,7 @@ class TcKeyFailConf {
* Reciver(s) * Reciver(s)
*/ */
friend class Ndb; friend class Ndb;
friend class NdbConnection; friend class NdbTransaction;
public: public:
STATIC_CONST( SignalLength = 3 ); STATIC_CONST( SignalLength = 3 );
......
...@@ -23,7 +23,7 @@ class TcRollbackRep { ...@@ -23,7 +23,7 @@ class TcRollbackRep {
/** /**
* Sender(s) * Sender(s)
*/ */
friend class NdbConnection; friend class NdbTransaction;
friend class DbUtil; friend class DbUtil;
/** /**
......
...@@ -28,7 +28,7 @@ class TransIdAI { ...@@ -28,7 +28,7 @@ class TransIdAI {
/** /**
* Receiver(s) * Receiver(s)
*/ */
friend class NdbConnection; friend class NdbTransaction;
friend class Dbtc; friend class Dbtc;
friend class Dbutil; friend class Dbutil;
friend class Dblqh; friend class Dblqh;
......
...@@ -363,7 +363,20 @@ extern "C" { ...@@ -363,7 +363,20 @@ extern "C" {
NdbMgmHandle ndb_mgm_create_handle(); NdbMgmHandle ndb_mgm_create_handle();
/** /**
* Set connecst string to management server * Destroy a management server handle
*
* @param handle Management handle
*/
void ndb_mgm_destroy_handle(NdbMgmHandle * handle);
/** @} *********************************************************************/
/**
* @name Functions: Connect/Disconnect Management Server
* @{
*/
/**
* Set connect string to management server
* *
* @param handle Management handle * @param handle Management handle
* @param connect_string Connect string to the management server, * @param connect_string Connect string to the management server,
...@@ -373,23 +386,17 @@ extern "C" { ...@@ -373,23 +386,17 @@ extern "C" {
int ndb_mgm_set_connectstring(NdbMgmHandle handle, int ndb_mgm_set_connectstring(NdbMgmHandle handle,
const char *connect_string); const char *connect_string);
int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle);
int ndb_mgm_get_connected_port(NdbMgmHandle handle);
const char *ndb_mgm_get_connected_host(NdbMgmHandle handle);
const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz);
/** /**
* Destroy a management server handle * Get connectstring used for connection
*
* @note returns what the connectstring defaults to if the above call has
* not been performed
* *
* @param handle Management handle * @param handle Management handle
*
* @return connectstring
*/ */
void ndb_mgm_destroy_handle(NdbMgmHandle * handle); const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz);
/** @} *********************************************************************/
/**
* @name Functions: Connect/Disconnect Management Server
* @{
*/
/** /**
* Connect to a management server * Connect to a management server
...@@ -408,6 +415,33 @@ extern "C" { ...@@ -408,6 +415,33 @@ extern "C" {
*/ */
int ndb_mgm_disconnect(NdbMgmHandle handle); int ndb_mgm_disconnect(NdbMgmHandle handle);
/**
* Get nodeid used in the connection
*
* @param handle Management handle
*
* @return node id
*/
int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle);
/**
* Get port used in the connection
*
* @param handle Management handle
*
* @return port
*/
int ndb_mgm_get_connected_port(NdbMgmHandle handle);
/**
* Get host used in the connection
*
* @param handle Management handle
*
* @return hostname
*/
const char *ndb_mgm_get_connected_host(NdbMgmHandle handle);
/** @} *********************************************************************/ /** @} *********************************************************************/
/** /**
* @name Functions: Convert between different data formats * @name Functions: Convert between different data formats
...@@ -436,7 +470,8 @@ extern "C" { ...@@ -436,7 +470,8 @@ extern "C" {
* @param type Node type. * @param type Node type.
* @return NULL if invalid id. * @return NULL if invalid id.
*/ */
const char * ndb_mgm_get_node_type_alias_string(enum ndb_mgm_node_type type, const char **str); const char * ndb_mgm_get_node_type_alias_string(enum ndb_mgm_node_type type,
const char **str);
/** /**
* Convert a string to a ndb_mgm_node_status * Convert a string to a ndb_mgm_node_status
...@@ -454,8 +489,10 @@ extern "C" { ...@@ -454,8 +489,10 @@ extern "C" {
*/ */
const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status); const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
ndb_mgm_event_category ndb_mgm_match_event_category(const char *); ndb_mgm_event_category ndb_mgm_match_event_category(const char *);
const char * ndb_mgm_get_event_category_string(enum ndb_mgm_event_category); const char * ndb_mgm_get_event_category_string(enum ndb_mgm_event_category);
#endif
/** @} *********************************************************************/ /** @} *********************************************************************/
/** /**
...@@ -469,6 +506,7 @@ extern "C" { ...@@ -469,6 +506,7 @@ extern "C" {
* Note the caller must free the pointer returned. * Note the caller must free the pointer returned.
* *
* @param handle Management handle. * @param handle Management handle.
*
* @return Cluster state (or NULL on error). * @return Cluster state (or NULL on error).
*/ */
struct ndb_mgm_cluster_state * ndb_mgm_get_status(NdbMgmHandle handle); struct ndb_mgm_cluster_state * ndb_mgm_get_status(NdbMgmHandle handle);
...@@ -488,6 +526,7 @@ extern "C" { ...@@ -488,6 +526,7 @@ extern "C" {
* n - Means stop n node(s) specified in the * n - Means stop n node(s) specified in the
* array node_list * array node_list
* @param node_list List of node ids of database nodes to be stopped * @param node_list List of node ids of database nodes to be stopped
*
* @return No of nodes stopped (or -1 on error) * @return No of nodes stopped (or -1 on error)
* *
* @note The function is equivalent * @note The function is equivalent
...@@ -507,6 +546,7 @@ extern "C" { ...@@ -507,6 +546,7 @@ extern "C" {
* @param node_list List of node ids of database nodes to be stopped * @param node_list List of node ids of database nodes to be stopped
* @param abort Don't perform gracefull stop, * @param abort Don't perform gracefull stop,
* but rather stop immediatly * but rather stop immediatly
*
* @return No of nodes stopped (or -1 on error). * @return No of nodes stopped (or -1 on error).
*/ */
int ndb_mgm_stop2(NdbMgmHandle handle, int no_of_nodes, int ndb_mgm_stop2(NdbMgmHandle handle, int no_of_nodes,
...@@ -521,6 +561,7 @@ extern "C" { ...@@ -521,6 +561,7 @@ extern "C" {
* n - Means stop n node(s) specified in the * n - Means stop n node(s) specified in the
* array node_list * array node_list
* @param node_list List of node ids of database nodes to be stopped * @param node_list List of node ids of database nodes to be stopped
*
* @return No of nodes stopped (or -1 on error). * @return No of nodes stopped (or -1 on error).
* *
* @note The function is equivalent to * @note The function is equivalent to
...@@ -543,6 +584,7 @@ extern "C" { ...@@ -543,6 +584,7 @@ extern "C" {
* waiting for start command * waiting for start command
* @param abort Don't perform gracefull restart, * @param abort Don't perform gracefull restart,
* but rather restart immediatly * but rather restart immediatly
*
* @return No of nodes stopped (or -1 on error). * @return No of nodes stopped (or -1 on error).
*/ */
int ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes, int ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes,
...@@ -558,6 +600,7 @@ extern "C" { ...@@ -558,6 +600,7 @@ extern "C" {
* n - Means start n node(s) specified in * n - Means start n node(s) specified in
* the array node_list * the array node_list
* @param node_list List of node ids of database nodes to be started * @param node_list List of node ids of database nodes to be started
*
* @return No of nodes started (or -1 on error). * @return No of nodes started (or -1 on error).
* *
* @note The nodes to start must have been started with nostart(-n) * @note The nodes to start must have been started with nostart(-n)
...@@ -582,6 +625,7 @@ extern "C" { ...@@ -582,6 +625,7 @@ extern "C" {
* @param handle NDB management handle. * @param handle NDB management handle.
* @param level A cluster log level to filter. * @param level A cluster log level to filter.
* @param reply Reply message. * @param reply Reply message.
*
* @return -1 on error. * @return -1 on error.
*/ */
int ndb_mgm_filter_clusterlog(NdbMgmHandle handle, int ndb_mgm_filter_clusterlog(NdbMgmHandle handle,
...@@ -592,6 +636,7 @@ extern "C" { ...@@ -592,6 +636,7 @@ extern "C" {
* Get log filter * Get log filter
* *
* @param handle NDB management handle * @param handle NDB management handle
*
* @return A vector of seven elements, * @return A vector of seven elements,
* where each element contains * where each element contains
* 1 if a severity is enabled and 0 if not. * 1 if a severity is enabled and 0 if not.
...@@ -620,7 +665,7 @@ extern "C" { ...@@ -620,7 +665,7 @@ extern "C" {
enum ndb_mgm_event_category category, enum ndb_mgm_event_category category,
int level, int level,
struct ndb_mgm_reply* reply); struct ndb_mgm_reply* reply);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** /**
* Set log category and levels for the Node * Set log category and levels for the Node
* *
...@@ -646,6 +691,7 @@ extern "C" { ...@@ -646,6 +691,7 @@ extern "C" {
*/ */
int ndb_mgm_get_stat_port(NdbMgmHandle handle, int ndb_mgm_get_stat_port(NdbMgmHandle handle,
struct ndb_mgm_reply* reply); struct ndb_mgm_reply* reply);
#endif
/** @} *********************************************************************/ /** @} *********************************************************************/
/** /**
...@@ -699,6 +745,7 @@ extern "C" { ...@@ -699,6 +745,7 @@ extern "C" {
* @param handle NDB management handle. * @param handle NDB management handle.
* @param nodeId Node Id of the single user node * @param nodeId Node Id of the single user node
* @param reply Reply message. * @param reply Reply message.
*
* @return -1 on error. * @return -1 on error.
*/ */
int ndb_mgm_exit_single_user(NdbMgmHandle handle, int ndb_mgm_exit_single_user(NdbMgmHandle handle,
...@@ -709,6 +756,7 @@ extern "C" { ...@@ -709,6 +756,7 @@ extern "C" {
* *
* @param filter pairs of { level, category } that will be * @param filter pairs of { level, category } that will be
* pushed to fd, level=0 ends lists * pushed to fd, level=0 ends lists
*
* @return fd which events will be pushed to * @return fd which events will be pushed to
*/ */
int ndb_mgm_listen_event(NdbMgmHandle handle, int filter[]); int ndb_mgm_listen_event(NdbMgmHandle handle, int filter[]);
...@@ -718,12 +766,16 @@ extern "C" { ...@@ -718,12 +766,16 @@ extern "C" {
* @param handle NDB management handle. * @param handle NDB management handle.
* @param version Version of configuration, 0 means latest * @param version Version of configuration, 0 means latest
* @see MAKE_VERSION * @see MAKE_VERSION
* @Note the caller must call ndb_mgm_detroy_configuration *
* @return configuration
*
* @note the caller must call ndb_mgm_detroy_configuration
*/ */
struct ndb_mgm_configuration * ndb_mgm_get_configuration(NdbMgmHandle handle, struct ndb_mgm_configuration * ndb_mgm_get_configuration(NdbMgmHandle handle,
unsigned version); unsigned version);
void ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *); void ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
int ndb_mgm_alloc_nodeid(NdbMgmHandle handle, int ndb_mgm_alloc_nodeid(NdbMgmHandle handle,
unsigned version, int nodetype); unsigned version, int nodetype);
/** /**
...@@ -749,6 +801,8 @@ extern "C" { ...@@ -749,6 +801,8 @@ extern "C" {
int param, const char ** value); int param, const char ** value);
int ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **); int ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **);
int ndb_mgm_check_connection(NdbMgmHandle handle); int ndb_mgm_check_connection(NdbMgmHandle handle);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
This diff is collapsed.
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "ndbapi_limits.h" #include "ndbapi_limits.h"
#include "Ndb.hpp" #include "Ndb.hpp"
#include "NdbConnection.hpp" #include "NdbTransaction.hpp"
#include "NdbOperation.hpp" #include "NdbOperation.hpp"
#include "NdbScanOperation.hpp" #include "NdbScanOperation.hpp"
#include "NdbIndexOperation.hpp" #include "NdbIndexOperation.hpp"
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
#include <ndb_types.h> #include <ndb_types.h>
#include <NdbDictionary.hpp> #include <NdbDictionary.hpp>
#include <NdbConnection.hpp> #include <NdbTransaction.hpp>
#include <NdbError.hpp> #include <NdbError.hpp>
class Ndb; class Ndb;
class NdbConnection; class NdbTransaction;
class NdbOperation; class NdbOperation;
class NdbRecAttr; class NdbRecAttr;
class NdbTableImpl; class NdbTableImpl;
...@@ -67,7 +67,7 @@ class NdbColumnImpl; ...@@ -67,7 +67,7 @@ class NdbColumnImpl;
* cases NdbBlob is forced to do implicit executes. To avoid this, * cases NdbBlob is forced to do implicit executes. To avoid this,
* operate on complete blob parts. * operate on complete blob parts.
* *
* Use NdbConnection::executePendingBlobOps to flush your reads and * Use NdbTransaction::executePendingBlobOps to flush your reads and
* writes. It avoids execute penalty if nothing is pending. It is not * writes. It avoids execute penalty if nothing is pending. It is not
* needed after execute (obviously) or after next scan result. * needed after execute (obviously) or after next scan result.
* *
...@@ -88,8 +88,13 @@ class NdbColumnImpl; ...@@ -88,8 +88,13 @@ class NdbColumnImpl;
* - lock mode vs allowed operation is not checked * - lock mode vs allowed operation is not checked
* - too many pending blob ops can blow up i/o buffers * - too many pending blob ops can blow up i/o buffers
* - table and its blob part tables are not created atomically * - table and its blob part tables are not created atomically
*/
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/**
* - there is no support for an asynchronous interface * - there is no support for an asynchronous interface
*/ */
#endif
class NdbBlob { class NdbBlob {
public: public:
/** /**
...@@ -212,12 +217,14 @@ public: ...@@ -212,12 +217,14 @@ public:
NdbBlob* blobsNextBlob(); NdbBlob* blobsNextBlob();
private: private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb; friend class Ndb;
friend class NdbConnection; friend class NdbTransaction;
friend class NdbOperation; friend class NdbOperation;
friend class NdbScanOperation; friend class NdbScanOperation;
friend class NdbDictionaryImpl; friend class NdbDictionaryImpl;
friend class NdbResultSet; // atNextResult friend class NdbResultSet; // atNextResult
#endif
// state // state
State theState; State theState;
void setState(State newState); void setState(State newState);
...@@ -226,7 +233,7 @@ private: ...@@ -226,7 +233,7 @@ private:
static void getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c); static void getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c);
// ndb api stuff // ndb api stuff
Ndb* theNdb; Ndb* theNdb;
NdbConnection* theNdbCon; NdbTransaction* theNdbCon;
NdbOperation* theNdbOp; NdbOperation* theNdbOp;
const NdbTableImpl* theTable; const NdbTableImpl* theTable;
const NdbTableImpl* theAccessTable; const NdbTableImpl* theAccessTable;
...@@ -316,7 +323,7 @@ private: ...@@ -316,7 +323,7 @@ private:
// callbacks // callbacks
int invokeActiveHook(); int invokeActiveHook();
// blob handle maintenance // blob handle maintenance
int atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn); int atPrepare(NdbTransaction* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn);
int preExecute(ExecType anExecType, bool& batch); int preExecute(ExecType anExecType, bool& batch);
int postExecute(ExecType anExecType); int postExecute(ExecType anExecType);
int preCommit(); int preCommit();
...@@ -324,7 +331,7 @@ private: ...@@ -324,7 +331,7 @@ private:
// errors // errors
void setErrorCode(int anErrorCode, bool invalidFlag = true); void setErrorCode(int anErrorCode, bool invalidFlag = true);
void setErrorCode(NdbOperation* anOp, bool invalidFlag = true); void setErrorCode(NdbOperation* anOp, bool invalidFlag = true);
void setErrorCode(NdbConnection* aCon, bool invalidFlag = true); void setErrorCode(NdbTransaction* aCon, bool invalidFlag = true);
#ifdef VM_TRACE #ifdef VM_TRACE
int getOperationType() const; int getOperationType() const;
friend class NdbOut& operator<<(NdbOut&, const NdbBlob&); friend class NdbOut& operator<<(NdbOut&, const NdbBlob&);
......
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef NdbCursorOperation_H
#define NdbCursorOperation_H
#endif
This diff is collapsed.
...@@ -64,7 +64,7 @@ class NdbEventOperationImpl; ...@@ -64,7 +64,7 @@ class NdbEventOperationImpl;
* *
* Known issues: * Known issues:
* *
* When several NdbEventOperation s are tied to the same event in the same * When several NdbEventOperation's are tied to the same event in the same
* process they will share the circular buffer. The BufferLength will then * process they will share the circular buffer. The BufferLength will then
* be the same for all and decided by the first NdbEventOperation * be the same for all and decided by the first NdbEventOperation
* instantiation. Just make sure to instantiate the "largest" one first. * instantiation. Just make sure to instantiate the "largest" one first.
...@@ -84,7 +84,7 @@ class NdbEventOperationImpl; ...@@ -84,7 +84,7 @@ class NdbEventOperationImpl;
* replica. If a node fails events will not be received twice anymore * replica. If a node fails events will not be received twice anymore
* for data in corresponding fragment. Will be optimized in later versions. * for data in corresponding fragment. Will be optimized in later versions.
* *
* If a nodefailiure has occured not all events will be recieved * If a node failure has occured not all events will be recieved
* anymore. Drop NdbEventOperation and Create again after nodes are up * anymore. Drop NdbEventOperation and Create again after nodes are up
* again. Will be fixed in later versions. * again. Will be fixed in later versions.
* *
...@@ -97,7 +97,7 @@ class NdbEventOperationImpl; ...@@ -97,7 +97,7 @@ class NdbEventOperationImpl;
* *
* Useful API programs: * Useful API programs:
* *
* select_all -d sys 'NDB$EVENTS_0' * ndb_select_all -d sys 'NDB$EVENTS_0'
* Will show contents in the system table containing created events. * Will show contents in the system table containing created events.
* *
*/ */
...@@ -187,13 +187,26 @@ public: ...@@ -187,13 +187,26 @@ public:
*/ */
NdbDictionary::Event::TableEvent getEventType(); NdbDictionary::Event::TableEvent getEventType();
/**
*
*/
Uint32 getGCI(); Uint32 getGCI();
/**
*
*/
Uint32 getLatestGCI(); Uint32 getLatestGCI();
/*
*
*/
void print(); void print();
private: private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbEventOperationImpl; friend class NdbEventOperationImpl;
friend class Ndb; friend class Ndb;
#endif
NdbEventOperation(Ndb *theNdb, const char* eventName,int bufferLength); NdbEventOperation(Ndb *theNdb, const char* eventName,int bufferLength);
~NdbEventOperation(); ~NdbEventOperation();
static int wait(void *p, int aMillisecondNumber); static int wait(void *p, int aMillisecondNumber);
......
...@@ -14,18 +14,6 @@ ...@@ -14,18 +14,6 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
* Name: NdbIndexOperation.hpp
* Include:
* Link:
* Author: Martin Sköld
* Date: 2002-04-01
* Version: 0.1
* Description: Secondary index support
* Documentation:
* Adjust: 2002-04-01 Martin Sköld First version.
****************************************************************************/
#ifndef NdbIndexOperation_H #ifndef NdbIndexOperation_H
#define NdbIndexOperation_H #define NdbIndexOperation_H
...@@ -40,8 +28,10 @@ class NdbResultSet; ...@@ -40,8 +28,10 @@ class NdbResultSet;
*/ */
class NdbIndexOperation : public NdbOperation class NdbIndexOperation : public NdbOperation
{ {
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb; friend class Ndb;
friend class NdbConnection; friend class NdbTransaction;
#endif
public: public:
/** /**
...@@ -54,16 +44,17 @@ public: ...@@ -54,16 +44,17 @@ public:
/** /**
* Define the NdbIndexOperation to be a standard operation of type readTuple. * Define the NdbIndexOperation to be a standard operation of type readTuple.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* reads a tuple. * reads a tuple.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
*/ */
int readTuple(LockMode); int readTuple(LockMode);
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/** /**
* Define the NdbIndexOperation to be a standard operation of type readTuple. * Define the NdbIndexOperation to be a standard operation of type readTuple.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* reads a tuple. * reads a tuple.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
...@@ -73,7 +64,7 @@ public: ...@@ -73,7 +64,7 @@ public:
/** /**
* Define the NdbIndexOperation to be a standard operation of type * Define the NdbIndexOperation to be a standard operation of type
* readTupleExclusive. * readTupleExclusive.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* read a tuple using an exclusive lock. * read a tuple using an exclusive lock.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
...@@ -82,7 +73,7 @@ public: ...@@ -82,7 +73,7 @@ public:
/** /**
* Define the NdbIndexOperation to be a standard operation of type simpleRead. * Define the NdbIndexOperation to be a standard operation of type simpleRead.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* reads an existing tuple (using shared read lock), * reads an existing tuple (using shared read lock),
* but releases lock immediately after read. * but releases lock immediately after read.
* *
...@@ -101,7 +92,7 @@ public: ...@@ -101,7 +92,7 @@ public:
/** /**
* Define the NdbOperation to be a standard operation of type committedRead. * Define the NdbOperation to be a standard operation of type committedRead.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* read latest committed value of the record. * read latest committed value of the record.
* *
* This means that if another transaction is updating the * This means that if another transaction is updating the
...@@ -113,7 +104,6 @@ public: ...@@ -113,7 +104,6 @@ public:
*/ */
int dirtyRead(); int dirtyRead();
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
int committedRead(); int committedRead();
#endif #endif
...@@ -121,7 +111,7 @@ public: ...@@ -121,7 +111,7 @@ public:
* Define the NdbIndexOperation to be a standard operation of type * Define the NdbIndexOperation to be a standard operation of type
* updateTuple. * updateTuple.
* *
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* updates a tuple in the table. * updates a tuple in the table.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
...@@ -132,24 +122,27 @@ public: ...@@ -132,24 +122,27 @@ public:
* Define the NdbIndexOperation to be a standard operation of type * Define the NdbIndexOperation to be a standard operation of type
* deleteTuple. * deleteTuple.
* *
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* deletes a tuple. * deletes a tuple.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
*/ */
int deleteTuple(); int deleteTuple();
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/** /**
* Define the NdbIndexOperation to be a standard operation of type * Define the NdbIndexOperation to be a standard operation of type
* dirtyUpdate. * dirtyUpdate.
* *
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* updates without two-phase commit. * updates without two-phase commit.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
*/ */
int dirtyUpdate(); int dirtyUpdate();
#endif
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** @} *********************************************************************/ /** @} *********************************************************************/
/** /**
* @name Define Interpreted Program Operation * @name Define Interpreted Program Operation
...@@ -169,6 +162,7 @@ public: ...@@ -169,6 +162,7 @@ public:
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
*/ */
int interpretedDeleteTuple(); int interpretedDeleteTuple();
#endif
/** @} *********************************************************************/ /** @} *********************************************************************/
...@@ -181,7 +175,7 @@ private: ...@@ -181,7 +175,7 @@ private:
// Overloaded methods from NdbCursorOperation // Overloaded methods from NdbCursorOperation
int indxInit(const class NdbIndexImpl* anIndex, int indxInit(const class NdbIndexImpl* anIndex,
const class NdbTableImpl* aTable, const class NdbTableImpl* aTable,
NdbConnection* myConnection); NdbTransaction*);
int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId); int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId);
......
...@@ -24,11 +24,14 @@ ...@@ -24,11 +24,14 @@
* @brief Class of scan operations for use to scan ordered index * @brief Class of scan operations for use to scan ordered index
*/ */
class NdbIndexScanOperation : public NdbScanOperation { class NdbIndexScanOperation : public NdbScanOperation {
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb; friend class Ndb;
friend class NdbConnection; friend class NdbTransaction;
friend class NdbResultSet; friend class NdbResultSet;
friend class NdbOperation; friend class NdbOperation;
friend class NdbScanOperation; friend class NdbScanOperation;
#endif
public: public:
/** /**
* readTuples returns a NdbResultSet where tuples are stored. * readTuples returns a NdbResultSet where tuples are stored.
...@@ -50,6 +53,7 @@ public: ...@@ -50,6 +53,7 @@ public:
bool order_desc = false, bool order_desc = false,
bool read_range_no = false); bool read_range_no = false);
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
inline int readTuples(int parallell){ inline int readTuples(int parallell){
return readTuples(LM_Read, 0, parallell, false); return readTuples(LM_Read, 0, parallell, false);
} }
...@@ -57,6 +61,7 @@ public: ...@@ -57,6 +61,7 @@ public:
inline int readTuplesExclusive(int parallell = 0){ inline int readTuplesExclusive(int parallell = 0){
return readTuples(LM_Exclusive, 0, parallell, false); return readTuples(LM_Exclusive, 0, parallell, false);
} }
#endif
/** /**
* Type of ordered index key bound. The values (0-4) will not change * Type of ordered index key bound. The values (0-4) will not change
......
...@@ -27,7 +27,7 @@ class Ndb; ...@@ -27,7 +27,7 @@ class Ndb;
class NdbApiSignal; class NdbApiSignal;
class NdbRecAttr; class NdbRecAttr;
class NdbOperation; class NdbOperation;
class NdbConnection; class NdbTransaction;
class NdbColumnImpl; class NdbColumnImpl;
class NdbBlob; class NdbBlob;
...@@ -37,14 +37,17 @@ class NdbBlob; ...@@ -37,14 +37,17 @@ class NdbBlob;
*/ */
class NdbOperation class NdbOperation
{ {
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb; friend class Ndb;
friend class NdbConnection; friend class NdbTransaction;
friend class NdbScanOperation; friend class NdbScanOperation;
friend class NdbScanReceiver; friend class NdbScanReceiver;
friend class NdbScanFilter; friend class NdbScanFilter;
friend class NdbScanFilterImpl; friend class NdbScanFilterImpl;
friend class NdbReceiver; friend class NdbReceiver;
friend class NdbBlob; friend class NdbBlob;
#endif
public: public:
/** /**
* @name Define Standard Operation Type * @name Define Standard Operation Type
...@@ -66,7 +69,7 @@ public: ...@@ -66,7 +69,7 @@ public:
/** /**
* Define the NdbOperation to be a standard operation of type insertTuple. * Define the NdbOperation to be a standard operation of type insertTuple.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* adds a new tuple to the table. * adds a new tuple to the table.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
...@@ -75,7 +78,7 @@ public: ...@@ -75,7 +78,7 @@ public:
/** /**
* Define the NdbOperation to be a standard operation of type updateTuple. * Define the NdbOperation to be a standard operation of type updateTuple.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* updates a tuple in the table. * updates a tuple in the table.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
...@@ -84,7 +87,7 @@ public: ...@@ -84,7 +87,7 @@ public:
/** /**
* Define the NdbOperation to be a standard operation of type writeTuple. * Define the NdbOperation to be a standard operation of type writeTuple.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* writes a tuple to the table. * writes a tuple to the table.
* If the tuple exists, it updates it, otherwise an insert takes place. * If the tuple exists, it updates it, otherwise an insert takes place.
* *
...@@ -94,7 +97,7 @@ public: ...@@ -94,7 +97,7 @@ public:
/** /**
* Define the NdbOperation to be a standard operation of type deleteTuple. * Define the NdbOperation to be a standard operation of type deleteTuple.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* delete a tuple. * delete a tuple.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
...@@ -103,16 +106,17 @@ public: ...@@ -103,16 +106,17 @@ public:
/** /**
* Define the NdbOperation to be a standard operation of type readTuple. * Define the NdbOperation to be a standard operation of type readTuple.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* reads a tuple. * reads a tuple.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
*/ */
virtual int readTuple(LockMode); virtual int readTuple(LockMode);
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/** /**
* Define the NdbOperation to be a standard operation of type readTuple. * Define the NdbOperation to be a standard operation of type readTuple.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* reads a tuple. * reads a tuple.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
...@@ -122,7 +126,7 @@ public: ...@@ -122,7 +126,7 @@ public:
/** /**
* Define the NdbOperation to be a standard operation of type * Define the NdbOperation to be a standard operation of type
* readTupleExclusive. * readTupleExclusive.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* read a tuple using an exclusive lock. * read a tuple using an exclusive lock.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
...@@ -132,7 +136,7 @@ public: ...@@ -132,7 +136,7 @@ public:
/** /**
* Define the NdbOperation to be a standard operation of type * Define the NdbOperation to be a standard operation of type
* simpleRead. * simpleRead.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* reads an existing tuple (using shared read lock), * reads an existing tuple (using shared read lock),
* but releases lock immediately after read. * but releases lock immediately after read.
* *
...@@ -149,10 +153,9 @@ public: ...@@ -149,10 +153,9 @@ public:
*/ */
virtual int simpleRead(); virtual int simpleRead();
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/** /**
* Define the NdbOperation to be a standard operation of type committedRead. * Define the NdbOperation to be a standard operation of type committedRead.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* read latest committed value of the record. * read latest committed value of the record.
* *
* This means that if another transaction is updating the * This means that if another transaction is updating the
...@@ -165,11 +168,10 @@ public: ...@@ -165,11 +168,10 @@ public:
* @depricated * @depricated
*/ */
virtual int dirtyRead(); virtual int dirtyRead();
#endif
/** /**
* Define the NdbOperation to be a standard operation of type committedRead. * Define the NdbOperation to be a standard operation of type committedRead.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* read latest committed value of the record. * read latest committed value of the record.
* *
* This means that if another transaction is updating the * This means that if another transaction is updating the
...@@ -183,7 +185,7 @@ public: ...@@ -183,7 +185,7 @@ public:
/** /**
* Define the NdbOperation to be a standard operation of type dirtyUpdate. * Define the NdbOperation to be a standard operation of type dirtyUpdate.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* updates without two-phase commit. * updates without two-phase commit.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
...@@ -192,13 +194,15 @@ public: ...@@ -192,13 +194,15 @@ public:
/** /**
* Define the NdbOperation to be a standard operation of type dirtyWrite. * Define the NdbOperation to be a standard operation of type dirtyWrite.
* When calling NdbConnection::execute, this operation * When calling NdbTransaction::execute, this operation
* writes without two-phase commit. * writes without two-phase commit.
* *
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
*/ */
virtual int dirtyWrite(); virtual int dirtyWrite();
#endif
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** @} *********************************************************************/ /** @} *********************************************************************/
/** /**
* @name Define Interpreted Program Operation Type * @name Define Interpreted Program Operation Type
...@@ -218,6 +222,7 @@ public: ...@@ -218,6 +222,7 @@ public:
* @return 0 if successful otherwise -1. * @return 0 if successful otherwise -1.
*/ */
virtual int interpretedDeleteTuple(); virtual int interpretedDeleteTuple();
#endif
/** @} *********************************************************************/ /** @} *********************************************************************/
...@@ -301,7 +306,7 @@ public: ...@@ -301,7 +306,7 @@ public:
* @note This method does not fetch the attribute value from * @note This method does not fetch the attribute value from
* the database! The NdbRecAttr object returned by this method * the database! The NdbRecAttr object returned by this method
* is <em>not</em> readable/printable before the * is <em>not</em> readable/printable before the
* transaction has been executed with NdbConnection::execute. * transaction has been executed with NdbTransaction::execute.
* *
* @param anAttrName Attribute name * @param anAttrName Attribute name
* @param aValue If this is non-NULL, then the attribute value * @param aValue If this is non-NULL, then the attribute value
...@@ -374,6 +379,7 @@ public: ...@@ -374,6 +379,7 @@ public:
virtual NdbBlob* getBlobHandle(const char* anAttrName); virtual NdbBlob* getBlobHandle(const char* anAttrName);
virtual NdbBlob* getBlobHandle(Uint32 anAttrId); virtual NdbBlob* getBlobHandle(Uint32 anAttrId);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** @} *********************************************************************/ /** @} *********************************************************************/
/** /**
* @name Specify Interpreted Program Instructions * @name Specify Interpreted Program Instructions
...@@ -672,6 +678,7 @@ public: ...@@ -672,6 +678,7 @@ public:
* @return -1 if unsuccessful. * @return -1 if unsuccessful.
*/ */
int ret_sub(); int ret_sub();
#endif
/** @} *********************************************************************/ /** @} *********************************************************************/
...@@ -720,6 +727,7 @@ public: ...@@ -720,6 +727,7 @@ public:
LockMode getLockMode() const { return theLockMode; } LockMode getLockMode() const { return theLockMode; }
void setAbortOption(Int8 ao) { m_abortOption = ao; } void setAbortOption(Int8 ao) { m_abortOption = ao; }
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** /**
* Set/get distribution/partition key * Set/get distribution/partition key
*/ */
...@@ -727,6 +735,7 @@ public: ...@@ -727,6 +735,7 @@ public:
void setPartitionHash(Uint32 key); void setPartitionHash(Uint32 key);
void setPartitionHash(const Uint64 *, Uint32 len); void setPartitionHash(const Uint64 *, Uint32 len);
Uint32 getPartitionId() const; Uint32 getPartitionId() const;
#endif
protected: protected:
int handle_distribution_key(const Uint64 *, Uint32 len); int handle_distribution_key(const Uint64 *, Uint32 len);
protected: protected:
...@@ -743,7 +752,7 @@ protected: ...@@ -743,7 +752,7 @@ protected:
//-------------------------------------------------------------- //--------------------------------------------------------------
// Initialise after allocating operation to a transaction // Initialise after allocating operation to a transaction
//-------------------------------------------------------------- //--------------------------------------------------------------
int init(const class NdbTableImpl*, NdbConnection* aCon); int init(const class NdbTableImpl*, NdbTransaction* aCon);
void initInterpreter(); void initInterpreter();
void next(NdbOperation*); // Set next pointer void next(NdbOperation*); // Set next pointer
...@@ -775,7 +784,7 @@ protected: ...@@ -775,7 +784,7 @@ protected:
void Status(OperationStatus); // Set the status information void Status(OperationStatus); // Set the status information
void NdbCon(NdbConnection*); // Set reference to connection void NdbCon(NdbTransaction*); // Set reference to connection
// object. // object.
virtual void release(); // Release all operations virtual void release(); // Release all operations
...@@ -812,7 +821,7 @@ protected: ...@@ -812,7 +821,7 @@ protected:
virtual int equal_impl(const NdbColumnImpl*,const char* aValue, Uint32 len); virtual int equal_impl(const NdbColumnImpl*,const char* aValue, Uint32 len);
virtual NdbRecAttr* getValue_impl(const NdbColumnImpl*, char* aValue = 0); virtual NdbRecAttr* getValue_impl(const NdbColumnImpl*, char* aValue = 0);
int setValue(const NdbColumnImpl* anAttrObject, const char* aValue, Uint32 len); int setValue(const NdbColumnImpl* anAttrObject, const char* aValue, Uint32 len);
NdbBlob* getBlobHandle(NdbConnection* aCon, const NdbColumnImpl* anAttrObject); NdbBlob* getBlobHandle(NdbTransaction* aCon, const NdbColumnImpl* anAttrObject);
int incValue(const NdbColumnImpl* anAttrObject, Uint32 aValue); int incValue(const NdbColumnImpl* anAttrObject, Uint32 aValue);
int incValue(const NdbColumnImpl* anAttrObject, Uint64 aValue); int incValue(const NdbColumnImpl* anAttrObject, Uint64 aValue);
int subValue(const NdbColumnImpl* anAttrObject, Uint32 aValue); int subValue(const NdbColumnImpl* anAttrObject, Uint32 aValue);
...@@ -861,7 +870,7 @@ protected: ...@@ -861,7 +870,7 @@ protected:
int theErrorLine; // Error line int theErrorLine; // Error line
Ndb* theNdb; // Point back to the Ndb object. Ndb* theNdb; // Point back to the Ndb object.
NdbConnection* theNdbCon; // Point back to the connection object. NdbTransaction* theNdbCon; // Point back to the connection object.
NdbOperation* theNext; // Next pointer to operation. NdbOperation* theNext; // Next pointer to operation.
union { union {
...@@ -1043,14 +1052,14 @@ NdbOperation::Status( OperationStatus aStatus ) ...@@ -1043,14 +1052,14 @@ NdbOperation::Status( OperationStatus aStatus )
} }
/****************************************************************************** /******************************************************************************
void NdbCon(NdbConnection* aNdbCon); void NdbCon(NdbTransaction* aNdbCon);
Parameters: aNdbCon: Pointers to NdbConnection object. Parameters: aNdbCon: Pointers to NdbTransaction object.
Remark: Set the reference to the connection in the operation object. Remark: Set the reference to the connection in the operation object.
******************************************************************************/ ******************************************************************************/
inline inline
void void
NdbOperation::NdbCon(NdbConnection* aNdbCon) NdbOperation::NdbCon(NdbTransaction* aNdbCon)
{ {
theNdbCon = aNdbCon; theNdbCon = aNdbCon;
} }
......
...@@ -34,7 +34,7 @@ class NdbOperation; ...@@ -34,7 +34,7 @@ class NdbOperation;
* MyRecAttr = MyOperation->getValue("ATTR2", NULL); * MyRecAttr = MyOperation->getValue("ATTR2", NULL);
* if (MyRecAttr == NULL) goto error; * if (MyRecAttr == NULL) goto error;
* *
* if (MyConnection->execute(Commit) == -1) goto error; * if (MyTransaction->execute(Commit) == -1) goto error;
* *
* ndbout << MyRecAttr->u_32_value(); * ndbout << MyRecAttr->u_32_value();
* @endcode * @endcode
...@@ -43,14 +43,14 @@ class NdbOperation; ...@@ -43,14 +43,14 @@ class NdbOperation;
* @ref ndbapi_example2.cpp. * @ref ndbapi_example2.cpp.
* *
* @note The NdbRecAttr object is instantiated with its value when * @note The NdbRecAttr object is instantiated with its value when
* NdbConnection::execute is called. Before this, the value is * NdbTransaction::execute is called. Before this, the value is
* undefined. (NdbRecAttr::isNULL can be used to check * undefined. (NdbRecAttr::isNULL can be used to check
* if the value is defined or not.) * if the value is defined or not.)
* This means that an NdbRecAttr object only has valid information * This means that an NdbRecAttr object only has valid information
* between the time of calling NdbConnection::execute and * between the time of calling NdbTransaction::execute and
* the time of Ndb::closeTransaction. * the time of Ndb::closeTransaction.
* The value of the null indicator is -1 until the * The value of the null indicator is -1 until the
* NdbConnection::execute method have been called. * NdbTransaction::execute method have been called.
* *
* For simple types, there are methods which directly getting the value * For simple types, there are methods which directly getting the value
* from the NdbRecAttr object. * from the NdbRecAttr object.
...@@ -72,12 +72,14 @@ class NdbOperation; ...@@ -72,12 +72,14 @@ class NdbOperation;
*/ */
class NdbRecAttr class NdbRecAttr
{ {
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbOperation; friend class NdbOperation;
friend class NdbIndexScanOperation; friend class NdbIndexScanOperation;
friend class NdbEventOperationImpl; friend class NdbEventOperationImpl;
friend class NdbReceiver; friend class NdbReceiver;
friend class Ndb; friend class Ndb;
friend class NdbOut& operator<<(class NdbOut&, const class AttributeS&); friend class NdbOut& operator<<(class NdbOut&, const class AttributeS&);
#endif
public: public:
/** /**
...@@ -124,7 +126,7 @@ public: ...@@ -124,7 +126,7 @@ public:
* Check if attribute value is NULL. * Check if attribute value is NULL.
* *
* @return -1 = Not defined (Failure or * @return -1 = Not defined (Failure or
* NdbConnection::execute not yet called).<br> * NdbTransaction::execute not yet called).<br>
* 0 = Attribute value is defined, but not equal to NULL.<br> * 0 = Attribute value is defined, but not equal to NULL.<br>
* 1 = Attribute value is defined and equal to NULL. * 1 = Attribute value is defined and equal to NULL.
*/ */
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <ndb_global.h> #include <ndb_global.h>
class Ndb; class Ndb;
class NdbConnection; class NdbTransaction;
class NdbReceiver class NdbReceiver
{ {
...@@ -31,7 +31,7 @@ class NdbReceiver ...@@ -31,7 +31,7 @@ class NdbReceiver
friend class NdbScanOperation; friend class NdbScanOperation;
friend class NdbIndexOperation; friend class NdbIndexOperation;
friend class NdbIndexScanOperation; friend class NdbIndexScanOperation;
friend class NdbConnection; friend class NdbTransaction;
public: public:
enum ReceiverType { NDB_UNINITIALIZED, enum ReceiverType { NDB_UNINITIALIZED,
NDB_OPERATION = 1, NDB_OPERATION = 1,
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
return m_type; return m_type;
} }
inline NdbConnection * getTransaction(); inline NdbTransaction * getTransaction();
void* getOwner(){ void* getOwner(){
return m_owner; return m_owner;
} }
...@@ -145,5 +145,5 @@ NdbReceiver::execSCANOPCONF(Uint32 tcPtrI, Uint32 len, Uint32 rows){ ...@@ -145,5 +145,5 @@ NdbReceiver::execSCANOPCONF(Uint32 tcPtrI, Uint32 len, Uint32 rows){
return (tmp == len ? 1 : 0); return (tmp == len ? 1 : 0);
} }
#endif #endif // DOXYGEN_SHOULD_SKIP_INTERNAL
#endif #endif
...@@ -169,7 +169,9 @@ public: ...@@ -169,7 +169,9 @@ public:
/** @} *********************************************************************/ /** @} *********************************************************************/
private: private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbScanFilterImpl; friend class NdbScanFilterImpl;
#endif
class NdbScanFilterImpl & m_impl; class NdbScanFilterImpl & m_impl;
NdbScanFilter& operator=(const NdbScanFilter&); ///< Defined not implemented NdbScanFilter& operator=(const NdbScanFilter&); ///< Defined not implemented
}; };
......
...@@ -14,18 +14,6 @@ ...@@ -14,18 +14,6 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
* Name: NdbScanOperation.hpp
* Include:
* Link:
* Author: Martin Sköld
* Date: 2002-04-01
* Version: 0.1
* Description: Table scan support
* Documentation:
* Adjust: 2002-04-01 Martin Sköld First version.
****************************************************************************/
#ifndef NdbScanOperation_H #ifndef NdbScanOperation_H
#define NdbScanOperation_H #define NdbScanOperation_H
...@@ -39,11 +27,14 @@ class NdbResultSet; ...@@ -39,11 +27,14 @@ class NdbResultSet;
* @brief Class of scan operations for use in transactions. * @brief Class of scan operations for use in transactions.
*/ */
class NdbScanOperation : public NdbOperation { class NdbScanOperation : public NdbOperation {
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb; friend class Ndb;
friend class NdbConnection; friend class NdbTransaction;
friend class NdbResultSet; friend class NdbResultSet;
friend class NdbOperation; friend class NdbOperation;
friend class NdbBlob; friend class NdbBlob;
#endif
public: public:
/** /**
* readTuples returns a NdbResultSet where tuples are stored. * readTuples returns a NdbResultSet where tuples are stored.
...@@ -58,6 +49,7 @@ public: ...@@ -58,6 +49,7 @@ public:
int readTuples(LockMode = LM_Read, int readTuples(LockMode = LM_Read,
Uint32 batch = 0, Uint32 parallel = 0); Uint32 batch = 0, Uint32 parallel = 0);
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
inline int readTuples(int parallell){ inline int readTuples(int parallell){
return readTuples(LM_Read, 0, parallell); return readTuples(LM_Read, 0, parallell);
} }
...@@ -65,9 +57,12 @@ public: ...@@ -65,9 +57,12 @@ public:
inline int readTuplesExclusive(int parallell = 0){ inline int readTuplesExclusive(int parallell = 0){
return readTuples(LM_Exclusive, 0, parallell); return readTuples(LM_Exclusive, 0, parallell);
} }
#endif
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
NdbBlob* getBlobHandle(const char* anAttrName); NdbBlob* getBlobHandle(const char* anAttrName);
NdbBlob* getBlobHandle(Uint32 anAttrId); NdbBlob* getBlobHandle(Uint32 anAttrId);
#endif
/** /**
* Get the next tuple in a scan transaction. * Get the next tuple in a scan transaction.
...@@ -145,7 +140,7 @@ public: ...@@ -145,7 +140,7 @@ public:
* @return an NdbOperation or NULL. * @return an NdbOperation or NULL.
*/ */
NdbOperation* updateCurrentTuple(); NdbOperation* updateCurrentTuple();
NdbOperation* updateCurrentTuple(NdbConnection* updateTrans); NdbOperation* updateCurrentTuple(NdbTransaction* updateTrans);
/** /**
* Transfer scan operation to a deleting transaction. Use this function * Transfer scan operation to a deleting transaction. Use this function
...@@ -164,7 +159,7 @@ public: ...@@ -164,7 +159,7 @@ public:
* @return an NdbOperation or NULL. * @return an NdbOperation or NULL.
*/ */
int deleteCurrentTuple(); int deleteCurrentTuple();
int deleteCurrentTuple(NdbConnection* takeOverTransaction); int deleteCurrentTuple(NdbTransaction* takeOverTransaction);
protected: protected:
NdbScanOperation(Ndb* aNdb); NdbScanOperation(Ndb* aNdb);
...@@ -179,7 +174,7 @@ protected: ...@@ -179,7 +174,7 @@ protected:
int executeCursor(int ProcessorId); int executeCursor(int ProcessorId);
// Overloaded private methods from NdbOperation // Overloaded private methods from NdbOperation
int init(const NdbTableImpl* tab, NdbConnection* myConnection); int init(const NdbTableImpl* tab, NdbTransaction*);
int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId); int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId);
int doSend(int ProcessorId); int doSend(int ProcessorId);
void checkForceSend(bool forceSend); void checkForceSend(bool forceSend);
...@@ -187,7 +182,7 @@ protected: ...@@ -187,7 +182,7 @@ protected:
virtual void setErrorCode(int aErrorCode); virtual void setErrorCode(int aErrorCode);
virtual void setErrorCodeAbort(int aErrorCode); virtual void setErrorCodeAbort(int aErrorCode);
NdbConnection *m_transConnection; NdbTransaction *m_transConnection;
// Scan related variables // Scan related variables
Uint32 theParallelism; Uint32 theParallelism;
...@@ -230,7 +225,7 @@ protected: ...@@ -230,7 +225,7 @@ protected:
void execCLOSE_SCAN_REP(); void execCLOSE_SCAN_REP();
int getKeyFromKEYINFO20(Uint32* data, unsigned size); int getKeyFromKEYINFO20(Uint32* data, unsigned size);
NdbOperation* takeOverScanOp(OperationType opType, NdbConnection*); NdbOperation* takeOverScanOp(OperationType opType, NdbTransaction*);
bool m_ordered; bool m_ordered;
bool m_descending; bool m_descending;
...@@ -245,7 +240,7 @@ NdbScanOperation::updateCurrentTuple(){ ...@@ -245,7 +240,7 @@ NdbScanOperation::updateCurrentTuple(){
inline inline
NdbOperation* NdbOperation*
NdbScanOperation::updateCurrentTuple(NdbConnection* takeOverTrans){ NdbScanOperation::updateCurrentTuple(NdbTransaction* takeOverTrans){
return takeOverScanOp(NdbOperation::UpdateRequest, return takeOverScanOp(NdbOperation::UpdateRequest,
takeOverTrans); takeOverTrans);
} }
...@@ -258,7 +253,7 @@ NdbScanOperation::deleteCurrentTuple(){ ...@@ -258,7 +253,7 @@ NdbScanOperation::deleteCurrentTuple(){
inline inline
int int
NdbScanOperation::deleteCurrentTuple(NdbConnection * takeOverTrans){ NdbScanOperation::deleteCurrentTuple(NdbTransaction * takeOverTrans){
void * res = takeOverScanOp(NdbOperation::DeleteRequest, void * res = takeOverScanOp(NdbOperation::DeleteRequest,
takeOverTrans); takeOverTrans);
if(res == 0) if(res == 0)
......
...@@ -70,6 +70,8 @@ struct NdbUpGradeCompatible { ...@@ -70,6 +70,8 @@ struct NdbUpGradeCompatible {
#ifndef TEST_VERSION #ifndef TEST_VERSION
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
{ MAKE_VERSION(5,0,3), MAKE_VERSION(5,0,2), UG_Exact },
{ MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact },
{ MAKE_VERSION(3,5,2), MAKE_VERSION(3,5,1), UG_Exact }, { MAKE_VERSION(3,5,2), MAKE_VERSION(3,5,1), UG_Exact },
{ 0, 0, UG_Null } { 0, 0, UG_Null }
}; };
......
...@@ -14,8 +14,8 @@ libndbapi_la_SOURCES = \ ...@@ -14,8 +14,8 @@ libndbapi_la_SOURCES = \
Ndberr.cpp \ Ndberr.cpp \
ndberror.c \ ndberror.c \
NdbErrorOut.cpp \ NdbErrorOut.cpp \
NdbConnection.cpp \ NdbTransaction.cpp \
NdbConnectionScan.cpp \ NdbTransactionScan.cpp \
NdbOperation.cpp \ NdbOperation.cpp \
NdbOperationSearch.cpp \ NdbOperationSearch.cpp \
NdbOperationScan.cpp \ NdbOperationScan.cpp \
......
This diff is collapsed.
...@@ -93,7 +93,7 @@ private: ...@@ -93,7 +93,7 @@ private:
void setDataPtr(Uint32 *); void setDataPtr(Uint32 *);
friend class NdbConnection; friend class NdbTransaction;
friend class NdbScanReceiver; friend class NdbScanReceiver;
friend class Table; friend class Table;
void copyFrom(const NdbApiSignal * src); void copyFrom(const NdbApiSignal * src);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <Ndb.hpp> #include <Ndb.hpp>
#include <NdbDictionaryImpl.hpp> #include <NdbDictionaryImpl.hpp>
#include <NdbConnection.hpp> #include <NdbTransaction.hpp>
#include <NdbOperation.hpp> #include <NdbOperation.hpp>
#include <NdbIndexOperation.hpp> #include <NdbIndexOperation.hpp>
#include <NdbRecAttr.hpp> #include <NdbRecAttr.hpp>
...@@ -1059,7 +1059,7 @@ NdbBlob::invokeActiveHook() ...@@ -1059,7 +1059,7 @@ NdbBlob::invokeActiveHook()
* data. For read operation adds read of head+inline. * data. For read operation adds read of head+inline.
*/ */
int int
NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn) NdbBlob::atPrepare(NdbTransaction* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn)
{ {
assert(theState == Idle); assert(theState == Idle);
// ndb api stuff // ndb api stuff
...@@ -1550,7 +1550,7 @@ NdbBlob::setErrorCode(NdbOperation* anOp, bool invalidFlag) ...@@ -1550,7 +1550,7 @@ NdbBlob::setErrorCode(NdbOperation* anOp, bool invalidFlag)
} }
void void
NdbBlob::setErrorCode(NdbConnection* aCon, bool invalidFlag) NdbBlob::setErrorCode(NdbTransaction* aCon, bool invalidFlag)
{ {
int code = 0; int code = 0;
if (theNdbCon != NULL && (code = theNdbCon->theError.code) != 0) if (theNdbCon != NULL && (code = theNdbCon->theError.code) != 0)
......
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
* Name: NdbCursorOperation.cpp
* Include:
* Link:
* Author: UABMASD Martin Sköld INN/V Alzato
* Date: 2002-04-01
* Version: 0.1
* Description: Cursor support
* Documentation:
* Adjust: 2002-04-01 UABMASD First version.
****************************************************************************/
#include <NdbCursorOperation.hpp>
#include <NdbResultSet.hpp>
NdbCursorOperation::NdbCursorOperation(Ndb* aNdb) :
{
}
NdbCursorOperation::~NdbCursorOperation()
{
if (m_resultSet)
delete m_resultSet;
}
void NdbCursorOperation::cursInit()
{
// Initialize result set
}
NdbResultSet* NdbCursorOperation::getResultSet()
{
}
...@@ -35,6 +35,7 @@ public: ...@@ -35,6 +35,7 @@ public:
#include <NdbError.hpp> #include <NdbError.hpp>
#include <NdbCondition.h> #include <NdbCondition.h>
#include <NdbReceiver.hpp> #include <NdbReceiver.hpp>
#include <NdbTransaction.hpp>
#include <NdbOperation.hpp> #include <NdbOperation.hpp>
#include <NdbTick.h> #include <NdbTick.h>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <ndb_global.h> #include <ndb_global.h>
#include <NdbIndexOperation.hpp> #include <NdbIndexOperation.hpp>
#include <Ndb.hpp> #include <Ndb.hpp>
#include <NdbConnection.hpp> #include <NdbTransaction.hpp>
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
#include <AttributeHeader.hpp> #include <AttributeHeader.hpp>
#include <signaldata/TcIndx.hpp> #include <signaldata/TcIndx.hpp>
...@@ -53,7 +53,7 @@ NdbIndexOperation::~NdbIndexOperation() ...@@ -53,7 +53,7 @@ NdbIndexOperation::~NdbIndexOperation()
int int
NdbIndexOperation::indxInit(const NdbIndexImpl * anIndex, NdbIndexOperation::indxInit(const NdbIndexImpl * anIndex,
const NdbTableImpl * aTable, const NdbTableImpl * aTable,
NdbConnection* myConnection) NdbTransaction* myConnection)
{ {
NdbOperation::init(aTable, myConnection); NdbOperation::init(aTable, myConnection);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h> #include <ndb_global.h>
#include <NdbConnection.hpp> #include <NdbTransaction.hpp>
#include <NdbOperation.hpp> #include <NdbOperation.hpp>
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
#include "NdbRecAttr.hpp" #include "NdbRecAttr.hpp"
...@@ -128,7 +128,7 @@ NdbOperation::setErrorCodeAbort(int anErrorCode) ...@@ -128,7 +128,7 @@ NdbOperation::setErrorCodeAbort(int anErrorCode)
*****************************************************************************/ *****************************************************************************/
int int
NdbOperation::init(const NdbTableImpl* tab, NdbConnection* myConnection){ NdbOperation::init(const NdbTableImpl* tab, NdbTransaction* myConnection){
NdbApiSignal* tSignal; NdbApiSignal* tSignal;
theStatus = Init; theStatus = Init;
theError.code = 0; theError.code = 0;
......
...@@ -14,28 +14,17 @@ ...@@ -14,28 +14,17 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
/***************************************************************************** #include <NdbOperation.hpp>
* Name: NdbOperationDefine.C
* Include:
* Link:
* Author: UABMNST Mona Natterkvist UAB/B/SD
* Date: 970829
* Version: 0.1
* Description: Interface between TIS and NDB
* Documentation:
* Adjust: 971022 UABMNST First version.
*****************************************************************************/
#include "NdbOperation.hpp"
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
#include "NdbConnection.hpp" #include <NdbTransaction.hpp>
#include "Ndb.hpp" #include <Ndb.hpp>
#include "NdbRecAttr.hpp" #include <NdbRecAttr.hpp>
#include "NdbUtil.hpp" #include "NdbUtil.hpp"
#include "NdbOut.hpp" #include "NdbOut.hpp"
#include "NdbImpl.hpp" #include "NdbImpl.hpp"
#include <NdbIndexScanOperation.hpp> #include <NdbIndexScanOperation.hpp>
#include "NdbBlob.hpp" #include <NdbBlob.hpp>
#include <Interpreter.hpp> #include <Interpreter.hpp>
...@@ -48,7 +37,7 @@ ...@@ -48,7 +37,7 @@
int int
NdbOperation::insertTuple() NdbOperation::insertTuple()
{ {
NdbConnection* tNdbCon = theNdbCon; NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine; int tErrorLine = theErrorLine;
if (theStatus == Init) { if (theStatus == Init) {
theStatus = OperationDefined; theStatus = OperationDefined;
...@@ -68,7 +57,7 @@ NdbOperation::insertTuple() ...@@ -68,7 +57,7 @@ NdbOperation::insertTuple()
int int
NdbOperation::updateTuple() NdbOperation::updateTuple()
{ {
NdbConnection* tNdbCon = theNdbCon; NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine; int tErrorLine = theErrorLine;
if (theStatus == Init) { if (theStatus == Init) {
theStatus = OperationDefined; theStatus = OperationDefined;
...@@ -88,7 +77,7 @@ NdbOperation::updateTuple() ...@@ -88,7 +77,7 @@ NdbOperation::updateTuple()
int int
NdbOperation::writeTuple() NdbOperation::writeTuple()
{ {
NdbConnection* tNdbCon = theNdbCon; NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine; int tErrorLine = theErrorLine;
if (theStatus == Init) { if (theStatus == Init) {
theStatus = OperationDefined; theStatus = OperationDefined;
...@@ -128,7 +117,7 @@ NdbOperation::readTuple(NdbOperation::LockMode lm) ...@@ -128,7 +117,7 @@ NdbOperation::readTuple(NdbOperation::LockMode lm)
int int
NdbOperation::readTuple() NdbOperation::readTuple()
{ {
NdbConnection* tNdbCon = theNdbCon; NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine; int tErrorLine = theErrorLine;
if (theStatus == Init) { if (theStatus == Init) {
theStatus = OperationDefined; theStatus = OperationDefined;
...@@ -149,7 +138,7 @@ NdbOperation::readTuple() ...@@ -149,7 +138,7 @@ NdbOperation::readTuple()
int int
NdbOperation::deleteTuple() NdbOperation::deleteTuple()
{ {
NdbConnection* tNdbCon = theNdbCon; NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine; int tErrorLine = theErrorLine;
if (theStatus == Init) { if (theStatus == Init) {
theStatus = OperationDefined; theStatus = OperationDefined;
...@@ -170,7 +159,7 @@ NdbOperation::deleteTuple() ...@@ -170,7 +159,7 @@ NdbOperation::deleteTuple()
int int
NdbOperation::readTupleExclusive() NdbOperation::readTupleExclusive()
{ {
NdbConnection* tNdbCon = theNdbCon; NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine; int tErrorLine = theErrorLine;
if (theStatus == Init) { if (theStatus == Init) {
theStatus = OperationDefined; theStatus = OperationDefined;
...@@ -247,7 +236,7 @@ NdbOperation::committedRead() ...@@ -247,7 +236,7 @@ NdbOperation::committedRead()
int int
NdbOperation::dirtyUpdate() NdbOperation::dirtyUpdate()
{ {
NdbConnection* tNdbCon = theNdbCon; NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine; int tErrorLine = theErrorLine;
if (theStatus == Init) { if (theStatus == Init) {
theStatus = OperationDefined; theStatus = OperationDefined;
...@@ -270,7 +259,7 @@ NdbOperation::dirtyUpdate() ...@@ -270,7 +259,7 @@ NdbOperation::dirtyUpdate()
int int
NdbOperation::dirtyWrite() NdbOperation::dirtyWrite()
{ {
NdbConnection* tNdbCon = theNdbCon; NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine; int tErrorLine = theErrorLine;
if (theStatus == Init) { if (theStatus == Init) {
theStatus = OperationDefined; theStatus = OperationDefined;
...@@ -293,7 +282,7 @@ NdbOperation::dirtyWrite() ...@@ -293,7 +282,7 @@ NdbOperation::dirtyWrite()
int int
NdbOperation::interpretedUpdateTuple() NdbOperation::interpretedUpdateTuple()
{ {
NdbConnection* tNdbCon = theNdbCon; NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine; int tErrorLine = theErrorLine;
if (theStatus == Init) { if (theStatus == Init) {
theStatus = OperationDefined; theStatus = OperationDefined;
...@@ -316,7 +305,7 @@ NdbOperation::interpretedUpdateTuple() ...@@ -316,7 +305,7 @@ NdbOperation::interpretedUpdateTuple()
int int
NdbOperation::interpretedDeleteTuple() NdbOperation::interpretedDeleteTuple()
{ {
NdbConnection* tNdbCon = theNdbCon; NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine; int tErrorLine = theErrorLine;
if (theStatus == Init) { if (theStatus == Init) {
theStatus = OperationDefined; theStatus = OperationDefined;
...@@ -578,7 +567,7 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo, ...@@ -578,7 +567,7 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo,
}//NdbOperation::setValue() }//NdbOperation::setValue()
NdbBlob* NdbBlob*
NdbOperation::getBlobHandle(NdbConnection* aCon, const NdbColumnImpl* tAttrInfo) NdbOperation::getBlobHandle(NdbTransaction* aCon, const NdbColumnImpl* tAttrInfo)
{ {
NdbBlob* tBlob = theBlobList; NdbBlob* tBlob = theBlobList;
NdbBlob* tLastBlob = NULL; NdbBlob* tLastBlob = NULL;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <ndb_global.h> #include <ndb_global.h>
#include <NdbOperation.hpp> #include <NdbOperation.hpp>
#include <NdbConnection.hpp> #include <NdbTransaction.hpp>
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
#include <Ndb.hpp> #include <Ndb.hpp>
#include <NdbRecAttr.hpp> #include <NdbRecAttr.hpp>
...@@ -544,7 +544,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal) ...@@ -544,7 +544,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal)
// blobs want this // blobs want this
if (m_abortOption != AO_IgnoreError) if (m_abortOption != AO_IgnoreError)
{ {
theNdbCon->theReturnStatus = NdbConnection::ReturnFailure; theNdbCon->theReturnStatus = NdbTransaction::ReturnFailure;
} }
theError.code = aSignal->readData(4); theError.code = aSignal->readData(4);
theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4), ao); theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4), ao);
......
...@@ -14,23 +14,11 @@ ...@@ -14,23 +14,11 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbOperation.hpp>
/************************************************************************************************
Name: NdbOperationInt.C
Include:
Link:
Author: UABRONM Mikael Ronstrm UAB/M/MT
Date: 991029
Version: 0.1
Description: Interpreted operations in NDB API
Documentation:
Adjust: 991029 UABRONM First version.
************************************************************************************************/
#include "NdbOperation.hpp"
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
#include "NdbConnection.hpp" #include <NdbTransaction.hpp>
#include "Ndb.hpp" #include <Ndb.hpp>
#include "NdbRecAttr.hpp" #include <NdbRecAttr.hpp>
#include "NdbUtil.hpp" #include "NdbUtil.hpp"
#include "Interpreter.hpp" #include "Interpreter.hpp"
#include <NdbIndexScanOperation.hpp> #include <NdbIndexScanOperation.hpp>
...@@ -94,7 +82,7 @@ NdbOperation::incCheck(const NdbColumnImpl* tNdbColumnImpl) ...@@ -94,7 +82,7 @@ NdbOperation::incCheck(const NdbColumnImpl* tNdbColumnImpl)
} }
return tNdbColumnImpl->m_attrId; return tNdbColumnImpl->m_attrId;
} else { } else {
if (theNdbCon->theCommitStatus == NdbConnection::Started) if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200); setErrorCodeAbort(4200);
} }
return -1; return -1;
...@@ -146,7 +134,7 @@ NdbOperation::write_attrCheck(const NdbColumnImpl* tNdbColumnImpl) ...@@ -146,7 +134,7 @@ NdbOperation::write_attrCheck(const NdbColumnImpl* tNdbColumnImpl)
} }
return tNdbColumnImpl->m_attrId; return tNdbColumnImpl->m_attrId;
} else { } else {
if (theNdbCon->theCommitStatus == NdbConnection::Started) if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200); setErrorCodeAbort(4200);
} }
return -1; return -1;
...@@ -194,7 +182,7 @@ NdbOperation::read_attrCheck(const NdbColumnImpl* tNdbColumnImpl) ...@@ -194,7 +182,7 @@ NdbOperation::read_attrCheck(const NdbColumnImpl* tNdbColumnImpl)
} }
return tNdbColumnImpl->m_attrId; return tNdbColumnImpl->m_attrId;
} else { } else {
if (theNdbCon->theCommitStatus == NdbConnection::Started) if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200); setErrorCodeAbort(4200);
} }
return -1; return -1;
...@@ -230,7 +218,7 @@ NdbOperation::initial_interpreterCheck() ...@@ -230,7 +218,7 @@ NdbOperation::initial_interpreterCheck()
} }
return 0; return 0;
} else { } else {
if (theNdbCon->theCommitStatus == NdbConnection::Started) if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200); setErrorCodeAbort(4200);
} }
return -1; return -1;
...@@ -256,7 +244,7 @@ NdbOperation::labelCheck() ...@@ -256,7 +244,7 @@ NdbOperation::labelCheck()
} }
return 0; return 0;
} else { } else {
if (theNdbCon->theCommitStatus == NdbConnection::Started) if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200); setErrorCodeAbort(4200);
} }
return -1; return -1;
...@@ -276,7 +264,7 @@ NdbOperation::intermediate_interpreterCheck() ...@@ -276,7 +264,7 @@ NdbOperation::intermediate_interpreterCheck()
} }
return 0; return 0;
} else { } else {
if (theNdbCon->theCommitStatus == NdbConnection::Started) if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200); setErrorCodeAbort(4200);
} }
return -1; return -1;
......
...@@ -31,7 +31,7 @@ Adjust: 971022 UABMNST First version. ...@@ -31,7 +31,7 @@ Adjust: 971022 UABMNST First version.
#include <NdbOperation.hpp> #include <NdbOperation.hpp>
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
#include <NdbConnection.hpp> #include <NdbTransaction.hpp>
#include <Ndb.hpp> #include <Ndb.hpp>
#include "NdbImpl.hpp" #include "NdbImpl.hpp"
#include <NdbOut.hpp> #include <NdbOut.hpp>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "NdbDictionaryImpl.hpp" #include "NdbDictionaryImpl.hpp"
#include <NdbRecAttr.hpp> #include <NdbRecAttr.hpp>
#include <AttributeHeader.hpp> #include <AttributeHeader.hpp>
#include <NdbConnection.hpp> #include <NdbTransaction.hpp>
#include <TransporterFacade.hpp> #include <TransporterFacade.hpp>
#include <signaldata/TcKeyConf.hpp> #include <signaldata/TcKeyConf.hpp>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <Ndb.hpp> #include <Ndb.hpp>
#include <NdbScanOperation.hpp> #include <NdbScanOperation.hpp>
#include <NdbIndexScanOperation.hpp> #include <NdbIndexScanOperation.hpp>
#include <NdbConnection.hpp> #include <NdbTransaction.hpp>
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
#include <NdbOut.hpp> #include <NdbOut.hpp>
#include "NdbDictionaryImpl.hpp" #include "NdbDictionaryImpl.hpp"
...@@ -63,7 +63,7 @@ NdbScanOperation::~NdbScanOperation() ...@@ -63,7 +63,7 @@ NdbScanOperation::~NdbScanOperation()
void void
NdbScanOperation::setErrorCode(int aErrorCode){ NdbScanOperation::setErrorCode(int aErrorCode){
NdbConnection* tmp = theNdbCon; NdbTransaction* tmp = theNdbCon;
theNdbCon = m_transConnection; theNdbCon = m_transConnection;
NdbOperation::setErrorCode(aErrorCode); NdbOperation::setErrorCode(aErrorCode);
theNdbCon = tmp; theNdbCon = tmp;
...@@ -71,7 +71,7 @@ NdbScanOperation::setErrorCode(int aErrorCode){ ...@@ -71,7 +71,7 @@ NdbScanOperation::setErrorCode(int aErrorCode){
void void
NdbScanOperation::setErrorCodeAbort(int aErrorCode){ NdbScanOperation::setErrorCodeAbort(int aErrorCode){
NdbConnection* tmp = theNdbCon; NdbTransaction* tmp = theNdbCon;
theNdbCon = m_transConnection; theNdbCon = m_transConnection;
NdbOperation::setErrorCodeAbort(aErrorCode); NdbOperation::setErrorCodeAbort(aErrorCode);
theNdbCon = tmp; theNdbCon = tmp;
...@@ -86,11 +86,11 @@ NdbScanOperation::setErrorCodeAbort(int aErrorCode){ ...@@ -86,11 +86,11 @@ NdbScanOperation::setErrorCodeAbort(int aErrorCode){
* Remark: Initiates operation record after allocation. * Remark: Initiates operation record after allocation.
*****************************************************************************/ *****************************************************************************/
int int
NdbScanOperation::init(const NdbTableImpl* tab, NdbConnection* myConnection) NdbScanOperation::init(const NdbTableImpl* tab, NdbTransaction* myConnection)
{ {
m_transConnection = myConnection; m_transConnection = myConnection;
//NdbConnection* aScanConnection = theNdb->startTransaction(myConnection); //NdbTransaction* aScanConnection = theNdb->startTransaction(myConnection);
NdbConnection* aScanConnection = theNdb->hupp(myConnection); NdbTransaction* aScanConnection = theNdb->hupp(myConnection);
if (!aScanConnection){ if (!aScanConnection){
setErrorCodeAbort(theNdb->getNdbError().code); setErrorCodeAbort(theNdb->getNdbError().code);
return -1; return -1;
...@@ -349,7 +349,7 @@ NdbScanOperation::getFirstATTRINFOScan() ...@@ -349,7 +349,7 @@ NdbScanOperation::getFirstATTRINFOScan()
int int
NdbScanOperation::executeCursor(int nodeId){ NdbScanOperation::executeCursor(int nodeId){
NdbConnection * tCon = theNdbCon; NdbTransaction * tCon = theNdbCon;
TransporterFacade* tp = TransporterFacade::instance(); TransporterFacade* tp = TransporterFacade::instance();
Guard guard(tp->theMutexPtr); Guard guard(tp->theMutexPtr);
...@@ -383,7 +383,7 @@ NdbScanOperation::executeCursor(int nodeId){ ...@@ -383,7 +383,7 @@ NdbScanOperation::executeCursor(int nodeId){
TRACE_DEBUG("The node is stopping when attempting to start a scan"); TRACE_DEBUG("The node is stopping when attempting to start a scan");
setErrorCode(4030); setErrorCode(4030);
}//if }//if
tCon->theCommitStatus = NdbConnection::Aborted; tCon->theCommitStatus = NdbTransaction::Aborted;
}//if }//if
return -1; return -1;
} }
...@@ -856,9 +856,9 @@ NdbScanOperation::doSendScan(int aProcessorId) ...@@ -856,9 +856,9 @@ NdbScanOperation::doSendScan(int aProcessorId)
}//NdbOperation::doSendScan() }//NdbOperation::doSendScan()
/***************************************************************************** /*****************************************************************************
* NdbOperation* takeOverScanOp(NdbConnection* updateTrans); * NdbOperation* takeOverScanOp(NdbTransaction* updateTrans);
* *
* Parameters: The update transactions NdbConnection pointer. * Parameters: The update transactions NdbTransaction pointer.
* Return Value: A reference to the transferred operation object * Return Value: A reference to the transferred operation object
* or NULL if no success. * or NULL if no success.
* Remark: Take over the scanning transactions NdbOperation * Remark: Take over the scanning transactions NdbOperation
...@@ -868,8 +868,8 @@ NdbScanOperation::doSendScan(int aProcessorId) ...@@ -868,8 +868,8 @@ NdbScanOperation::doSendScan(int aProcessorId)
* *
* FUTURE IMPLEMENTATION: (This note was moved from header file.) * FUTURE IMPLEMENTATION: (This note was moved from header file.)
* In the future, it will even be possible to transfer * In the future, it will even be possible to transfer
* to a NdbConnection on another Ndb-object. * to a NdbTransaction on another Ndb-object.
* In this case the receiving NdbConnection-object must call * In this case the receiving NdbTransaction-object must call
* a method receiveOpFromScan to actually receive the information. * a method receiveOpFromScan to actually receive the information.
* This means that the updating transactions can be placed * This means that the updating transactions can be placed
* in separate threads and thus increasing the parallelism during * in separate threads and thus increasing the parallelism during
...@@ -896,7 +896,7 @@ NdbScanOperation::getKeyFromKEYINFO20(Uint32* data, unsigned size) ...@@ -896,7 +896,7 @@ NdbScanOperation::getKeyFromKEYINFO20(Uint32* data, unsigned size)
} }
NdbOperation* NdbOperation*
NdbScanOperation::takeOverScanOp(OperationType opType, NdbConnection* pTrans){ NdbScanOperation::takeOverScanOp(OperationType opType, NdbTransaction* pTrans){
Uint32 idx = m_current_api_receiver; Uint32 idx = m_current_api_receiver;
Uint32 last = m_api_receivers_count; Uint32 last = m_api_receivers_count;
......
...@@ -15,22 +15,10 @@ ...@@ -15,22 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
* Name: NdbConnectionScan.cpp
* Include:
* Link:
* Author: UABRONM MikaelRonström UAB/M/MT
* QABJKAM Jonas Kamf UAB/M/MT
* Date: 2000-06-12
* Version: 0.1
* Description: Interface between Application and NDB
* Documentation:
* Adjust: 2000-06-12 UABRONM First version.
****************************************************************************/
#include <ndb_global.h> #include <ndb_global.h>
#include <Ndb.hpp> #include <Ndb.hpp>
#include <NdbConnection.hpp> #include <NdbTransaction.hpp>
#include <NdbOperation.hpp> #include <NdbOperation.hpp>
#include <NdbScanOperation.hpp> #include <NdbScanOperation.hpp>
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
...@@ -52,7 +40,7 @@ ...@@ -52,7 +40,7 @@
* *
****************************************************************************/ ****************************************************************************/
int int
NdbConnection::receiveSCAN_TABREF(NdbApiSignal* aSignal){ NdbTransaction::receiveSCAN_TABREF(NdbApiSignal* aSignal){
const ScanTabRef * ref = CAST_CONSTPTR(ScanTabRef, aSignal->getDataPtr()); const ScanTabRef * ref = CAST_CONSTPTR(ScanTabRef, aSignal->getDataPtr());
if(checkState_TransId(&ref->transId1)){ if(checkState_TransId(&ref->transId1)){
...@@ -93,7 +81,7 @@ NdbConnection::receiveSCAN_TABREF(NdbApiSignal* aSignal){ ...@@ -93,7 +81,7 @@ NdbConnection::receiveSCAN_TABREF(NdbApiSignal* aSignal){
* *
*****************************************************************************/ *****************************************************************************/
int int
NdbConnection::receiveSCAN_TABCONF(NdbApiSignal* aSignal, NdbTransaction::receiveSCAN_TABCONF(NdbApiSignal* aSignal,
const Uint32 * ops, Uint32 len) const Uint32 * ops, Uint32 len)
{ {
const ScanTabConf * conf = CAST_CONSTPTR(ScanTabConf, aSignal->getDataPtr()); const ScanTabConf * conf = CAST_CONSTPTR(ScanTabConf, aSignal->getDataPtr());
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "NdbImpl.hpp" #include "NdbImpl.hpp"
#include "NdbDictionaryImpl.hpp" #include "NdbDictionaryImpl.hpp"
#include <NdbOperation.hpp> #include <NdbOperation.hpp>
#include <NdbConnection.hpp> #include <NdbTransaction.hpp>
#include <NdbBlob.hpp> #include <NdbBlob.hpp>
...@@ -55,7 +55,7 @@ NdbDictionaryImpl::getNdbError() const { ...@@ -55,7 +55,7 @@ NdbDictionaryImpl::getNdbError() const {
const const
NdbError & NdbError &
NdbConnection::getNdbError() const { NdbTransaction::getNdbError() const {
update(theError); update(theError);
return theError; return theError;
} }
......
This diff is collapsed.
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
#include "NdbImpl.hpp" #include "NdbImpl.hpp"
#include "NdbOperation.hpp" #include <NdbOperation.hpp>
#include "NdbConnection.hpp" #include <NdbTransaction.hpp>
#include "NdbRecAttr.hpp" #include <NdbRecAttr.hpp>
#include "IPCConfig.hpp" #include <IPCConfig.hpp>
#include "TransporterFacade.hpp" #include "TransporterFacade.hpp"
#include "ConfigRetriever.hpp" #include <ConfigRetriever.hpp>
#include <ndb_limits.h> #include <ndb_limits.h>
#include <NdbOut.hpp> #include <NdbOut.hpp>
#include <NdbSleep.h> #include <NdbSleep.h>
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <NdbOperation.hpp> #include <NdbOperation.hpp>
#include <NdbIndexOperation.hpp> #include <NdbIndexOperation.hpp>
#include <NdbIndexScanOperation.hpp> #include <NdbIndexScanOperation.hpp>
#include <NdbConnection.hpp>
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
#include <NdbRecAttr.hpp> #include <NdbRecAttr.hpp>
#include "NdbUtil.hpp" #include "NdbUtil.hpp"
...@@ -43,10 +42,10 @@ Ndb::checkFailedNode() ...@@ -43,10 +42,10 @@ Ndb::checkFailedNode()
/** /**
* Release all connections in idle list (for node) * Release all connections in idle list (for node)
*/ */
NdbConnection * tNdbCon = theConnectionArray[node_id]; NdbTransaction * tNdbCon = theConnectionArray[node_id];
theConnectionArray[node_id] = NULL; theConnectionArray[node_id] = NULL;
while (tNdbCon != NULL) { while (tNdbCon != NULL) {
NdbConnection* tempNdbCon = tNdbCon; NdbTransaction* tempNdbCon = tNdbCon;
tNdbCon = tNdbCon->next(); tNdbCon = tNdbCon->next();
releaseNdbCon(tempNdbCon); releaseNdbCon(tempNdbCon);
} }
...@@ -88,14 +87,14 @@ NdbImpl::checkErrorCode(Uint32 i, NdbTableImpl * tab){ ...@@ -88,14 +87,14 @@ NdbImpl::checkErrorCode(Uint32 i, NdbTableImpl * tab){
* if createConIdleList was succesful * if createConIdleList was succesful
* Return -1: In all other case. * Return -1: In all other case.
* Parameters: aNrOfCon : Number of connections offered to the application. * Parameters: aNrOfCon : Number of connections offered to the application.
* Remark: Create connection idlelist with NdbConnection objects. * Remark: Create connection idlelist with NdbTransaction objects.
***************************************************************************/ ***************************************************************************/
int int
Ndb::createConIdleList(int aNrOfCon) Ndb::createConIdleList(int aNrOfCon)
{ {
for (int i = 0; i < aNrOfCon; i++) for (int i = 0; i < aNrOfCon; i++)
{ {
NdbConnection* tNdbCon = new NdbConnection(this); NdbTransaction* tNdbCon = new NdbTransaction(this);
if (tNdbCon == NULL) if (tNdbCon == NULL)
{ {
return -1; return -1;
...@@ -109,7 +108,7 @@ Ndb::createConIdleList(int aNrOfCon) ...@@ -109,7 +108,7 @@ Ndb::createConIdleList(int aNrOfCon)
tNdbCon->next(theConIdleList); tNdbCon->next(theConIdleList);
theConIdleList = tNdbCon; theConIdleList = tNdbCon;
} }
tNdbCon->Status(NdbConnection::NotConnected); tNdbCon->Status(NdbTransaction::NotConnected);
} }
theNoOfAllocatedTransactions = aNrOfCon; theNoOfAllocatedTransactions = aNrOfCon;
return aNrOfCon; return aNrOfCon;
...@@ -200,19 +199,19 @@ Ndb::getNdbCall() ...@@ -200,19 +199,19 @@ Ndb::getNdbCall()
} }
/*************************************************************************** /***************************************************************************
* NdbConnection* getNdbCon(); * NdbTransaction* getNdbCon();
* *
* Return Value: Return a connection if the getNdbCon was successful. * Return Value: Return a connection if the getNdbCon was successful.
* Return NULL : In all other case. * Return NULL : In all other case.
* Remark: Get a connection from theConIdleList and return the object . * Remark: Get a connection from theConIdleList and return the object .
***************************************************************************/ ***************************************************************************/
NdbConnection* NdbTransaction*
Ndb::getNdbCon() Ndb::getNdbCon()
{ {
NdbConnection* tNdbCon; NdbTransaction* tNdbCon;
if ( theConIdleList == NULL ) { if ( theConIdleList == NULL ) {
if (theNoOfAllocatedTransactions < theMaxNoOfTransactions) { if (theNoOfAllocatedTransactions < theMaxNoOfTransactions) {
tNdbCon = new NdbConnection(this); tNdbCon = new NdbTransaction(this);
if (tNdbCon == NULL) { if (tNdbCon == NULL) {
return NULL; return NULL;
}//if }//if
...@@ -484,13 +483,13 @@ Ndb::releaseNdbCall(NdbCall* aNdbCall) ...@@ -484,13 +483,13 @@ Ndb::releaseNdbCall(NdbCall* aNdbCall)
} }
/*************************************************************************** /***************************************************************************
void releaseNdbCon(NdbConnection* aNdbCon); void releaseNdbCon(NdbTransaction* aNdbCon);
Parameters: aNdbCon: The NdbConnection object. Parameters: aNdbCon: The NdbTransaction object.
Remark: Add a Connection object into the signal idlelist. Remark: Add a Connection object into the signal idlelist.
***************************************************************************/ ***************************************************************************/
void void
Ndb::releaseNdbCon(NdbConnection* aNdbCon) Ndb::releaseNdbCon(NdbTransaction* aNdbCon)
{ {
aNdbCon->next(theConIdleList); aNdbCon->next(theConIdleList);
aNdbCon->theMagicNumber = 0xFE11DD; aNdbCon->theMagicNumber = 0xFE11DD;
...@@ -720,7 +719,7 @@ Remark: Always release the first item in the free list ...@@ -720,7 +719,7 @@ Remark: Always release the first item in the free list
void void
Ndb::freeNdbCon() Ndb::freeNdbCon()
{ {
NdbConnection* tNdbCon = theConIdleList; NdbTransaction* tNdbCon = theConIdleList;
theConIdleList = theConIdleList->next(); theConIdleList = theConIdleList->next();
delete tNdbCon; delete tNdbCon;
} }
...@@ -789,14 +788,14 @@ Ndb::freeNdbBlob() ...@@ -789,14 +788,14 @@ Ndb::freeNdbBlob()
} }
/**************************************************************************** /****************************************************************************
int releaseConnectToNdb(NdbConnection* aConnectConnection); int releaseConnectToNdb(NdbTransaction* aConnectConnection);
Return Value: -1 if error Return Value: -1 if error
Parameters: aConnectConnection : Seized schema connection to DBTC Parameters: aConnectConnection : Seized schema connection to DBTC
Remark: Release and disconnect from DBTC a connection and seize it to theConIdleList. Remark: Release and disconnect from DBTC a connection and seize it to theConIdleList.
*****************************************************************************/ *****************************************************************************/
void void
Ndb::releaseConnectToNdb(NdbConnection* a_con) Ndb::releaseConnectToNdb(NdbTransaction* a_con)
{ {
DBUG_ENTER("Ndb::releaseConnectToNdb"); DBUG_ENTER("Ndb::releaseConnectToNdb");
NdbApiSignal tSignal(theMyRef); NdbApiSignal tSignal(theMyRef);
...@@ -814,7 +813,7 @@ Ndb::releaseConnectToNdb(NdbConnection* a_con) ...@@ -814,7 +813,7 @@ Ndb::releaseConnectToNdb(NdbConnection* a_con)
tSignal.setData((tConPtr = a_con->getTC_ConnectPtr()), 1); tSignal.setData((tConPtr = a_con->getTC_ConnectPtr()), 1);
tSignal.setData(theMyRef, 2); tSignal.setData(theMyRef, 2);
tSignal.setData(a_con->ptr2int(), 3); tSignal.setData(a_con->ptr2int(), 3);
a_con->Status(NdbConnection::DisConnecting); a_con->Status(NdbTransaction::DisConnecting);
a_con->theMagicNumber = 0x37412619; a_con->theMagicNumber = 0x37412619;
int ret_code = sendRecSignal(node_id, int ret_code = sendRecSignal(node_id,
WAIT_TC_RELEASE, WAIT_TC_RELEASE,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment