Commit 86fda80f authored by mskold@mysql.com's avatar mskold@mysql.com

Merge

parents 7d5e065d f14ab8b5
......@@ -95,6 +95,7 @@ jcole@tetra.spaceapes.com
jimw@mysql.com
joerg@mysql.com
jon@gigan.
joreland@bk-internal.mysql.com
joreland@mysql.com
jorge@linux.jorge.mysql.com
jplindst@t41.(none)
......
......@@ -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 */
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),
MYF(MY_WME | MY_FAE));
is_null= (my_bool*) my_malloc(num_fields * sizeof(my_bool),
......
......@@ -53,6 +53,7 @@ int resize_queue(QUEUE *queue, uint max_elements);
void delete_queue(QUEUE *queue);
void queue_insert(QUEUE *queue,byte *element);
byte *queue_remove(QUEUE *queue,uint idx);
#define queue_remove_all(queue) { (queue)->elements= 0; }
void _downheap(QUEUE *queue,uint idx);
void queue_fix(QUEUE *queue);
#define is_queue_inited(queue) ((queue)->root != 0)
......
......@@ -612,6 +612,8 @@ extern lock_sys_t* lock_sys;
#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_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
type_mode field in a lock */
/* Waiting lock flag */
......
......@@ -464,6 +464,10 @@ struct trx_struct{
ulint n_lock_table_exp;/* number of explicit table locks
(LOCK TABLES) reserved by the
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)
trx_list; /* list of transactions */
UT_LIST_NODE_T(trx_t)
......
......@@ -2207,7 +2207,8 @@ lock_grant(
release it at the end of the SQL statement */
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
|| lock_get_mode(lock) == LOCK_X);
}
......@@ -3421,6 +3422,10 @@ lock_table_create(
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;
UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock);
......@@ -3458,7 +3463,11 @@ lock_table_remove_low(
}
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);
......@@ -3592,7 +3601,8 @@ lock_table(
DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set,
does nothing;
if LOCK_TABLE_EXP bits are set,
if LOCK_TABLE_EXP|LOCK_TABLE_TRANSACTIONAL
bits are set,
creates an explicit table lock */
dict_table_t* table, /* in: database table in dictionary cache */
ulint mode, /* in: lock mode */
......@@ -3608,7 +3618,8 @@ lock_table(
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);
......@@ -3631,7 +3642,7 @@ lock_table(
/* Another trx has a request on the table in an incompatible
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();
......@@ -3722,7 +3733,8 @@ lock_table_dequeue(
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
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);
......@@ -3826,7 +3838,9 @@ lock_release_off_kernel(
}
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
|| lock_get_mode(lock) == LOCK_X);
}
......@@ -3850,6 +3864,7 @@ lock_release_off_kernel(
ut_a(trx->auto_inc_lock == NULL);
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(
}
ut_a(trx->n_lock_table_exp == 0);
ut_a(trx->n_lock_table_transactional == 0);
}
/*************************************************************************
......@@ -4028,11 +4044,15 @@ lock_table_print(
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
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) {
fputs("EXPLICIT ", file);
} else if (lock_get_type(lock) == LOCK_TABLE_TRANSACTIONAL) {
fputs("TRANSACTIONAL ", file);
}
fputs("TABLE LOCK table ", file);
ut_print_name(file, lock->trx, lock->un_member.tab_lock.table->name);
fprintf(file, " trx id %lu %lu",
......@@ -4418,6 +4438,7 @@ lock_table_queue_validate(
while (lock) {
ut_a(((lock->trx)->conc_state == TRX_ACTIVE)
|| ((lock->trx)->conc_state == TRX_PREPARED)
|| ((lock->trx)->conc_state == TRX_COMMITTED_IN_MEMORY));
if (!lock_get_wait(lock)) {
......@@ -4465,6 +4486,7 @@ lock_rec_queue_validate(
while (lock) {
ut_a(lock->trx->conc_state == TRX_ACTIVE
|| lock->trx->conc_state == TRX_PREPARED
|| lock->trx->conc_state
== TRX_COMMITTED_IN_MEMORY);
......@@ -4519,6 +4541,7 @@ lock_rec_queue_validate(
while (lock) {
ut_a(lock->trx->conc_state == TRX_ACTIVE
|| lock->trx->conc_state == TRX_PREPARED
|| lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
ut_a(trx_in_trx_list(lock->trx));
......@@ -4601,6 +4624,7 @@ lock_rec_validate_page(
ut_a(trx_in_trx_list(lock->trx));
ut_a(lock->trx->conc_state == TRX_ACTIVE
|| lock->trx->conc_state == TRX_PREPARED
|| lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) {
......
......@@ -784,7 +784,7 @@ row_lock_table_for_mysql(
table handle */
dict_table_t* table, /* in: table to lock, or NULL
if prebuilt->table should be
locked as LOCK_TABLE_EXP |
locked or a
prebuilt->select_lock_type */
ulint mode) /* in: lock mode of table */
{
......@@ -821,10 +821,16 @@ row_lock_table_for_mysql(
if (table) {
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 {
err = lock_table(LOCK_TABLE_EXP, prebuilt->table,
prebuilt->select_lock_type, thr);
}
}
trx->error_state = err;
......
......@@ -153,6 +153,7 @@ trx_create(
trx->auto_inc_lock = NULL;
trx->n_lock_table_exp = 0;
trx->n_lock_table_transactional = 0;
trx->read_view_heap = mem_heap_create(256);
trx->read_view = NULL;
......@@ -285,6 +286,7 @@ trx_free(
ut_a(!trx->has_search_latch);
ut_a(!trx->auto_inc_lock);
ut_a(!trx->n_lock_table_exp);
ut_a(!trx->n_lock_table_transactional);
ut_a(trx->dict_operation_lock_mode == 0);
......@@ -1645,12 +1647,17 @@ trx_print(
putc('\n', f);
if (trx->n_mysql_tables_in_use > 0 || trx->mysql_n_tables_locked > 0) {
fprintf(f, "mysql tables in use %lu, locked %lu\n",
(ulong) trx->n_mysql_tables_in_use,
(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;
switch (trx->que_state) {
......
......@@ -330,3 +330,8 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA
min max avg
10.00 10.00 10
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
(
key1 int not null,
......@@ -335,4 +335,55 @@ key1 key2 key3 key4 key5 key6 key7 key8
select count(*) from t0;
count(*)
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;
......@@ -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 t2 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;
......@@ -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);
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;
#
# 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
#
--disable_warnings
drop table if exists t0, t1, t2, t3,t4;
drop table if exists t0, t1, t2, t3, t4;
--enable_warnings
# Create and fill a table with simple keys
......@@ -278,4 +277,48 @@ delete from t0 where key1 < 3 or key2 < 4;
select * from t0 where key1 < 3 or key2 < 4;
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;
......@@ -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;
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;
DOXYDIR = doxygen
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
DOXYOUT = .doxyout
......@@ -12,7 +13,7 @@ clean:
rm -rf ndbapi.pdf ndbapi.html mgmapi.pdf mgmapi.html
rm -rf $(DOXYTMP) $(DOXYOUT)
do-check:
do-check-html:
@set -x; \
if test @PERL@ = no ; then \
echo "Perl needed to make docs"; \
......@@ -21,7 +22,9 @@ do-check:
if test @DOXYGEN@ = no ; then \
echo "Doxygen needed to make docs"; \
exit 1; \
fi; \
fi;
do-check-pdf: do-check-html
if test @PDFLATEX@ = no ; then \
echo "Pdflatex needed to make docs"; \
exit 1; \
......@@ -30,13 +33,15 @@ do-check:
echo "Makeindex needed to make docs"; \
exit 1; \
fi;
###
#
# 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; \
export NDB_RELEASE=$(NDB_RELEASE) \
@RM@ -f ndbapi.pdf ndbapi.html; \
......@@ -47,9 +52,11 @@ ndbapi.pdf: $(noinst_HEADERS)
@PERL@ $(DOXYDIR)/predoxy.pl; \
mv footer.html $(DOXYTMP); \
(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) && \
find ndbapi.html -print | cpio -pdm ..); \
find ndbapi.html -print | cpio -pdm ..);
ndbapi.pdf: ndbapi.html
(cd $(DOXYOUT)/ndbapi.latex && \
@PDFLATEX@ refman.tex && @MAKEINDEX@ refman && @PDFLATEX@ refman.tex && \
cp -p refman.pdf ../../ndbapi.pdf);
......@@ -58,9 +65,10 @@ ndbapi.pdf: $(noinst_HEADERS)
#
# MGM API Guide
#
mgmapidoc: mgmapi.pdf
mgmapidoc-html: mgmapi.html
mgmapidoc-pdf: mgmapi.pdf
mgmapi.pdf: $(noinst_HEADERS)
mgmapi.html: $(noinst_HEADERS)
@set -x; \
export NDB_RELEASE=$(NDB_RELEASE) \
@RM@ -f mgmapi.pdf mgmapi.html; \
......@@ -70,9 +78,11 @@ mgmapi.pdf: $(noinst_HEADERS)
@PERL@ $(DOXYDIR)/predoxy.pl; \
mv footer.html $(DOXYTMP); \
(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) && \
find mgmapi.html -print | cpio -pdm ..); \
find mgmapi.html -print | cpio -pdm ..);
mgmapi.pdf: mgmapi.html
(cd $(DOXYOUT)/mgmapi.latex && \
@PDFLATEX@ refman.tex && @MAKEINDEX@ refman && @PDFLATEX@ refman.tex && \
cp -p refman.pdf ../../mgmapi.pdf);
......
......@@ -105,7 +105,7 @@ ALWAYS_DETAILED_SEC = NO
# ordinary class members. Constructors, destructors and assignment operators of
# 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
# path before files name in the file list and in the header files. If set
......@@ -163,7 +163,7 @@ VERBATIM_HEADERS = NO
# will put list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
SHOW_INCLUDE_FILES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
......@@ -256,7 +256,7 @@ OPTIMIZE_OUTPUT_FOR_C = NO
# 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.
SHOW_USED_FILES = YES
SHOW_USED_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
......@@ -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
# 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
# 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
# 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
# will generate a graph for each documented class showing the direct and
# indirect inheritance relations. Setting this tag to YES will force the
# 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
# will generate a graph for each documented class showing the direct and
......@@ -820,7 +820,7 @@ COLLABORATION_GRAPH = YES
# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
TEMPLATE_RELATIONS = YES
TEMPLATE_RELATIONS = NO
# If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented
......
......@@ -18,7 +18,7 @@ print OUTFILE<<EOT;
<center>
EOT
print OUTFILE "Documentation generated " . localtime() .
" from NDB Cluster source files.";
" from mysql source files.";
print OUTFILE<<EOT;
<br>
&copy; 2003-2004
......
......@@ -9,8 +9,7 @@ ndbapiinclude_HEADERS = \
ndbapi/ndbapi_limits.h \
ndbapi/Ndb.hpp \
ndbapi/NdbApi.hpp \
ndbapi/NdbConnection.hpp \
ndbapi/NdbCursorOperation.hpp \
ndbapi/NdbTransaction.hpp \
ndbapi/NdbDictionary.hpp \
ndbapi/NdbError.hpp \
ndbapi/NdbEventOperation.hpp \
......
......@@ -33,7 +33,7 @@ class ScanTabReq {
/**
* Sender(s)
*/
friend class NdbConnection;
friend class NdbTransaction;
friend class NdbScanOperation;
friend class NdbIndexScanOperation;
......@@ -277,7 +277,7 @@ class ScanTabConf {
/**
* Reciver(s)
*/
friend class NdbConnection; // Reciver
friend class NdbTransaction; // Reciver
/**
* Sender(s)
......@@ -345,7 +345,7 @@ class ScanTabRef {
/**
* Reciver(s)
*/
friend class NdbConnection; // Reciver
friend class NdbTransaction; // Reciver
/**
* Sender(s)
......
......@@ -33,7 +33,7 @@ class TcCommitConf {
* Reciver(s)
*/
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
public:
STATIC_CONST( SignalLength = 3 );
......@@ -60,7 +60,7 @@ class TcCommitRef {
/**
* Reciver(s)
*/
friend class NdbConnection;
friend class NdbTransaction;
public:
STATIC_CONST( SignalLength = 4 );
......
......@@ -36,7 +36,7 @@ class TcHbRep {
/**
* Sender(s)
*/
friend class NdbConnection;
friend class NdbTransaction;
/**
* For printing
......
......@@ -26,7 +26,7 @@ class TcIndxConf {
* Reciver(s)
*/
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
/**
* Sender(s)
......
......@@ -27,7 +27,7 @@ class TcKeyConf {
* Reciver(s)
*/
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
friend class Ndbcntr;
friend class DbUtil;
......
......@@ -33,7 +33,7 @@ class TcKeyFailConf {
* Reciver(s)
*/
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
public:
STATIC_CONST( SignalLength = 3 );
......
......@@ -23,7 +23,7 @@ class TcRollbackRep {
/**
* Sender(s)
*/
friend class NdbConnection;
friend class NdbTransaction;
friend class DbUtil;
/**
......
......@@ -28,7 +28,7 @@ class TransIdAI {
/**
* Receiver(s)
*/
friend class NdbConnection;
friend class NdbTransaction;
friend class Dbtc;
friend class Dbutil;
friend class Dblqh;
......
......@@ -22,27 +22,26 @@
*
* The NDB Cluster Management API (MGM API) is a C API
* that is used to:
* - Start/stop database nodes (DB nodes)
* - Start/stop NDB Cluster backups
* - Start and stop database nodes (DB nodes)
* - Start and stop NDB Cluster backups
* - Control the NDB Cluster log
* - Other administrative tasks
* - Perform other administrative tasks
*
* @section General Concepts
*
* Each MGM API function needs a management server handle
* (of type Mgm_C_Api::NdbMgmHandle).
* This handle is initally is created by calling the
* function ndb_mgm_create_handle().
* of type <code>Mgm_C_Api::NdbMgmHandle</code>.
* This handle is initally created by calling the
* function <code>ndb_mgm_create_handle()</code>.
*
* A function can return:
* -# An integer value.
* If it returns -1 then this indicates an error, and then
* -# A pointer value. If it returns NULL then check the latest error.
* If it didn't return NULL, then a "something" is returned.
* This "something" has to be free:ed by the user of the MGM API.
* A value of <b>-1</b> indicates an error.
* -# A pointer value. A <var>NULL</var> value indicates an error;
* otherwise, the return value must be freed by the user of the MGM API.
*
* If there are an error, then the get latest error functions
* can be used to check what the error was.
* Error conditions can be identified by using the appropriate
* error-reporting functions.
*/
/** @addtogroup MGM_C_API
......@@ -194,7 +193,7 @@ extern "C" {
int node_group; /*< Node group of node
*< (only valid for DB nodes)*/
int version; /*< Internal version number*/
int connect_count; /*< No of times node has connected
int connect_count; /*< Number of times node has connected
*< or disconnected to the mgm srv
*/
char connect_address[sizeof("000.000.000.000")+1];
......@@ -363,7 +362,20 @@ extern "C" {
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 connect_string Connect string to the management server,
......@@ -373,23 +385,17 @@ extern "C" {
int ndb_mgm_set_connectstring(NdbMgmHandle handle,
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
*
* @return connectstring
*/
void ndb_mgm_destroy_handle(NdbMgmHandle * handle);
/** @} *********************************************************************/
/**
* @name Functions: Connect/Disconnect Management Server
* @{
*/
const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz);
/**
* Connect to a management server
......@@ -408,6 +414,33 @@ extern "C" {
*/
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
......@@ -436,7 +469,8 @@ extern "C" {
* @param type Node type.
* @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
......@@ -454,8 +488,10 @@ extern "C" {
*/
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 *);
const char * ndb_mgm_get_event_category_string(enum ndb_mgm_event_category);
#endif
/** @} *********************************************************************/
/**
......@@ -469,6 +505,7 @@ extern "C" {
* Note the caller must free the pointer returned.
*
* @param handle Management handle.
*
* @return Cluster state (or NULL on error).
*/
struct ndb_mgm_cluster_state * ndb_mgm_get_status(NdbMgmHandle handle);
......@@ -488,6 +525,7 @@ extern "C" {
* n - Means stop n node(s) specified in the
* array node_list
* @param node_list List of node ids of database nodes to be stopped
*
* @return No of nodes stopped (or -1 on error)
*
* @note The function is equivalent
......@@ -507,6 +545,7 @@ extern "C" {
* @param node_list List of node ids of database nodes to be stopped
* @param abort Don't perform gracefull stop,
* but rather stop immediatly
*
* @return No of nodes stopped (or -1 on error).
*/
int ndb_mgm_stop2(NdbMgmHandle handle, int no_of_nodes,
......@@ -521,6 +560,7 @@ extern "C" {
* n - Means stop n node(s) specified in the
* array node_list
* @param node_list List of node ids of database nodes to be stopped
*
* @return No of nodes stopped (or -1 on error).
*
* @note The function is equivalent to
......@@ -543,6 +583,7 @@ extern "C" {
* waiting for start command
* @param abort Don't perform gracefull restart,
* but rather restart immediatly
*
* @return No of nodes stopped (or -1 on error).
*/
int ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes,
......@@ -558,6 +599,7 @@ extern "C" {
* n - Means start n node(s) specified in
* the array node_list
* @param node_list List of node ids of database nodes to be started
*
* @return No of nodes started (or -1 on error).
*
* @note The nodes to start must have been started with nostart(-n)
......@@ -582,6 +624,7 @@ extern "C" {
* @param handle NDB management handle.
* @param level A cluster log level to filter.
* @param reply Reply message.
*
* @return -1 on error.
*/
int ndb_mgm_filter_clusterlog(NdbMgmHandle handle,
......@@ -592,6 +635,7 @@ extern "C" {
* Get log filter
*
* @param handle NDB management handle
*
* @return A vector of seven elements,
* where each element contains
* 1 if a severity is enabled and 0 if not.
......@@ -620,7 +664,7 @@ extern "C" {
enum ndb_mgm_event_category category,
int level,
struct ndb_mgm_reply* reply);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/**
* Set log category and levels for the Node
*
......@@ -646,6 +690,7 @@ extern "C" {
*/
int ndb_mgm_get_stat_port(NdbMgmHandle handle,
struct ndb_mgm_reply* reply);
#endif
/** @} *********************************************************************/
/**
......@@ -699,6 +744,7 @@ extern "C" {
* @param handle NDB management handle.
* @param nodeId Node Id of the single user node
* @param reply Reply message.
*
* @return -1 on error.
*/
int ndb_mgm_exit_single_user(NdbMgmHandle handle,
......@@ -709,6 +755,7 @@ extern "C" {
*
* @param filter pairs of { level, category } that will be
* pushed to fd, level=0 ends lists
*
* @return fd which events will be pushed to
*/
int ndb_mgm_listen_event(NdbMgmHandle handle, int filter[]);
......@@ -718,12 +765,16 @@ extern "C" {
* @param handle NDB management handle.
* @param version Version of configuration, 0 means latest
* @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,
unsigned version);
void ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
int ndb_mgm_alloc_nodeid(NdbMgmHandle handle,
unsigned version, int nodetype);
/**
......@@ -749,6 +800,8 @@ extern "C" {
int param, const char ** value);
int ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **);
int ndb_mgm_check_connection(NdbMgmHandle handle);
#endif
#ifdef __cplusplus
}
#endif
......
This diff is collapsed.
......@@ -19,7 +19,7 @@
#include "ndbapi_limits.h"
#include "Ndb.hpp"
#include "NdbConnection.hpp"
#include "NdbTransaction.hpp"
#include "NdbOperation.hpp"
#include "NdbScanOperation.hpp"
#include "NdbIndexOperation.hpp"
......
......@@ -19,11 +19,11 @@
#include <ndb_types.h>
#include <NdbDictionary.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <NdbError.hpp>
class Ndb;
class NdbConnection;
class NdbTransaction;
class NdbOperation;
class NdbRecAttr;
class NdbTableImpl;
......@@ -67,7 +67,7 @@ class NdbColumnImpl;
* cases NdbBlob is forced to do implicit executes. To avoid this,
* 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
* needed after execute (obviously) or after next scan result.
*
......@@ -88,8 +88,13 @@ class NdbColumnImpl;
* - lock mode vs allowed operation is not checked
* - too many pending blob ops can blow up i/o buffers
* - table and its blob part tables are not created atomically
*/
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/**
* - there is no support for an asynchronous interface
*/
#endif
class NdbBlob {
public:
/**
......@@ -212,12 +217,14 @@ public:
NdbBlob* blobsNextBlob();
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
friend class NdbOperation;
friend class NdbScanOperation;
friend class NdbDictionaryImpl;
friend class NdbResultSet; // atNextResult
#endif
// state
State theState;
void setState(State newState);
......@@ -226,7 +233,7 @@ private:
static void getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c);
// ndb api stuff
Ndb* theNdb;
NdbConnection* theNdbCon;
NdbTransaction* theNdbCon;
NdbOperation* theNdbOp;
const NdbTableImpl* theTable;
const NdbTableImpl* theAccessTable;
......@@ -316,7 +323,7 @@ private:
// callbacks
int invokeActiveHook();
// 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 postExecute(ExecType anExecType);
int preCommit();
......@@ -324,7 +331,7 @@ private:
// errors
void setErrorCode(int anErrorCode, 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
int getOperationType() const;
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;
*
* 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
* be the same for all and decided by the first NdbEventOperation
* instantiation. Just make sure to instantiate the "largest" one first.
......@@ -84,7 +84,7 @@ class NdbEventOperationImpl;
* replica. If a node fails events will not be received twice anymore
* 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
* again. Will be fixed in later versions.
*
......@@ -97,7 +97,7 @@ class NdbEventOperationImpl;
*
* 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.
*
*/
......@@ -187,13 +187,26 @@ public:
*/
NdbDictionary::Event::TableEvent getEventType();
/**
*
*/
Uint32 getGCI();
/**
*
*/
Uint32 getLatestGCI();
/*
*
*/
void print();
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbEventOperationImpl;
friend class Ndb;
#endif
NdbEventOperation(Ndb *theNdb, const char* eventName,int bufferLength);
~NdbEventOperation();
static int wait(void *p, int aMillisecondNumber);
......
......@@ -14,18 +14,6 @@
along with this program; if not, write to the Free Software
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
#define NdbIndexOperation_H
......@@ -40,8 +28,10 @@ class NdbResultSet;
*/
class NdbIndexOperation : public NdbOperation
{
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
#endif
public:
/**
......@@ -54,16 +44,17 @@ public:
/**
* 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.
*
* @return 0 if successful otherwise -1.
*/
int readTuple(LockMode);
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/**
* 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.
*
* @return 0 if successful otherwise -1.
......@@ -73,7 +64,7 @@ public:
/**
* Define the NdbIndexOperation to be a standard operation of type
* readTupleExclusive.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* read a tuple using an exclusive lock.
*
* @return 0 if successful otherwise -1.
......@@ -82,7 +73,7 @@ public:
/**
* 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),
* but releases lock immediately after read.
*
......@@ -101,7 +92,7 @@ public:
/**
* 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.
*
* This means that if another transaction is updating the
......@@ -113,7 +104,6 @@ public:
*/
int dirtyRead();
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
int committedRead();
#endif
......@@ -121,7 +111,7 @@ public:
* Define the NdbIndexOperation 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.
*
* @return 0 if successful otherwise -1.
......@@ -132,24 +122,27 @@ public:
* Define the NdbIndexOperation to be a standard operation of type
* deleteTuple.
*
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* deletes a tuple.
*
* @return 0 if successful otherwise -1.
*/
int deleteTuple();
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/**
* Define the NdbIndexOperation 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.
*
* @return 0 if successful otherwise -1.
*/
int dirtyUpdate();
#endif
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/** @} *********************************************************************/
/**
* @name Define Interpreted Program Operation
......@@ -169,6 +162,7 @@ public:
* @return 0 if successful otherwise -1.
*/
int interpretedDeleteTuple();
#endif
/** @} *********************************************************************/
......@@ -181,7 +175,7 @@ private:
// Overloaded methods from NdbCursorOperation
int indxInit(const class NdbIndexImpl* anIndex,
const class NdbTableImpl* aTable,
NdbConnection* myConnection);
NdbTransaction*);
int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId);
......
......@@ -24,23 +24,25 @@
* @brief Class of scan operations for use to scan ordered index
*/
class NdbIndexScanOperation : public NdbScanOperation {
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
friend class NdbResultSet;
friend class NdbOperation;
friend class NdbScanOperation;
#endif
public:
/**
* readTuples returns a NdbResultSet where tuples are stored.
* Tuples are not stored in NdbResultSet until execute(NoCommit)
* has been executed and nextResult has been called.
* readTuples using ordered index
*
* @param parallel Scan parallelism
* @param lock_mode Lock mode
* @param batch No of rows to fetch from each fragment at a time
* @param LockMode Scan lock handling
* @param parallel No of fragments to scan in parallel
* @param order_by Order result set in index order
* @param order_desc Order descending, ignored unless order_by
* @returns NdbResultSet.
* @param read_range_no Enable reading of range no using @ref get_range_no
* @returns 0 for success and -1 for failure
* @see NdbScanOperation::readTuples
*/
int readTuples(LockMode = LM_Read,
......@@ -50,14 +52,6 @@ public:
bool order_desc = false,
bool read_range_no = false);
inline int readTuples(int parallell){
return readTuples(LM_Read, 0, parallell, false);
}
inline int readTuplesExclusive(int parallell = 0){
return readTuples(LM_Exclusive, 0, parallell, false);
}
/**
* Type of ordered index key bound. The values (0-4) will not change
* and can be used explicitly (e.g. they could be computed).
......@@ -129,7 +123,14 @@ public:
*/
int get_range_no();
/**
* Is current scan sorted
*/
bool getSorted() const { return m_ordered; }
/**
* Is current scan sorted descending
*/
bool getDescending() const { return m_descending; }
private:
NdbIndexScanOperation(Ndb* aNdb);
......
This diff is collapsed.
......@@ -34,7 +34,7 @@ class NdbOperation;
* MyRecAttr = MyOperation->getValue("ATTR2", NULL);
* if (MyRecAttr == NULL) goto error;
*
* if (MyConnection->execute(Commit) == -1) goto error;
* if (MyTransaction->execute(Commit) == -1) goto error;
*
* ndbout << MyRecAttr->u_32_value();
* @endcode
......@@ -43,14 +43,14 @@ class NdbOperation;
* @ref ndbapi_example2.cpp.
*
* @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
* if the value is defined or not.)
* 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 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
* from the NdbRecAttr object.
......@@ -72,12 +72,14 @@ class NdbOperation;
*/
class NdbRecAttr
{
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbOperation;
friend class NdbIndexScanOperation;
friend class NdbEventOperationImpl;
friend class NdbReceiver;
friend class Ndb;
friend class NdbOut& operator<<(class NdbOut&, const class AttributeS&);
#endif
public:
/**
......@@ -124,7 +126,7 @@ public:
* Check if attribute value is NULL.
*
* @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>
* 1 = Attribute value is defined and equal to NULL.
*/
......@@ -243,7 +245,9 @@ public:
~NdbRecAttr();
public:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
const NdbRecAttr* next() const;
#endif
private:
NdbRecAttr();
......
......@@ -22,7 +22,7 @@
#include <ndb_global.h>
class Ndb;
class NdbConnection;
class NdbTransaction;
class NdbReceiver
{
......@@ -31,7 +31,7 @@ class NdbReceiver
friend class NdbScanOperation;
friend class NdbIndexOperation;
friend class NdbIndexScanOperation;
friend class NdbConnection;
friend class NdbTransaction;
public:
enum ReceiverType { NDB_UNINITIALIZED,
NDB_OPERATION = 1,
......@@ -52,7 +52,7 @@ public:
return m_type;
}
inline NdbConnection * getTransaction();
inline NdbTransaction * getTransaction();
void* getOwner(){
return m_owner;
}
......@@ -145,5 +145,5 @@ NdbReceiver::execSCANOPCONF(Uint32 tcPtrI, Uint32 len, Uint32 rows){
return (tmp == len ? 1 : 0);
}
#endif
#endif // DOXYGEN_SHOULD_SKIP_INTERNAL
#endif
......@@ -169,7 +169,9 @@ public:
/** @} *********************************************************************/
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbScanFilterImpl;
#endif
class NdbScanFilterImpl & m_impl;
NdbScanFilter& operator=(const NdbScanFilter&); ///< Defined not implemented
};
......
......@@ -14,18 +14,6 @@
along with this program; if not, write to the Free Software
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
#define NdbScanOperation_H
......@@ -39,25 +27,27 @@ class NdbResultSet;
* @brief Class of scan operations for use in transactions.
*/
class NdbScanOperation : public NdbOperation {
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
friend class NdbResultSet;
friend class NdbOperation;
friend class NdbBlob;
#endif
public:
/**
* readTuples returns a NdbResultSet where tuples are stored.
* Tuples are not stored in NdbResultSet until execute(NoCommit)
* has been executed and nextResult has been called.
* readTuples
*
* @param parallel Scan parallelism
* @param lock_mode Lock mode
* @param batch No of rows to fetch from each fragment at a time
* @param LockMode Scan lock handling
* @param parallel No of fragments to scan in parallell
* @note specifying 0 for batch and parallall means max performance
*/
int readTuples(LockMode = LM_Read,
int readTuples(LockMode lock_mode = LM_Read,
Uint32 batch = 0, Uint32 parallel = 0);
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
inline int readTuples(int parallell){
return readTuples(LM_Read, 0, parallell);
}
......@@ -65,14 +55,17 @@ public:
inline int readTuplesExclusive(int parallell = 0){
return readTuples(LM_Exclusive, 0, parallell);
}
#endif
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
NdbBlob* getBlobHandle(const char* anAttrName);
NdbBlob* getBlobHandle(Uint32 anAttrId);
#endif
/**
* Get the next tuple in a scan transaction.
*
* After each call to NdbResult::nextResult
* After each call to nextResult
* the buffers and NdbRecAttr objects defined in
* NdbOperation::getValue are updated with values
* from the scanned tuple.
......@@ -119,52 +112,30 @@ public:
int nextResult(bool fetchAllowed = true, bool forceSend = false);
/**
* Close result set (scan)
* Close scan
*/
void close(bool forceSend = false);
/**
* Restart
*/
int restart(bool forceSend = false);
/**
* Transfer scan operation to an updating transaction. Use this function
* when a scan has found a record that you want to update.
* 1. Start a new transaction.
* 2. Call the function takeOverForUpdate using your new transaction
* as parameter, all the properties of the found record will be copied
* to the new transaction.
* 3. When you execute the new transaction, the lock held by the scan will
* be transferred to the new transaction(it's taken over).
* Update current tuple
*
* @note You must have started the scan with openScanExclusive
* to be able to update the found tuple.
*
* @param updateTrans the update transaction connection.
* @return an NdbOperation or NULL.
*/
NdbOperation* updateCurrentTuple();
NdbOperation* updateCurrentTuple(NdbConnection* updateTrans);
NdbOperation* updateCurrentTuple(NdbTransaction* updateTrans);
/**
* Transfer scan operation to a deleting transaction. Use this function
* when a scan has found a record that you want to delete.
* 1. Start a new transaction.
* 2. Call the function takeOverForDelete using your new transaction
* as parameter, all the properties of the found record will be copied
* to the new transaction.
* 3. When you execute the new transaction, the lock held by the scan will
* be transferred to the new transaction(its taken over).
*
* @note You must have started the scan with openScanExclusive
* to be able to delete the found tuple.
*
* @param deleteTrans the delete transaction connection.
* @return an NdbOperation or NULL.
* Delete current tuple
* @return 0 on success or -1 on failure
*/
int deleteCurrentTuple();
int deleteCurrentTuple(NdbConnection* takeOverTransaction);
int deleteCurrentTuple(NdbTransaction* takeOverTransaction);
/**
* Restart scan with exactly the same
* getValues and search conditions
*/
int restart(bool forceSend = false);
protected:
NdbScanOperation(Ndb* aNdb);
......@@ -179,7 +150,7 @@ protected:
int executeCursor(int ProcessorId);
// 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 doSend(int ProcessorId);
void checkForceSend(bool forceSend);
......@@ -187,7 +158,7 @@ protected:
virtual void setErrorCode(int aErrorCode);
virtual void setErrorCodeAbort(int aErrorCode);
NdbConnection *m_transConnection;
NdbTransaction *m_transConnection;
// Scan related variables
Uint32 theParallelism;
......@@ -230,7 +201,7 @@ protected:
void execCLOSE_SCAN_REP();
int getKeyFromKEYINFO20(Uint32* data, unsigned size);
NdbOperation* takeOverScanOp(OperationType opType, NdbConnection*);
NdbOperation* takeOverScanOp(OperationType opType, NdbTransaction*);
bool m_ordered;
bool m_descending;
......@@ -245,7 +216,7 @@ NdbScanOperation::updateCurrentTuple(){
inline
NdbOperation*
NdbScanOperation::updateCurrentTuple(NdbConnection* takeOverTrans){
NdbScanOperation::updateCurrentTuple(NdbTransaction* takeOverTrans){
return takeOverScanOp(NdbOperation::UpdateRequest,
takeOverTrans);
}
......@@ -258,7 +229,7 @@ NdbScanOperation::deleteCurrentTuple(){
inline
int
NdbScanOperation::deleteCurrentTuple(NdbConnection * takeOverTrans){
NdbScanOperation::deleteCurrentTuple(NdbTransaction * takeOverTrans){
void * res = takeOverScanOp(NdbOperation::DeleteRequest,
takeOverTrans);
if(res == 0)
......
......@@ -150,7 +150,7 @@ NdbSqlUtil::m_typeList[] = {
},
{
Type::Datetime,
NULL // cmpDatetime
cmpDatetime
},
{
Type::Timespec,
......@@ -458,12 +458,11 @@ NdbSqlUtil::cmpVarbinary(const void* info, const void* p1, unsigned n1, const vo
return 0;
}
// not used by MySQL or NDB
// allowed but ordering is wrong before wl-1442 done
int
NdbSqlUtil::cmpDatetime(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{
assert(false);
return 0;
return cmpBinary(info, p1, n1, p2, n2, full);
}
// not used by MySQL or NDB
......
......@@ -70,6 +70,8 @@ struct NdbUpGradeCompatible {
#ifndef TEST_VERSION
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 },
{ 0, 0, UG_Null }
};
......
......@@ -14,8 +14,8 @@ libndbapi_la_SOURCES = \
Ndberr.cpp \
ndberror.c \
NdbErrorOut.cpp \
NdbConnection.cpp \
NdbConnectionScan.cpp \
NdbTransaction.cpp \
NdbTransactionScan.cpp \
NdbOperation.cpp \
NdbOperationSearch.cpp \
NdbOperationScan.cpp \
......
This diff is collapsed.
......@@ -93,7 +93,7 @@ private:
void setDataPtr(Uint32 *);
friend class NdbConnection;
friend class NdbTransaction;
friend class NdbScanReceiver;
friend class Table;
void copyFrom(const NdbApiSignal * src);
......
......@@ -16,7 +16,7 @@
#include <Ndb.hpp>
#include <NdbDictionaryImpl.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <NdbOperation.hpp>
#include <NdbIndexOperation.hpp>
#include <NdbRecAttr.hpp>
......@@ -1059,7 +1059,7 @@ NdbBlob::invokeActiveHook()
* data. For read operation adds read of head+inline.
*/
int
NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn)
NdbBlob::atPrepare(NdbTransaction* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn)
{
assert(theState == Idle);
// ndb api stuff
......@@ -1550,7 +1550,7 @@ NdbBlob::setErrorCode(NdbOperation* anOp, bool invalidFlag)
}
void
NdbBlob::setErrorCode(NdbConnection* aCon, bool invalidFlag)
NdbBlob::setErrorCode(NdbTransaction* aCon, bool invalidFlag)
{
int 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:
#include <NdbError.hpp>
#include <NdbCondition.h>
#include <NdbReceiver.hpp>
#include <NdbTransaction.hpp>
#include <NdbOperation.hpp>
#include <NdbTick.h>
......
......@@ -17,7 +17,7 @@
#include <ndb_global.h>
#include <NdbIndexOperation.hpp>
#include <Ndb.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include "NdbApiSignal.hpp"
#include <AttributeHeader.hpp>
#include <signaldata/TcIndx.hpp>
......@@ -53,7 +53,7 @@ NdbIndexOperation::~NdbIndexOperation()
int
NdbIndexOperation::indxInit(const NdbIndexImpl * anIndex,
const NdbTableImpl * aTable,
NdbConnection* myConnection)
NdbTransaction* myConnection)
{
NdbOperation::init(aTable, myConnection);
......
......@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <NdbOperation.hpp>
#include "NdbApiSignal.hpp"
#include "NdbRecAttr.hpp"
......@@ -128,7 +128,7 @@ NdbOperation::setErrorCodeAbort(int anErrorCode)
*****************************************************************************/
int
NdbOperation::init(const NdbTableImpl* tab, NdbConnection* myConnection){
NdbOperation::init(const NdbTableImpl* tab, NdbTransaction* myConnection){
NdbApiSignal* tSignal;
theStatus = Init;
theError.code = 0;
......
This diff is collapsed.
......@@ -16,7 +16,7 @@
#include <ndb_global.h>
#include <NdbOperation.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include "NdbApiSignal.hpp"
#include <Ndb.hpp>
#include <NdbRecAttr.hpp>
......@@ -544,7 +544,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal)
// blobs want this
if (m_abortOption != AO_IgnoreError)
{
theNdbCon->theReturnStatus = NdbConnection::ReturnFailure;
theNdbCon->theReturnStatus = NdbTransaction::ReturnFailure;
}
theError.code = aSignal->readData(4);
theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4), ao);
......
This diff is collapsed.
This diff is collapsed.
......@@ -20,7 +20,7 @@
#include "NdbDictionaryImpl.hpp"
#include <NdbRecAttr.hpp>
#include <AttributeHeader.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <TransporterFacade.hpp>
#include <signaldata/TcKeyConf.hpp>
......
This diff is collapsed.
......@@ -19,7 +19,7 @@
#include "NdbImpl.hpp"
#include "NdbDictionaryImpl.hpp"
#include <NdbOperation.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <NdbBlob.hpp>
......@@ -55,7 +55,7 @@ NdbDictionaryImpl::getNdbError() const {
const
NdbError &
NdbConnection::getNdbError() const {
NdbTransaction::getNdbError() const {
update(theError);
return theError;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
max-time: 2500
max-time: 25000
cmd: atrt-mysql-test-run
args: --do-test=ndb --force
args: --force
#
# INDEX
......
......@@ -3,7 +3,6 @@ ndbtest_PROGRAMS = hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hug
# transproxy
hugoCalculator_SOURCES = hugoCalculator.cpp
hugoFill_SOURCES = hugoFill.cpp
hugoLoad_SOURCES = hugoLoad.cpp
hugoLockRecords_SOURCES = hugoLockRecords.cpp
......
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