mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0
into dl145c.mysql.com:/home/ndbdev/tomas/mysql-5.1
This commit is contained in:
@ -273,8 +273,8 @@ int CertManager::SetPrivateKey(const x509& key)
|
||||
privateKey_.assign(key.get_buffer(), key.get_length());
|
||||
|
||||
// set key type
|
||||
if (x509* cert = list_.front()) {
|
||||
TaoCrypt::Source source(cert->get_buffer(), cert->get_length());
|
||||
if (x509* cert509 = list_.front()) {
|
||||
TaoCrypt::Source source(cert509->get_buffer(), cert509->get_length());
|
||||
TaoCrypt::CertDecoder cert(source, false);
|
||||
cert.DecodeToKey();
|
||||
if (int err = cert.GetError().What())
|
||||
|
@ -65,7 +65,7 @@ UNKOWN_HASH_E = 1034, // "unknown hash OID"
|
||||
DSA_SZ_E = 1035, // "bad DSA r or s size"
|
||||
BEFORE_DATE_E = 1036, // "before date in the future"
|
||||
AFTER_DATE_E = 1037, // "after date in the past"
|
||||
SIG_CONFIRM_E = 1038, // "bad signature confirmation"
|
||||
SIG_CONFIRM_E = 1038 // "bad signature confirmation"
|
||||
|
||||
};
|
||||
|
||||
|
@ -97,7 +97,7 @@ typedef unsigned int word32;
|
||||
typedef word32 word;
|
||||
typedef word64 dword;
|
||||
#else
|
||||
typedef word8 hword;
|
||||
typedef byte hword;
|
||||
typedef word16 word;
|
||||
typedef word32 dword;
|
||||
#endif
|
||||
|
@ -120,6 +120,9 @@ ASIN(0.8+0.2)
|
||||
SELECT ASIN(1.2-0.2);
|
||||
ASIN(1.2-0.2)
|
||||
1.5707963267949
|
||||
select format(4.55, 1), format(4.551, 1);
|
||||
format(4.55, 1) format(4.551, 1)
|
||||
4.6 4.6
|
||||
explain extended select degrees(pi()),radians(360);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
|
@ -667,3 +667,9 @@ counter datavalue
|
||||
57 newval
|
||||
58 newval
|
||||
drop table t1;
|
||||
create table atablewithareallylongandirritatingname (a int);
|
||||
insert into atablewithareallylongandirritatingname values (2);
|
||||
select * from atablewithareallylongandirritatingname;
|
||||
a
|
||||
2
|
||||
drop table atablewithareallylongandirritatingname;
|
||||
|
@ -2355,6 +2355,74 @@ EXPLAIN SELECT i FROM t1 WHERE i=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
|
||||
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
|
||||
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||
1 SIMPLE t2 ref a a 23 test.t1.a 2
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||
1 SIMPLE t2 ref a a 23 test.t1.a 2
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 ( city char(30) );
|
||||
INSERT INTO t1 VALUES ('London');
|
||||
INSERT INTO t1 VALUES ('Paris');
|
||||
SELECT * FROM t1 WHERE city='London';
|
||||
city
|
||||
London
|
||||
SELECT * FROM t1 WHERE city='london';
|
||||
city
|
||||
London
|
||||
EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT * FROM t1 WHERE city='London' AND city='london';
|
||||
city
|
||||
London
|
||||
EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
|
||||
city
|
||||
London
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int(11) unsigned, b int(11) unsigned);
|
||||
insert into t1 values (1,0), (1,1), (1,2);
|
||||
select a-b from t1 order by 1;
|
||||
a-b
|
||||
0
|
||||
1
|
||||
18446744073709551615
|
||||
select a-b , (a-b < 0) from t1 order by 1;
|
||||
a-b (a-b < 0)
|
||||
0 0
|
||||
1 0
|
||||
18446744073709551615 0
|
||||
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
|
||||
d (a-b >= 0) b
|
||||
1 1 0
|
||||
0 1 1
|
||||
18446744073709551615 1 2
|
||||
select cast((a - b) as unsigned) from t1 order by 1;
|
||||
cast((a - b) as unsigned)
|
||||
0
|
||||
1
|
||||
18446744073709551615
|
||||
drop table t1;
|
||||
create table t1 (a int(11));
|
||||
select all all * from t1;
|
||||
a
|
||||
select distinct distinct * from t1;
|
||||
a
|
||||
select all distinct * from t1;
|
||||
ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||
select distinct all * from t1;
|
||||
ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '',
|
||||
K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000',
|
||||
@ -2486,3 +2554,125 @@ ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||
select distinct all * from t1;
|
||||
ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
|
||||
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
|
||||
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||
1 SIMPLE t2 ref a a 23 test.t1.a 2
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||
1 SIMPLE t2 ref a a 23 test.t1.a 2
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 ( city char(30) );
|
||||
INSERT INTO t1 VALUES ('London');
|
||||
INSERT INTO t1 VALUES ('Paris');
|
||||
SELECT * FROM t1 WHERE city='London';
|
||||
city
|
||||
London
|
||||
SELECT * FROM t1 WHERE city='london';
|
||||
city
|
||||
London
|
||||
EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT * FROM t1 WHERE city='London' AND city='london';
|
||||
city
|
||||
London
|
||||
EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
|
||||
city
|
||||
London
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int(11) unsigned, b int(11) unsigned);
|
||||
insert into t1 values (1,0), (1,1), (1,2);
|
||||
select a-b from t1 order by 1;
|
||||
a-b
|
||||
0
|
||||
1
|
||||
18446744073709551615
|
||||
select a-b , (a-b < 0) from t1 order by 1;
|
||||
a-b (a-b < 0)
|
||||
0 0
|
||||
1 0
|
||||
18446744073709551615 0
|
||||
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
|
||||
d (a-b >= 0) b
|
||||
1 1 0
|
||||
0 1 1
|
||||
18446744073709551615 1 2
|
||||
select cast((a - b) as unsigned) from t1 order by 1;
|
||||
cast((a - b) as unsigned)
|
||||
0
|
||||
1
|
||||
18446744073709551615
|
||||
drop table t1;
|
||||
create table t1 (a int(11));
|
||||
select all all * from t1;
|
||||
a
|
||||
select distinct distinct * from t1;
|
||||
a
|
||||
select all distinct * from t1;
|
||||
ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||
select distinct all * from t1;
|
||||
ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
kunde_intern_id int(10) unsigned NOT NULL default '0',
|
||||
kunde_id int(10) unsigned NOT NULL default '0',
|
||||
FK_firma_id int(10) unsigned NOT NULL default '0',
|
||||
aktuell enum('Ja','Nein') NOT NULL default 'Ja',
|
||||
vorname varchar(128) NOT NULL default '',
|
||||
nachname varchar(128) NOT NULL default '',
|
||||
geloescht enum('Ja','Nein') NOT NULL default 'Nein',
|
||||
firma varchar(128) NOT NULL default ''
|
||||
);
|
||||
INSERT INTO t1 VALUES
|
||||
(3964,3051,1,'Ja','Vorname1','1Nachname','Nein','Print Schau XXXX'),
|
||||
(3965,3051111,1,'Ja','Vorname1111','1111Nachname','Nein','Print Schau XXXX');
|
||||
SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname, geloescht FROM t1
|
||||
WHERE
|
||||
(
|
||||
(
|
||||
( '' != '' AND firma LIKE CONCAT('%', '', '%'))
|
||||
OR
|
||||
(vorname LIKE CONCAT('%', 'Vorname1', '%') AND
|
||||
nachname LIKE CONCAT('%', '1Nachname', '%') AND
|
||||
'Vorname1' != '' AND 'xxxx' != '')
|
||||
)
|
||||
AND
|
||||
(
|
||||
aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
|
||||
)
|
||||
)
|
||||
;
|
||||
kunde_id FK_firma_id aktuell vorname nachname geloescht
|
||||
SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname,
|
||||
geloescht FROM t1
|
||||
WHERE
|
||||
(
|
||||
(
|
||||
aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
|
||||
)
|
||||
AND
|
||||
(
|
||||
( '' != '' AND firma LIKE CONCAT('%', '', '%') )
|
||||
OR
|
||||
( vorname LIKE CONCAT('%', 'Vorname1', '%') AND
|
||||
nachname LIKE CONCAT('%', '1Nachname', '%') AND 'Vorname1' != '' AND
|
||||
'xxxx' != '')
|
||||
)
|
||||
)
|
||||
;
|
||||
kunde_id FK_firma_id aktuell vorname nachname geloescht
|
||||
SELECT COUNT(*) FROM t1 WHERE
|
||||
( 0 OR (vorname LIKE '%Vorname1%' AND nachname LIKE '%1Nachname%' AND 1))
|
||||
AND FK_firma_id = 2;
|
||||
COUNT(*)
|
||||
0
|
||||
drop table t1;
|
||||
|
@ -54,6 +54,11 @@ SELECT ASIN(1.2-0.2);
|
||||
#select floor(log(8)/log(2));
|
||||
#select floor(log(16)/log(2));
|
||||
|
||||
#
|
||||
# Bug #9060 (format returns incorrect result)
|
||||
#
|
||||
select format(4.55, 1), format(4.551, 1);
|
||||
|
||||
explain extended select degrees(pi()),radians(360);
|
||||
|
||||
#
|
||||
|
@ -605,3 +605,12 @@ insert into t1 (datavalue) select datavalue from t1 where counter < 100;
|
||||
select * from t1 order by counter;
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Test long table name
|
||||
#
|
||||
create table atablewithareallylongandirritatingname (a int);
|
||||
insert into atablewithareallylongandirritatingname values (2);
|
||||
select * from atablewithareallylongandirritatingname;
|
||||
drop table atablewithareallylongandirritatingname;
|
||||
|
@ -1939,6 +1939,64 @@ EXPLAIN SELECT i FROM t1 WHERE i=1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test case for bug 7520: a wrong cost of the index for a BLOB field
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
|
||||
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
|
||||
|
||||
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
#
|
||||
# Test case for bug 7098: substitution of a constant for a string field
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( city char(30) );
|
||||
INSERT INTO t1 VALUES ('London');
|
||||
INSERT INTO t1 VALUES ('Paris');
|
||||
|
||||
SELECT * FROM t1 WHERE city='London';
|
||||
SELECT * FROM t1 WHERE city='london';
|
||||
EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
|
||||
SELECT * FROM t1 WHERE city='London' AND city='london';
|
||||
EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
|
||||
SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#7425 inconsistent sort order on unsigned columns result of substraction
|
||||
#
|
||||
|
||||
create table t1 (a int(11) unsigned, b int(11) unsigned);
|
||||
insert into t1 values (1,0), (1,1), (1,2);
|
||||
select a-b from t1 order by 1;
|
||||
select a-b , (a-b < 0) from t1 order by 1;
|
||||
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
|
||||
select cast((a - b) as unsigned) from t1 order by 1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#8733 server accepts malformed query (multiply mentioned distinct)
|
||||
#
|
||||
create table t1 (a int(11));
|
||||
select all all * from t1;
|
||||
select distinct distinct * from t1;
|
||||
--error 1221
|
||||
select all distinct * from t1;
|
||||
--error 1221
|
||||
select distinct all * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for bug #6474
|
||||
#
|
||||
@ -2072,3 +2130,119 @@ drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Test case for bug 7520: a wrong cost of the index for a BLOB field
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
|
||||
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
|
||||
|
||||
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Test case for bug 7098: substitution of a constant for a string field
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( city char(30) );
|
||||
INSERT INTO t1 VALUES ('London');
|
||||
INSERT INTO t1 VALUES ('Paris');
|
||||
|
||||
SELECT * FROM t1 WHERE city='London';
|
||||
SELECT * FROM t1 WHERE city='london';
|
||||
EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
|
||||
SELECT * FROM t1 WHERE city='London' AND city='london';
|
||||
EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
|
||||
SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#7425 inconsistent sort order on unsigned columns result of substraction
|
||||
#
|
||||
|
||||
create table t1 (a int(11) unsigned, b int(11) unsigned);
|
||||
insert into t1 values (1,0), (1,1), (1,2);
|
||||
select a-b from t1 order by 1;
|
||||
select a-b , (a-b < 0) from t1 order by 1;
|
||||
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
|
||||
select cast((a - b) as unsigned) from t1 order by 1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#8733 server accepts malformed query (multiply mentioned distinct)
|
||||
#
|
||||
create table t1 (a int(11));
|
||||
select all all * from t1;
|
||||
select distinct distinct * from t1;
|
||||
--error 1221
|
||||
select all distinct * from t1;
|
||||
--error 1221
|
||||
select distinct all * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for BUG#10095
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
kunde_intern_id int(10) unsigned NOT NULL default '0',
|
||||
kunde_id int(10) unsigned NOT NULL default '0',
|
||||
FK_firma_id int(10) unsigned NOT NULL default '0',
|
||||
aktuell enum('Ja','Nein') NOT NULL default 'Ja',
|
||||
vorname varchar(128) NOT NULL default '',
|
||||
nachname varchar(128) NOT NULL default '',
|
||||
geloescht enum('Ja','Nein') NOT NULL default 'Nein',
|
||||
firma varchar(128) NOT NULL default ''
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES
|
||||
(3964,3051,1,'Ja','Vorname1','1Nachname','Nein','Print Schau XXXX'),
|
||||
(3965,3051111,1,'Ja','Vorname1111','1111Nachname','Nein','Print Schau XXXX');
|
||||
|
||||
|
||||
SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname, geloescht FROM t1
|
||||
WHERE
|
||||
(
|
||||
(
|
||||
( '' != '' AND firma LIKE CONCAT('%', '', '%'))
|
||||
OR
|
||||
(vorname LIKE CONCAT('%', 'Vorname1', '%') AND
|
||||
nachname LIKE CONCAT('%', '1Nachname', '%') AND
|
||||
'Vorname1' != '' AND 'xxxx' != '')
|
||||
)
|
||||
AND
|
||||
(
|
||||
aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname,
|
||||
geloescht FROM t1
|
||||
WHERE
|
||||
(
|
||||
(
|
||||
aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
|
||||
)
|
||||
AND
|
||||
(
|
||||
( '' != '' AND firma LIKE CONCAT('%', '', '%') )
|
||||
OR
|
||||
( vorname LIKE CONCAT('%', 'Vorname1', '%') AND
|
||||
nachname LIKE CONCAT('%', '1Nachname', '%') AND 'Vorname1' != '' AND
|
||||
'xxxx' != '')
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
SELECT COUNT(*) FROM t1 WHERE
|
||||
( 0 OR (vorname LIKE '%Vorname1%' AND nachname LIKE '%1Nachname%' AND 1))
|
||||
AND FK_firma_id = 2;
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
@ -171,7 +171,7 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
|
||||
info->arg = 0;
|
||||
info->alloced_buffer = 0;
|
||||
info->buffer=0;
|
||||
info->seek_not_done= test(file >= 0);
|
||||
info->seek_not_done= test(file >= 0 && seek_offset != my_tell(file, MYF(0)));
|
||||
info->disk_writes= 0;
|
||||
#ifdef THREAD
|
||||
info->share=0;
|
||||
@ -184,8 +184,10 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
|
||||
{ /* Assume file isn't growing */
|
||||
if (!(cache_myflags & MY_DONT_CHECK_FILESIZE))
|
||||
{
|
||||
/* Calculate end of file to not allocate to big buffers */
|
||||
/* Calculate end of file to avoid allocating oversized buffers */
|
||||
end_of_file=my_seek(file,0L,MY_SEEK_END,MYF(0));
|
||||
/* Need to reset seek_not_done now that we just did a seek. */
|
||||
info->seek_not_done= end_of_file == seek_offset ? 0 : 1;
|
||||
if (end_of_file < seek_offset)
|
||||
end_of_file=seek_offset;
|
||||
/* Trim cache size if the file is very small */
|
||||
|
@ -85,6 +85,7 @@ void init_thr_alarm(uint max_alarms)
|
||||
#else
|
||||
{
|
||||
struct sigaction sact;
|
||||
sact.sa_flags = 0;
|
||||
bzero((char*) &sact, sizeof(sact));
|
||||
sact.sa_handler = thread_alarm;
|
||||
sigaction(THR_CLIENT_ALARM, &sact, (struct sigaction*) 0);
|
||||
|
@ -459,8 +459,8 @@ int main(int argc,char **argv)
|
||||
generate_find_structs();
|
||||
print_find_structs();
|
||||
|
||||
printf("\static unsigned int sql_functions_max_len=%d;\n",max_len);
|
||||
printf("\static unsigned int symbols_max_len=%d;\n\n",max_len2);
|
||||
printf("\nstatic unsigned int sql_functions_max_len=%d;\n", max_len);
|
||||
printf("\nstatic unsigned int symbols_max_len=%d;\n\n", max_len2);
|
||||
|
||||
printf("\
|
||||
static inline SYMBOL *get_hash_symbol(const char *s,\n\
|
||||
|
@ -984,16 +984,13 @@ static int fix_unique_index_attr_order(NDB_INDEX_DATA &data,
|
||||
for (unsigned i= 0; key_part != end; key_part++, i++)
|
||||
{
|
||||
const char *field_name= key_part->field->field_name;
|
||||
unsigned name_sz= strlen(field_name);
|
||||
if (name_sz >= NDB_MAX_ATTR_NAME_SIZE)
|
||||
name_sz= NDB_MAX_ATTR_NAME_SIZE-1;
|
||||
#ifndef DBUG_OFF
|
||||
data.unique_index_attrid_map[i]= 255;
|
||||
#endif
|
||||
for (unsigned j= 0; j < sz; j++)
|
||||
{
|
||||
const NDBCOL *c= index->getColumn(j);
|
||||
if (strncmp(field_name, c->getName(), name_sz) == 0)
|
||||
if (strcmp(field_name, c->getName()) == 0)
|
||||
{
|
||||
data.unique_index_attrid_map[i]= j;
|
||||
break;
|
||||
@ -3449,12 +3446,7 @@ static int create_ndb_column(NDBCOL &col,
|
||||
HA_CREATE_INFO *info)
|
||||
{
|
||||
// Set name
|
||||
{
|
||||
char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE];
|
||||
strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name));
|
||||
truncated_field_name[sizeof(truncated_field_name)-1]= '\0';
|
||||
col.setName(truncated_field_name);
|
||||
}
|
||||
col.setName(field->field_name);
|
||||
// Get char set
|
||||
CHARSET_INFO *cs= field->charset();
|
||||
// Set type and sizes
|
||||
@ -3944,12 +3936,7 @@ int ha_ndbcluster::create_index(const char *name,
|
||||
{
|
||||
Field *field= key_part->field;
|
||||
DBUG_PRINT("info", ("attr: %s", field->field_name));
|
||||
{
|
||||
char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE];
|
||||
strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name));
|
||||
truncated_field_name[sizeof(truncated_field_name)-1]= '\0';
|
||||
ndb_index.addColumnName(truncated_field_name);
|
||||
}
|
||||
ndb_index.addColumnName(field->field_name);
|
||||
}
|
||||
|
||||
if (dict->createIndex(ndb_index))
|
||||
@ -5409,7 +5396,8 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
|
||||
DBUG_RETURN(0);
|
||||
} while(0);
|
||||
|
||||
ndb->closeTransaction(pTrans);
|
||||
if (pTrans)
|
||||
ndb->closeTransaction(pTrans);
|
||||
DBUG_PRINT("exit", ("failed"));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
@ -1880,22 +1880,16 @@ void Item_func_round::fix_length_and_dec()
|
||||
}
|
||||
}
|
||||
|
||||
double Item_func_round::real_op()
|
||||
double my_double_round(double value, int dec, bool truncate)
|
||||
{
|
||||
double value= args[0]->val_real();
|
||||
int dec=(int) args[1]->val_int();
|
||||
if (dec > 0)
|
||||
decimals= dec; // to get correct output
|
||||
uint abs_dec=abs(dec);
|
||||
double tmp;
|
||||
uint abs_dec= abs(dec);
|
||||
/*
|
||||
tmp2 is here to avoid return the value with 80 bit precision
|
||||
This will fix that the test round(0.1,1) = round(0.1,1) is true
|
||||
*/
|
||||
volatile double tmp2;
|
||||
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
return 0.0;
|
||||
tmp=(abs_dec < array_elements(log_10) ?
|
||||
log_10[abs_dec] : pow(10.0,(double) abs_dec));
|
||||
|
||||
@ -1912,6 +1906,18 @@ double Item_func_round::real_op()
|
||||
}
|
||||
|
||||
|
||||
double Item_func_round::real_op()
|
||||
{
|
||||
double value= args[0]->val_real();
|
||||
int dec= (int) args[1]->val_int();
|
||||
|
||||
if (!(null_value= args[0]->null_value || args[1]->null_value))
|
||||
return my_double_round(value, dec, truncate);
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
longlong Item_func_round::int_op()
|
||||
{
|
||||
longlong value= args[0]->val_int();
|
||||
|
@ -1673,6 +1673,7 @@ String *Item_func_format::val_str(String *str)
|
||||
int diff;
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0; /* purecov: inspected */
|
||||
nr= my_double_round(nr, decimals, FALSE);
|
||||
dec= decimals ? decimals+1 : 0;
|
||||
/* Here default_charset() is right as this is not an automatic conversion */
|
||||
str->set(nr,decimals, default_charset());
|
||||
|
@ -1254,6 +1254,7 @@ ha_rows filesort(THD *thd, TABLE *form,struct st_sort_field *sortorder,
|
||||
ha_rows max_rows, ha_rows *examined_rows);
|
||||
void filesort_free_buffers(TABLE *table);
|
||||
void change_double_for_sort(double nr,byte *to);
|
||||
double my_double_round(double value, int dec, bool truncate);
|
||||
int get_quick_record(SQL_SELECT *select);
|
||||
int calc_weekday(long daynr,bool sunday_first_day_of_week);
|
||||
uint calc_week(TIME *l_time, uint week_behaviour, uint *year);
|
||||
|
@ -98,6 +98,12 @@ static Geometry::Class_info
|
||||
geometrycollection_class("GEOMETRYCOLLECTION",Geometry::wkb_geometrycollection,
|
||||
create_geometrycollection);
|
||||
|
||||
static void get_point(double *x, double *y, const char *data)
|
||||
{
|
||||
float8get(*x, data);
|
||||
float8get(*y, data + SIZEOF_STORED_DOUBLE);
|
||||
}
|
||||
|
||||
/***************************** Geometry *******************************/
|
||||
|
||||
Geometry::Class_info *Geometry::find_class(const char *name, uint32 len)
|
||||
@ -268,14 +274,13 @@ const char *Geometry::append_points(String *txt, uint32 n_points,
|
||||
{
|
||||
while (n_points--)
|
||||
{
|
||||
double d;
|
||||
double x,y;
|
||||
data+= offset;
|
||||
float8get(d, data);
|
||||
txt->qs_append(d);
|
||||
txt->qs_append(' ');
|
||||
float8get(d, data + SIZEOF_STORED_DOUBLE);
|
||||
get_point(&x, &y, data);
|
||||
data+= SIZEOF_STORED_DOUBLE * 2;
|
||||
txt->qs_append(d);
|
||||
txt->qs_append(x);
|
||||
txt->qs_append(' ');
|
||||
txt->qs_append(y);
|
||||
txt->qs_append(',');
|
||||
}
|
||||
return data;
|
||||
@ -428,8 +433,7 @@ bool Gis_line_string::get_data_as_wkt(String *txt, const char **end) const
|
||||
while (n_points--)
|
||||
{
|
||||
double x, y;
|
||||
float8get(x, data);
|
||||
float8get(y, data + SIZEOF_STORED_DOUBLE);
|
||||
get_point(&x, &y, data);
|
||||
data+= SIZEOF_STORED_DOUBLE * 2;
|
||||
txt->qs_append(x);
|
||||
txt->qs_append(' ');
|
||||
@ -462,15 +466,13 @@ int Gis_line_string::length(double *len) const
|
||||
if (n_points < 1 || no_data(data, SIZEOF_STORED_DOUBLE * 2 * n_points))
|
||||
return 1;
|
||||
|
||||
float8get(prev_x, data);
|
||||
float8get(prev_y, data + SIZEOF_STORED_DOUBLE);
|
||||
get_point(&prev_x, &prev_y, data);
|
||||
data+= SIZEOF_STORED_DOUBLE*2;
|
||||
|
||||
while (--n_points)
|
||||
{
|
||||
double x, y;
|
||||
float8get(x, data);
|
||||
float8get(y, data + SIZEOF_STORED_DOUBLE);
|
||||
get_point(&x, &y, data);
|
||||
data+= SIZEOF_STORED_DOUBLE * 2;
|
||||
*len+= sqrt(pow(prev_x-x,2)+pow(prev_y-y,2));
|
||||
prev_x= x;
|
||||
@ -499,13 +501,11 @@ int Gis_line_string::is_closed(int *closed) const
|
||||
return 1;
|
||||
|
||||
/* Get first point */
|
||||
float8get(x1, data);
|
||||
float8get(y1, data + SIZEOF_STORED_DOUBLE);
|
||||
get_point(&x1, &y1, data);
|
||||
|
||||
/* get last point */
|
||||
data+= SIZEOF_STORED_DOUBLE*2 + (n_points-2)*POINT_DATA_SIZE;
|
||||
float8get(x2, data);
|
||||
float8get(y2, data + SIZEOF_STORED_DOUBLE);
|
||||
get_point(&x2, &y2, data);
|
||||
|
||||
*closed= (x1==x2) && (y1==y2);
|
||||
return 0;
|
||||
@ -683,15 +683,13 @@ int Gis_polygon::area(double *ar, const char **end_of_data) const
|
||||
n_points= uint4korr(data);
|
||||
if (no_data(data, (SIZEOF_STORED_DOUBLE*2) * n_points))
|
||||
return 1;
|
||||
float8get(prev_x, data+4);
|
||||
float8get(prev_y, data+(4+SIZEOF_STORED_DOUBLE));
|
||||
get_point(&prev_x, &prev_y, data+4);
|
||||
data+= (4+SIZEOF_STORED_DOUBLE*2);
|
||||
|
||||
while (--n_points) // One point is already read
|
||||
{
|
||||
double x, y;
|
||||
float8get(x, data);
|
||||
float8get(y, data + SIZEOF_STORED_DOUBLE);
|
||||
get_point(&x, &y, data);
|
||||
data+= (SIZEOF_STORED_DOUBLE*2);
|
||||
/* QQ: Is the following prev_x+x right ? */
|
||||
lr_area+= (prev_x + x)* (prev_y - y);
|
||||
@ -781,7 +779,8 @@ int Gis_polygon::interior_ring_n(uint32 num, String *result) const
|
||||
int Gis_polygon::centroid_xy(double *x, double *y) const
|
||||
{
|
||||
uint32 n_linear_rings;
|
||||
double res_area, res_cx, res_cy;
|
||||
double res_area;
|
||||
double res_cx, res_cy;
|
||||
const char *data= m_data;
|
||||
bool first_loop= 1;
|
||||
LINT_INIT(res_area);
|
||||
@ -807,15 +806,13 @@ int Gis_polygon::centroid_xy(double *x, double *y) const
|
||||
data+= 4;
|
||||
if (no_data(data, (SIZEOF_STORED_DOUBLE*2) * n_points))
|
||||
return 1;
|
||||
float8get(prev_x, data);
|
||||
float8get(prev_y, data+SIZEOF_STORED_DOUBLE);
|
||||
get_point(&prev_x, &prev_y, data);
|
||||
data+= (SIZEOF_STORED_DOUBLE*2);
|
||||
|
||||
while (--n_points) // One point is already read
|
||||
{
|
||||
double x, y;
|
||||
float8get(x, data);
|
||||
float8get(y, data + SIZEOF_STORED_DOUBLE);
|
||||
get_point(&x, &y, data);
|
||||
data+= (SIZEOF_STORED_DOUBLE*2);
|
||||
/* QQ: Is the following prev_x+x right ? */
|
||||
cur_area+= (prev_x + x) * (prev_y - y);
|
||||
|
@ -192,6 +192,54 @@ public:
|
||||
friend class error_list;
|
||||
friend class error_list_iterator;
|
||||
|
||||
#ifdef LIST_EXTRA_DEBUG
|
||||
/*
|
||||
Check list invariants and print results into trace. Invariants are:
|
||||
- (*last) points to end_of_list
|
||||
- There are no NULLs in the list.
|
||||
- base_list::elements is the number of elements in the list.
|
||||
|
||||
SYNOPSIS
|
||||
check_list()
|
||||
name Name to print to trace file
|
||||
|
||||
RETURN
|
||||
1 The list is Ok.
|
||||
0 List invariants are not met.
|
||||
*/
|
||||
|
||||
bool check_list(const char *name)
|
||||
{
|
||||
base_list *list= this;
|
||||
list_node *node= first;
|
||||
uint cnt= 0;
|
||||
|
||||
while (node->next != &end_of_list)
|
||||
{
|
||||
if (!node->info)
|
||||
{
|
||||
DBUG_PRINT("list_invariants",("%s: error: NULL element in the list",
|
||||
name));
|
||||
return FALSE;
|
||||
}
|
||||
node= node->next;
|
||||
cnt++;
|
||||
}
|
||||
if (last != &(node->next))
|
||||
{
|
||||
DBUG_PRINT("list_invariants", ("%s: error: wrong last pointer", name));
|
||||
return FALSE;
|
||||
}
|
||||
if (cnt+1 != elements)
|
||||
{
|
||||
DBUG_PRINT("list_invariants", ("%s: error: wrong element count", name));
|
||||
return FALSE;
|
||||
}
|
||||
DBUG_PRINT("list_invariants", ("%s: list is ok", name));
|
||||
return TRUE;
|
||||
}
|
||||
#endif // LIST_EXTRA_DEBUG
|
||||
|
||||
protected:
|
||||
void after(void *info,list_node *node)
|
||||
{
|
||||
|
@ -194,7 +194,9 @@ void udf_init()
|
||||
This is done to ensure that only approved dll from the system
|
||||
directories are used (to make this even remotely secure).
|
||||
*/
|
||||
if (strchr(dl_name, '/') || name.length > NAME_LEN)
|
||||
if (strchr(dl_name, '/') ||
|
||||
IF_WIN(strchr(dl_name, '\\'),0) ||
|
||||
strlen(name.str) > NAME_LEN)
|
||||
{
|
||||
sql_print_error("Invalid row in mysql.func table for function '%.64s'",
|
||||
name.str);
|
||||
@ -223,7 +225,7 @@ void udf_init()
|
||||
}
|
||||
tmp->dlhandle = dl;
|
||||
{
|
||||
char buf[MAX_FIELD_NAME+16], *missing;
|
||||
char buf[NAME_LEN+16], *missing;
|
||||
if ((missing= init_syms(tmp, buf)))
|
||||
{
|
||||
sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), missing);
|
||||
@ -410,7 +412,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
This is done to ensure that only approved dll from the system
|
||||
directories are used (to make this even remotely secure).
|
||||
*/
|
||||
if (strchr(udf->dl, '/'))
|
||||
if (strchr(udf->dl, '/') || IF_WIN(strchr(dl_name, '\\'),0))
|
||||
{
|
||||
my_message(ER_UDF_NO_PATHS, ER(ER_UDF_NO_PATHS), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
@ -441,7 +443,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
}
|
||||
udf->dlhandle=dl;
|
||||
{
|
||||
char buf[MAX_FIELD_NAME+16], *missing;
|
||||
char buf[NAME_LEN+16], *missing;
|
||||
if ((missing= init_syms(udf, buf)))
|
||||
{
|
||||
my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), missing);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#define USES_TYPES
|
||||
#include "mysql_priv.h"
|
||||
#include <m_ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define FCOMP 17 /* Bytes for a packed field */
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
#ifndef NDB_LIMITS_H
|
||||
#define NDB_LIMITS_H
|
||||
|
||||
#include <mysql.h>
|
||||
|
||||
#define RNIL 0xffffff00
|
||||
|
||||
/**
|
||||
@ -52,7 +54,7 @@
|
||||
#define MAX_TUPLES_BITS 13 /* 13 bits = 8191 tuples per page */
|
||||
#define MAX_TABLES 20320 /* SchemaFile.hpp */
|
||||
#define MAX_TAB_NAME_SIZE 128
|
||||
#define MAX_ATTR_NAME_SIZE 32
|
||||
#define MAX_ATTR_NAME_SIZE NAME_LEN /* From mysql_com.h */
|
||||
#define MAX_ATTR_DEFAULT_VALUE_SIZE 128
|
||||
#define MAX_ATTRIBUTES_IN_TABLE 128
|
||||
#define MAX_ATTRIBUTES_IN_INDEX 32
|
||||
|
@ -39,22 +39,15 @@ class GetTabInfoReq {
|
||||
friend bool printGET_TABINFO_REQ(FILE *, const Uint32 *, Uint32, Uint16);
|
||||
public:
|
||||
STATIC_CONST( SignalLength = 5 );
|
||||
// STATIC_CONST( MaxTableNameLengthInWords = 20 );
|
||||
public:
|
||||
Uint32 senderData;
|
||||
Uint32 senderRef;
|
||||
|
||||
/**
|
||||
* 0 = request by id, 1 = request by name
|
||||
*/
|
||||
Uint32 requestType;
|
||||
|
||||
Uint32 requestType; // Bitmask of GetTabInfoReq::RequestType
|
||||
union {
|
||||
Uint32 tableId;
|
||||
Uint32 tableNameLen;
|
||||
};
|
||||
Uint32 unused; // This is located here so that Req & Ref have the same format
|
||||
// Uint32 tableName[MaxTableNameLengthInWords];
|
||||
|
||||
enum RequestType {
|
||||
RequestById = 0,
|
||||
@ -79,11 +72,10 @@ class GetTabInfoRef {
|
||||
friend bool printGET_TABINFO_REF(FILE *, const Uint32 *, Uint32, Uint16);
|
||||
public:
|
||||
STATIC_CONST( SignalLength = 5 );
|
||||
|
||||
public:
|
||||
Uint32 senderData;
|
||||
Uint32 senderRef;
|
||||
Uint32 requestType; // 0 = request by id, 1 = request by name
|
||||
Uint32 requestType; // Bitmask of GetTabInfoReq::RequestType
|
||||
union {
|
||||
Uint32 tableId;
|
||||
Uint32 tableNameLen;
|
||||
@ -91,10 +83,10 @@ public:
|
||||
Uint32 errorCode;
|
||||
|
||||
enum ErrorCode {
|
||||
InvalidTableId = 709,
|
||||
InvalidTableId = 709,
|
||||
TableNotDefined = 723,
|
||||
TableNameTooLong = 702,
|
||||
Busy = 701
|
||||
Busy = 701
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -999,10 +999,6 @@ typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*);
|
||||
#define WAITFOR_RESPONSE_TIMEOUT 120000 // Milliseconds
|
||||
#endif
|
||||
|
||||
#define NDB_MAX_INTERNAL_TABLE_LENGTH NDB_MAX_DATABASE_NAME_SIZE + \
|
||||
NDB_MAX_SCHEMA_NAME_SIZE + \
|
||||
NDB_MAX_TAB_NAME_SIZE*2
|
||||
|
||||
/**
|
||||
* @class Ndb
|
||||
* @brief Represents the NDB kernel and is the main class of the NDB API.
|
||||
@ -1626,12 +1622,7 @@ private:
|
||||
|
||||
bool fullyQualifiedNames;
|
||||
|
||||
// Ndb database name.
|
||||
char theDataBase[NDB_MAX_DATABASE_NAME_SIZE];
|
||||
// Ndb database schema name.
|
||||
char theDataBaseSchema[NDB_MAX_SCHEMA_NAME_SIZE];
|
||||
char prefixName[NDB_MAX_INTERNAL_TABLE_LENGTH];
|
||||
char * prefixEnd;
|
||||
|
||||
|
||||
class NdbImpl * theImpl;
|
||||
class NdbDictionaryImpl* theDictionary;
|
||||
|
@ -19,10 +19,6 @@
|
||||
|
||||
#define NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY 32
|
||||
#define NDB_MAX_ATTRIBUTES_IN_INDEX NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY
|
||||
#define NDB_MAX_DATABASE_NAME_SIZE 128
|
||||
#define NDB_MAX_SCHEMA_NAME_SIZE 128
|
||||
#define NDB_MAX_TAB_NAME_SIZE 128
|
||||
#define NDB_MAX_ATTR_NAME_SIZE 32
|
||||
#define NDB_MAX_ATTRIBUTES_IN_TABLE 128
|
||||
|
||||
#define NDB_MAX_TUPLE_SIZE_IN_WORDS 2013
|
||||
|
@ -45,8 +45,9 @@ enum SendStatus {
|
||||
* Protocol6 Header +
|
||||
* (optional signal id) + (optional checksum) + (signal data)
|
||||
*/
|
||||
const Uint32 MAX_SECTION_SIZE= 4096;
|
||||
//const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25));
|
||||
const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25)+(3*4)+4*4096);
|
||||
const Uint32 MAX_MESSAGE_SIZE = (12+4+4+(4*25)+(3*4)+4*MAX_SECTION_SIZE);
|
||||
|
||||
/**
|
||||
* TransporterConfiguration
|
||||
|
@ -93,6 +93,7 @@ TransporterRegistry::unpack(Uint32 * readPtr,
|
||||
signalHeader.theSendersSignalId = * signalData;
|
||||
signalData ++;
|
||||
}//if
|
||||
signalHeader.theSignalId= ~0;
|
||||
|
||||
Uint32 * sectionPtr = signalData + signalHeader.theLength;
|
||||
Uint32 * sectionData = sectionPtr + signalHeader.m_noOfSections;
|
||||
|
@ -799,11 +799,7 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){
|
||||
request->error = errno;
|
||||
return;
|
||||
}
|
||||
#if defined(__INTEL_COMPILER)
|
||||
struct dirent64 * dp;
|
||||
#else
|
||||
struct dirent * dp;
|
||||
#endif
|
||||
while ((dp = readdir(dirp)) != NULL){
|
||||
if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0)) {
|
||||
BaseString::snprintf(path_add, (size_t)path_max_copy, "%s%s",
|
||||
|
@ -1041,39 +1041,31 @@ convertEndian(Uint32 Data)
|
||||
}
|
||||
const char * Ndb::getCatalogName() const
|
||||
{
|
||||
return theDataBase;
|
||||
return theImpl->m_dbname.c_str();
|
||||
}
|
||||
|
||||
|
||||
void Ndb::setCatalogName(const char * a_catalog_name)
|
||||
{
|
||||
if (a_catalog_name) {
|
||||
BaseString::snprintf(theDataBase, sizeof(theDataBase), "%s",
|
||||
a_catalog_name ? a_catalog_name : "");
|
||||
|
||||
int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
|
||||
theDataBase, table_name_separator,
|
||||
theDataBaseSchema, table_name_separator);
|
||||
prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len :
|
||||
sizeof(prefixName) - 1);
|
||||
if (a_catalog_name)
|
||||
{
|
||||
theImpl->m_dbname.assign(a_catalog_name);
|
||||
theImpl->update_prefix();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char * Ndb::getSchemaName() const
|
||||
{
|
||||
return theDataBaseSchema;
|
||||
return theImpl->m_schemaname.c_str();
|
||||
}
|
||||
|
||||
|
||||
void Ndb::setSchemaName(const char * a_schema_name)
|
||||
{
|
||||
if (a_schema_name) {
|
||||
BaseString::snprintf(theDataBaseSchema, sizeof(theDataBase), "%s",
|
||||
a_schema_name ? a_schema_name : "");
|
||||
|
||||
int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
|
||||
theDataBase, table_name_separator,
|
||||
theDataBaseSchema, table_name_separator);
|
||||
prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len :
|
||||
sizeof(prefixName) - 1);
|
||||
theImpl->m_schemaname.assign(a_schema_name);
|
||||
theImpl->update_prefix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1153,10 +1145,8 @@ Ndb::externalizeIndexName(const char * internalIndexName)
|
||||
const char *
|
||||
Ndb::internalizeTableName(const char * externalTableName)
|
||||
{
|
||||
if (fullyQualifiedNames) {
|
||||
strncpy(prefixEnd, externalTableName, NDB_MAX_TAB_NAME_SIZE);
|
||||
return prefixName;
|
||||
}
|
||||
if (fullyQualifiedNames)
|
||||
return theImpl->internalize_table_name(externalTableName);
|
||||
else
|
||||
return externalTableName;
|
||||
}
|
||||
@ -1165,16 +1155,8 @@ const char *
|
||||
Ndb::internalizeIndexName(const NdbTableImpl * table,
|
||||
const char * externalIndexName)
|
||||
{
|
||||
if (fullyQualifiedNames) {
|
||||
char tableId[10];
|
||||
sprintf(tableId, "%d", table->m_tableId);
|
||||
Uint32 tabIdLen = strlen(tableId);
|
||||
strncpy(prefixEnd, tableId, tabIdLen);
|
||||
prefixEnd[tabIdLen] = table_name_separator;
|
||||
strncpy(prefixEnd + tabIdLen + 1,
|
||||
externalIndexName, NDB_MAX_TAB_NAME_SIZE);
|
||||
return prefixName;
|
||||
}
|
||||
if (fullyQualifiedNames)
|
||||
return theImpl->internalize_index_name(table, externalIndexName);
|
||||
else
|
||||
return externalIndexName;
|
||||
}
|
||||
|
@ -172,6 +172,7 @@ NdbColumnImpl::init(Type t)
|
||||
m_length = 1; // legal
|
||||
m_cs = NULL;
|
||||
break;
|
||||
default:
|
||||
case Undefined:
|
||||
assert(false);
|
||||
break;
|
||||
@ -299,22 +300,25 @@ NdbTableImpl::~NdbTableImpl()
|
||||
|
||||
void
|
||||
NdbTableImpl::init(){
|
||||
clearNewProperties();
|
||||
m_changeMask= 0;
|
||||
m_tableId= RNIL;
|
||||
m_frm.clear();
|
||||
m_fragmentType = NdbDictionary::Object::FragAllSmall;
|
||||
m_logging = true;
|
||||
m_kvalue = 6;
|
||||
m_minLoadFactor = 78;
|
||||
m_maxLoadFactor = 80;
|
||||
|
||||
m_index = 0;
|
||||
m_indexType = NdbDictionary::Index::Undefined;
|
||||
|
||||
m_noOfKeys = 0;
|
||||
m_noOfDistributionKeys = 0;
|
||||
m_fragmentCount = 0;
|
||||
m_keyLenInWords = 0;
|
||||
m_noOfBlobs = 0;
|
||||
m_fragmentType= NdbDictionary::Object::FragAllSmall;
|
||||
m_hashValueMask= 0;
|
||||
m_hashpointerValue= 0;
|
||||
m_logging= true;
|
||||
m_kvalue= 6;
|
||||
m_minLoadFactor= 78;
|
||||
m_maxLoadFactor= 80;
|
||||
m_keyLenInWords= 0;
|
||||
m_fragmentCount= 0;
|
||||
m_dictionary= NULL;
|
||||
m_index= NULL;
|
||||
m_indexType= NdbDictionary::Index::Undefined;
|
||||
m_noOfKeys= 0;
|
||||
m_noOfDistributionKeys= 0;
|
||||
m_noOfBlobs= 0;
|
||||
m_replicaCount= 0;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -428,19 +432,6 @@ NdbTableImpl::getName() const
|
||||
return m_newExternalName.c_str();
|
||||
}
|
||||
|
||||
void NdbTableImpl::clearNewProperties()
|
||||
{
|
||||
m_newExternalName.assign("");
|
||||
m_changeMask = 0;
|
||||
}
|
||||
|
||||
void NdbTableImpl::copyNewProperties()
|
||||
{
|
||||
if (!m_newExternalName.empty()) {
|
||||
m_externalName.assign(m_newExternalName);
|
||||
AlterTableReq::setNameFlag(m_changeMask, true);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NdbTableImpl::buildColumnHash(){
|
||||
@ -537,14 +528,22 @@ NdbIndexImpl::NdbIndexImpl() :
|
||||
NdbDictionary::Index(* this),
|
||||
m_facade(this)
|
||||
{
|
||||
m_logging = true;
|
||||
init();
|
||||
}
|
||||
|
||||
NdbIndexImpl::NdbIndexImpl(NdbDictionary::Index & f) :
|
||||
NdbDictionary::Index(* this),
|
||||
m_facade(&f)
|
||||
{
|
||||
m_logging = true;
|
||||
init();
|
||||
}
|
||||
|
||||
void NdbIndexImpl::init()
|
||||
{
|
||||
m_indexId= RNIL;
|
||||
m_type= NdbDictionary::Index::Undefined;
|
||||
m_logging= true;
|
||||
m_table= NULL;
|
||||
}
|
||||
|
||||
NdbIndexImpl::~NdbIndexImpl(){
|
||||
@ -589,20 +588,26 @@ NdbEventImpl::NdbEventImpl() :
|
||||
NdbDictionary::Event(* this),
|
||||
m_facade(this)
|
||||
{
|
||||
mi_type = 0;
|
||||
m_dur = NdbDictionary::Event::ED_UNDEFINED;
|
||||
eventOp = NULL;
|
||||
m_tableImpl = NULL;
|
||||
init();
|
||||
}
|
||||
|
||||
NdbEventImpl::NdbEventImpl(NdbDictionary::Event & f) :
|
||||
NdbDictionary::Event(* this),
|
||||
m_facade(&f)
|
||||
{
|
||||
mi_type = 0;
|
||||
m_dur = NdbDictionary::Event::ED_UNDEFINED;
|
||||
eventOp = NULL;
|
||||
m_tableImpl = NULL;
|
||||
init();
|
||||
}
|
||||
|
||||
void NdbEventImpl::init()
|
||||
{
|
||||
m_eventId= RNIL;
|
||||
m_eventKey= RNIL;
|
||||
m_tableId= RNIL;
|
||||
mi_type= 0;
|
||||
m_dur= NdbDictionary::Event::ED_UNDEFINED;
|
||||
m_tableImpl= NULL;
|
||||
m_bufferId= RNIL;
|
||||
eventOp= NULL;
|
||||
}
|
||||
|
||||
NdbEventImpl::~NdbEventImpl()
|
||||
@ -715,11 +720,13 @@ NdbDictionaryImpl::~NdbDictionaryImpl()
|
||||
delete NdbDictionary::Column::ROW_COUNT;
|
||||
delete NdbDictionary::Column::COMMIT_COUNT;
|
||||
delete NdbDictionary::Column::ROW_SIZE;
|
||||
delete NdbDictionary::Column::RANGE_NO;
|
||||
NdbDictionary::Column::FRAGMENT= 0;
|
||||
NdbDictionary::Column::FRAGMENT_MEMORY= 0;
|
||||
NdbDictionary::Column::ROW_COUNT= 0;
|
||||
NdbDictionary::Column::COMMIT_COUNT= 0;
|
||||
NdbDictionary::Column::ROW_SIZE= 0;
|
||||
NdbDictionary::Column::RANGE_NO= 0;
|
||||
}
|
||||
m_globalHash->unlock();
|
||||
} else {
|
||||
@ -1049,14 +1056,17 @@ NdbDictInterface::dictSignal(NdbApiSignal* signal,
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* get tab info
|
||||
/*
|
||||
Get dictionary information for a table using table id as reference
|
||||
|
||||
DESCRIPTION
|
||||
Sends a GET_TABINFOREQ signal containing the table id
|
||||
*/
|
||||
NdbTableImpl *
|
||||
NdbDictInterface::getTable(int tableId, bool fullyQualifiedNames)
|
||||
{
|
||||
NdbApiSignal tSignal(m_reference);
|
||||
GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
|
||||
GetTabInfoReq* const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
|
||||
|
||||
req->senderRef = m_reference;
|
||||
req->senderData = 0;
|
||||
@ -1070,40 +1080,56 @@ NdbDictInterface::getTable(int tableId, bool fullyQualifiedNames)
|
||||
return getTable(&tSignal, 0, 0, fullyQualifiedNames);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Get dictionary information for a table using table name as the reference
|
||||
|
||||
DESCRIPTION
|
||||
Send GET_TABINFOREQ signal with the table name in the first
|
||||
long section part
|
||||
*/
|
||||
|
||||
NdbTableImpl *
|
||||
NdbDictInterface::getTable(const char * name, bool fullyQualifiedNames)
|
||||
{
|
||||
NdbApiSignal tSignal(m_reference);
|
||||
GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
|
||||
GetTabInfoReq* const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
|
||||
|
||||
const Uint32 strLen = strlen(name) + 1; // NULL Terminated
|
||||
if(strLen > MAX_TAB_NAME_SIZE) {//sizeof(req->tableName)){
|
||||
const Uint32 str_len= strlen(name) + 1; // NULL terminated
|
||||
const Uint32 str_len_words= (str_len + 3) / 4; // Size in words
|
||||
|
||||
if (str_len > MAX_SECTION_SIZE)
|
||||
{
|
||||
m_error.code= 4307;
|
||||
return 0;
|
||||
}
|
||||
|
||||
req->senderRef = m_reference;
|
||||
req->senderData = 0;
|
||||
req->requestType =
|
||||
m_namebuf.clear();
|
||||
m_namebuf.grow(str_len_words*4); // Word size aligned number of bytes
|
||||
m_namebuf.append(name, str_len);
|
||||
|
||||
req->senderRef= m_reference;
|
||||
req->senderData= 0;
|
||||
req->requestType=
|
||||
GetTabInfoReq::RequestByName | GetTabInfoReq::LongSignalConf;
|
||||
req->tableNameLen = strLen;
|
||||
tSignal.theReceiversBlockNumber = DBDICT;
|
||||
tSignal.theVerId_signalNumber = GSN_GET_TABINFOREQ;
|
||||
// tSignal.theLength = GetTabInfoReq::HeaderLength + ((strLen + 3) / 4);
|
||||
tSignal.theLength = GetTabInfoReq::SignalLength;
|
||||
req->tableNameLen= str_len;
|
||||
tSignal.theReceiversBlockNumber= DBDICT;
|
||||
tSignal.theVerId_signalNumber= GSN_GET_TABINFOREQ;
|
||||
tSignal.theLength= GetTabInfoReq::SignalLength;
|
||||
|
||||
LinearSectionPtr ptr[1];
|
||||
ptr[0].p = (Uint32*)name;
|
||||
ptr[0].sz = strLen;
|
||||
ptr[0].p= (Uint32*)m_namebuf.get_data();
|
||||
ptr[0].sz= str_len_words;
|
||||
|
||||
return getTable(&tSignal, ptr, 1, fullyQualifiedNames);
|
||||
}
|
||||
|
||||
|
||||
NdbTableImpl *
|
||||
NdbDictInterface::getTable(class NdbApiSignal * signal,
|
||||
LinearSectionPtr ptr[3],
|
||||
Uint32 noOfSections, bool fullyQualifiedNames)
|
||||
{
|
||||
//GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, signal->getDataPtrSend());
|
||||
int errCodes[] = {GetTabInfoRef::Busy };
|
||||
|
||||
int r = dictSignal(signal,ptr,noOfSections,
|
||||
@ -1464,7 +1490,7 @@ NdbDictionaryImpl::createBlobTables(NdbTableImpl &t)
|
||||
return -1;
|
||||
// Save BLOB table handle
|
||||
Ndb_local_table_info *info=
|
||||
get_local_table_info(bt.m_internalName.c_str(),false);
|
||||
get_local_table_info(bt.m_internalName.c_str(), false);
|
||||
if (info == 0) {
|
||||
return -1;
|
||||
}
|
||||
@ -1560,7 +1586,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
impl.copyNewProperties();
|
||||
if (!impl.m_newExternalName.empty()) {
|
||||
impl.m_externalName.assign(impl.m_newExternalName);
|
||||
AlterTableReq::setNameFlag(impl.m_changeMask, true);
|
||||
}
|
||||
|
||||
//validate();
|
||||
//aggregate();
|
||||
|
||||
@ -1677,7 +1707,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
|
||||
NdbApiSignal tSignal(m_reference);
|
||||
tSignal.theReceiversBlockNumber = DBDICT;
|
||||
|
||||
LinearSectionPtr ptr[3];
|
||||
LinearSectionPtr ptr[1];
|
||||
ptr[0].p = (Uint32*)m_buffer.get_data();
|
||||
ptr[0].sz = m_buffer.length() / 4;
|
||||
int ret;
|
||||
@ -2182,7 +2212,7 @@ NdbDictInterface::createIndex(Ndb & ndb,
|
||||
}
|
||||
attributeList.id[i] = col->m_attrId;
|
||||
}
|
||||
LinearSectionPtr ptr[3];
|
||||
LinearSectionPtr ptr[2];
|
||||
ptr[0].p = (Uint32*)&attributeList;
|
||||
ptr[0].sz = 1 + attributeList.sz;
|
||||
ptr[1].p = (Uint32*)m_buffer.get_data();
|
||||
@ -2489,7 +2519,7 @@ NdbDictInterface::createEvent(class Ndb & ndb,
|
||||
w.add(SimpleProperties::StringValue,
|
||||
ndb.internalizeTableName(evnt.m_tableName.c_str()));
|
||||
|
||||
LinearSectionPtr ptr[3];
|
||||
LinearSectionPtr ptr[1];
|
||||
ptr[0].p = (Uint32*)m_buffer.get_data();
|
||||
ptr[0].sz = (m_buffer.length()+3) >> 2;
|
||||
|
||||
|
@ -161,8 +161,6 @@ public:
|
||||
*/
|
||||
bool equal(const NdbTableImpl&) const;
|
||||
void assign(const NdbTableImpl&);
|
||||
void clearNewProperties();
|
||||
void copyNewProperties();
|
||||
|
||||
static NdbTableImpl & getImpl(NdbDictionary::Table & t);
|
||||
static NdbTableImpl & getImpl(const NdbDictionary::Table & t);
|
||||
@ -180,6 +178,7 @@ public:
|
||||
NdbIndexImpl(NdbDictionary::Index &);
|
||||
~NdbIndexImpl();
|
||||
|
||||
void init();
|
||||
void setName(const char * name);
|
||||
const char * getName() const;
|
||||
void setTable(const char * table);
|
||||
@ -209,6 +208,7 @@ public:
|
||||
NdbEventImpl(NdbDictionary::Event &);
|
||||
~NdbEventImpl();
|
||||
|
||||
void init();
|
||||
void setName(const char * name);
|
||||
const char * getName() const;
|
||||
void setTable(const NdbDictionary::Table& table);
|
||||
@ -368,6 +368,8 @@ private:
|
||||
|
||||
Uint32 m_fragmentId;
|
||||
UtilBuffer m_buffer;
|
||||
// Buffer used when requesting a table by name
|
||||
UtilBuffer m_namebuf;
|
||||
};
|
||||
|
||||
class NdbDictionaryImpl : public NdbDictionary::Dictionary {
|
||||
@ -560,7 +562,7 @@ NdbTableImpl::getColumn(const char * name){
|
||||
do {
|
||||
if(hashValue == (tmp & 0xFFFE)){
|
||||
NdbColumnImpl* col = cols[tmp >> 16];
|
||||
if(strncmp(name, col->m_name.c_str(), NDB_MAX_ATTR_NAME_SIZE-1) == 0){
|
||||
if(strncmp(name, col->m_name.c_str(), col->m_name.length()) == 0){
|
||||
return col;
|
||||
}
|
||||
}
|
||||
@ -578,7 +580,7 @@ NdbTableImpl::getColumn(const char * name){
|
||||
} else {
|
||||
for(Uint32 i = 0; i<sz; i++){
|
||||
NdbColumnImpl* col = * cols++;
|
||||
if(col != 0 && strncmp(name, col->m_name.c_str(), NDB_MAX_ATTR_NAME_SIZE-1) == 0)
|
||||
if(col != 0 && strcmp(name, col->m_name.c_str()) == 0)
|
||||
return col;
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,37 @@ public:
|
||||
NdbWaiter theWaiter;
|
||||
|
||||
int m_optimized_node_selection;
|
||||
|
||||
|
||||
BaseString m_dbname; // Database name
|
||||
BaseString m_schemaname; // Schema name
|
||||
|
||||
BaseString m_prefix; // Buffer for preformatted internal name <db>/<schema>/
|
||||
BaseString m_internalname;
|
||||
|
||||
void update_prefix()
|
||||
{
|
||||
m_prefix.assfmt("%s%c%s%c", m_dbname.c_str(), table_name_separator,
|
||||
m_schemaname.c_str(), table_name_separator);
|
||||
}
|
||||
|
||||
const char* internalize_table_name(const char* ext_name)
|
||||
{
|
||||
// Internal table name format <db>/<schema>/<table>
|
||||
return m_internalname.assign(m_prefix).append(ext_name).c_str();
|
||||
}
|
||||
|
||||
const char* internalize_index_name(const NdbTableImpl *table,
|
||||
const char* ext_name)
|
||||
{
|
||||
// Internal index name format <db>/<schema>/<tabid>/<table>
|
||||
return m_internalname.assign(m_prefix).appfmt("%d%c%s",
|
||||
table->m_tableId,
|
||||
table_name_separator,
|
||||
ext_name).c_str();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#ifdef VM_TRACE
|
||||
|
@ -62,7 +62,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
|
||||
theNoOfAllocatedTransactions= 0;
|
||||
theMaxNoOfTransactions= 0;
|
||||
theMinNoOfEventsToWakeUp= 0;
|
||||
prefixEnd= NULL;
|
||||
theConIdleList= NULL;
|
||||
theOpIdleList= NULL;
|
||||
theScanOpIdleList= NULL;
|
||||
@ -110,16 +109,9 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
|
||||
theLastTupleId[i] = 0;
|
||||
}//for
|
||||
|
||||
BaseString::snprintf(theDataBase, sizeof(theDataBase), "%s",
|
||||
aDataBase ? aDataBase : "");
|
||||
BaseString::snprintf(theDataBaseSchema, sizeof(theDataBaseSchema), "%s",
|
||||
aSchema ? aSchema : "");
|
||||
|
||||
int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c",
|
||||
theDataBase, table_name_separator,
|
||||
theDataBaseSchema, table_name_separator);
|
||||
prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len :
|
||||
sizeof(prefixName) - 1);
|
||||
theImpl->m_dbname.assign(aDataBase);
|
||||
theImpl->m_schemaname.assign(aSchema);
|
||||
theImpl->update_prefix();
|
||||
|
||||
theImpl->theWaiter.m_mutex = TransporterFacade::instance()->theMutexPtr;
|
||||
|
||||
|
@ -265,14 +265,11 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
|
||||
m_connect_callback= 0;
|
||||
|
||||
if (ndb_global_event_buffer_mutex == NULL)
|
||||
{
|
||||
ndb_global_event_buffer_mutex= NdbMutex_Create();
|
||||
}
|
||||
|
||||
#ifdef VM_TRACE
|
||||
if (ndb_print_state_mutex == NULL)
|
||||
{
|
||||
ndb_print_state_mutex= NdbMutex_Create();
|
||||
}
|
||||
#endif
|
||||
m_config_retriever=
|
||||
new ConfigRetriever(connect_string, NDB_VERSION, NODE_TYPE_API);
|
||||
@ -294,7 +291,6 @@ Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
|
||||
Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl()
|
||||
{
|
||||
DBUG_ENTER("~Ndb_cluster_connection");
|
||||
DBUG_PRINT("enter",("~Ndb_cluster_connection this=0x%x", this));
|
||||
TransporterFacade::stop_instance();
|
||||
if (m_connect_thread)
|
||||
{
|
||||
@ -312,10 +308,22 @@ Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl()
|
||||
TransporterFacade::theFacadeInstance= 0;
|
||||
}
|
||||
if (m_config_retriever)
|
||||
{
|
||||
delete m_config_retriever;
|
||||
|
||||
// fragmentToNodeMap.release();
|
||||
|
||||
m_config_retriever= NULL;
|
||||
}
|
||||
if (ndb_global_event_buffer_mutex != NULL)
|
||||
{
|
||||
NdbMutex_Destroy(ndb_global_event_buffer_mutex);
|
||||
ndb_global_event_buffer_mutex= NULL;
|
||||
}
|
||||
#ifdef VM_TRACE
|
||||
if (ndb_print_state_mutex != NULL)
|
||||
{
|
||||
NdbMutex_Destroy(ndb_print_state_mutex);
|
||||
ndb_print_state_mutex= NULL;
|
||||
}
|
||||
#endif
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,9 @@
|
||||
|
||||
INCLUDES=-I$(top_srcdir)/include $(openssl_includes) \
|
||||
-I$(top_builddir)/include
|
||||
LDADD= @CLIENT_EXTRA_LDFLAGS@ @openssl_libs@ \
|
||||
$(top_builddir)/libmysql_r/libmysqlclient_r.la @ZLIB_LIBS@
|
||||
LDADD= @CLIENT_EXTRA_LDFLAGS@ \
|
||||
$(top_builddir)/libmysql_r/libmysqlclient_r.la \
|
||||
@openssl_libs@ @ZLIB_LIBS@
|
||||
bin_PROGRAMS= mysqltestmanager
|
||||
mysqltestmanager_SOURCES= mysqlmanager.c
|
||||
mysqltestmanager_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
|
||||
|
Reference in New Issue
Block a user