Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
9647a076
Commit
9647a076
authored
Jan 03, 2005
by
mskold@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
31360fb0
e2051361
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
157 additions
and
112 deletions
+157
-112
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+9
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+3
-0
mysql-test/t/trigger.test
mysql-test/t/trigger.test
+2
-0
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+54
-31
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+1
-1
sql/item_strfunc.cc
sql/item_strfunc.cc
+46
-30
sql/sql_base.cc
sql/sql_base.cc
+1
-0
sql/sql_insert.cc
sql/sql_insert.cc
+0
-2
sql/sql_parse.cc
sql/sql_parse.cc
+0
-3
sql/sql_prepare.cc
sql/sql_prepare.cc
+11
-3
sql/table.cc
sql/table.cc
+0
-20
sql/table.h
sql/table.h
+0
-1
tests/client_test.c
tests/client_test.c
+29
-21
No files found.
BitKeeper/etc/logging_ok
View file @
9647a076
...
@@ -111,6 +111,7 @@ lenz@mysql.com
...
@@ -111,6 +111,7 @@ lenz@mysql.com
magnus@neptunus.(none)
magnus@neptunus.(none)
magnus@shellback.(none)
magnus@shellback.(none)
marko@hundin.mysql.fi
marko@hundin.mysql.fi
marty@linux.site
marty@shark.
marty@shark.
mats@mysql.com
mats@mysql.com
matt@booty.(none)
matt@booty.(none)
...
...
mysql-test/r/func_str.result
View file @
9647a076
...
@@ -48,6 +48,9 @@ tcx.se .se
...
@@ -48,6 +48,9 @@ tcx.se .se
select concat(':',ltrim(' left '),':',rtrim(' right '),':');
select concat(':',ltrim(' left '),':',rtrim(' right '),':');
concat(':',ltrim(' left '),':',rtrim(' right '),':')
concat(':',ltrim(' left '),':',rtrim(' right '),':')
:left : right:
:left : right:
select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':');
concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':')
:left : right:
select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':');
select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':');
concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':')
concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':')
:left: right:
:left: right:
...
@@ -703,3 +706,9 @@ NULL
...
@@ -703,3 +706,9 @@ NULL
select trim('xyz' from null) as "must_be_null";
select trim('xyz' from null) as "must_be_null";
must_be_null
must_be_null
NULL
NULL
select trim(leading NULL from 'kate') as "must_be_null";
must_be_null
NULL
select trim(trailing NULL from 'xyz') as "must_be_null";
must_be_null
NULL
mysql-test/t/func_str.test
View file @
9647a076
...
@@ -25,6 +25,7 @@ select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',
...
@@ -25,6 +25,7 @@ select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',
select
substring_index
(
'.tcx.se'
,
'.'
,
-
2
),
substring_index
(
'.tcx.se'
,
'.tcx'
,
-
1
);
select
substring_index
(
'.tcx.se'
,
'.'
,
-
2
),
substring_index
(
'.tcx.se'
,
'.tcx'
,
-
1
);
select
concat
(
':'
,
ltrim
(
' left '
),
':'
,
rtrim
(
' right '
),
':'
);
select
concat
(
':'
,
ltrim
(
' left '
),
':'
,
rtrim
(
' right '
),
':'
);
select
concat
(
':'
,
trim
(
leading
from
' left '
),
':'
,
trim
(
trailing
from
' right '
),
':'
);
select
concat
(
':'
,
trim
(
LEADING
FROM
' left'
),
':'
,
trim
(
TRAILING
FROM
' right '
),
':'
);
select
concat
(
':'
,
trim
(
LEADING
FROM
' left'
),
':'
,
trim
(
TRAILING
FROM
' right '
),
':'
);
select
concat
(
':'
,
trim
(
' m '
),
':'
,
trim
(
BOTH
FROM
' y '
),
':'
,
trim
(
'*'
FROM
'*s*'
),
':'
);
select
concat
(
':'
,
trim
(
' m '
),
':'
,
trim
(
BOTH
FROM
' y '
),
':'
,
trim
(
'*'
FROM
'*s*'
),
':'
);
select
concat
(
':'
,
trim
(
BOTH
'ab'
FROM
'ababmyabab'
),
':'
,
trim
(
BOTH
'*'
FROM
'***sql'
),
':'
);
select
concat
(
':'
,
trim
(
BOTH
'ab'
FROM
'ababmyabab'
),
':'
,
trim
(
BOTH
'*'
FROM
'***sql'
),
':'
);
...
@@ -443,3 +444,5 @@ select quote(trim(concat(' ', 'a')));
...
@@ -443,3 +444,5 @@ select quote(trim(concat(' ', 'a')));
#
#
select
trim
(
null
from
'kate'
)
as
"must_be_null"
;
select
trim
(
null
from
'kate'
)
as
"must_be_null"
;
select
trim
(
'xyz'
from
null
)
as
"must_be_null"
;
select
trim
(
'xyz'
from
null
)
as
"must_be_null"
;
select
trim
(
leading
NULL
from
'kate'
)
as
"must_be_null"
;
select
trim
(
trailing
NULL
from
'xyz'
)
as
"must_be_null"
;
mysql-test/t/trigger.test
View file @
9647a076
...
@@ -53,6 +53,7 @@ select @a;
...
@@ -53,6 +53,7 @@ select @a;
drop
trigger
t1
.
trg
;
drop
trigger
t1
.
trg
;
drop
table
t1
;
drop
table
t1
;
--
disable_ps_protocol
# Before update trigger
# Before update trigger
# (In future we will achieve this via proper error handling in triggers)
# (In future we will achieve this via proper error handling in triggers)
create
table
t1
(
aid
int
not
null
primary
key
,
balance
int
not
null
default
0
);
create
table
t1
(
aid
int
not
null
primary
key
,
balance
int
not
null
default
0
);
...
@@ -74,6 +75,7 @@ select * from t1|
...
@@ -74,6 +75,7 @@ select * from t1|
drop
trigger
t1
.
trg
|
drop
trigger
t1
.
trg
|
drop
table
t1
|
drop
table
t1
|
delimiter
;
|
delimiter
;
|
--
enable_ps_protocol
# After update trigger
# After update trigger
create
table
t1
(
i
int
);
create
table
t1
(
i
int
);
...
...
sql/ha_ndbcluster.cc
View file @
9647a076
...
@@ -213,6 +213,13 @@ Thd_ndb::~Thd_ndb()
...
@@ -213,6 +213,13 @@ Thd_ndb::~Thd_ndb()
{
{
if
(
ndb
)
if
(
ndb
)
delete
ndb
;
delete
ndb
;
ndb
=
0
;
}
inline
Ndb
*
ha_ndbcluster
::
get_ndb
()
{
return
((
Thd_ndb
*
)
current_thd
->
transaction
.
thd_ndb
)
->
ndb
;
}
}
/*
/*
...
@@ -246,8 +253,9 @@ void ha_ndbcluster::records_update()
...
@@ -246,8 +253,9 @@ void ha_ndbcluster::records_update()
info
->
no_uncommitted_rows_count
));
info
->
no_uncommitted_rows_count
));
// if (info->records == ~(ha_rows)0)
// if (info->records == ~(ha_rows)0)
{
{
Ndb
*
ndb
=
get_ndb
();
Uint64
rows
;
Uint64
rows
;
if
(
ndb_get_table_statistics
(
m_
ndb
,
m_tabname
,
&
rows
,
0
)
==
0
){
if
(
ndb_get_table_statistics
(
ndb
,
m_tabname
,
&
rows
,
0
)
==
0
){
info
->
records
=
rows
;
info
->
records
=
rows
;
}
}
}
}
...
@@ -332,7 +340,8 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans)
...
@@ -332,7 +340,8 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans)
switch
(
err
.
classification
)
{
switch
(
err
.
classification
)
{
case
NdbError
:
:
SchemaError
:
case
NdbError
:
:
SchemaError
:
{
{
NDBDICT
*
dict
=
m_ndb
->
getDictionary
();
Ndb
*
ndb
=
get_ndb
();
NDBDICT
*
dict
=
ndb
->
getDictionary
();
DBUG_PRINT
(
"info"
,
(
"invalidateTable %s"
,
m_tabname
));
DBUG_PRINT
(
"info"
,
(
"invalidateTable %s"
,
m_tabname
));
dict
->
invalidateTable
(
m_tabname
);
dict
->
invalidateTable
(
m_tabname
);
table
->
version
=
0L
;
/* Free when thread is ready */
table
->
version
=
0L
;
/* Free when thread is ready */
...
@@ -362,7 +371,7 @@ bool ha_ndbcluster::get_error_message(int error,
...
@@ -362,7 +371,7 @@ bool ha_ndbcluster::get_error_message(int error,
DBUG_ENTER
(
"ha_ndbcluster::get_error_message"
);
DBUG_ENTER
(
"ha_ndbcluster::get_error_message"
);
DBUG_PRINT
(
"enter"
,
(
"error: %d"
,
error
));
DBUG_PRINT
(
"enter"
,
(
"error: %d"
,
error
));
Ndb
*
ndb
=
((
Thd_ndb
*
)
current_thd
->
transaction
.
thd_ndb
)
->
ndb
;
Ndb
*
ndb
=
get_ndb
()
;
if
(
!
ndb
)
if
(
!
ndb
)
DBUG_RETURN
(
FALSE
);
DBUG_RETURN
(
FALSE
);
...
@@ -722,7 +731,8 @@ bool ha_ndbcluster::uses_blob_value(bool all_fields)
...
@@ -722,7 +731,8 @@ bool ha_ndbcluster::uses_blob_value(bool all_fields)
int
ha_ndbcluster
::
get_metadata
(
const
char
*
path
)
int
ha_ndbcluster
::
get_metadata
(
const
char
*
path
)
{
{
NDBDICT
*
dict
=
m_ndb
->
getDictionary
();
Ndb
*
ndb
=
get_ndb
();
NDBDICT
*
dict
=
ndb
->
getDictionary
();
const
NDBTAB
*
tab
;
const
NDBTAB
*
tab
;
int
error
;
int
error
;
bool
invalidating_ndb_table
=
FALSE
;
bool
invalidating_ndb_table
=
FALSE
;
...
@@ -797,7 +807,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
...
@@ -797,7 +807,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
static
const
char
*
unique_suffix
=
"$unique"
;
static
const
char
*
unique_suffix
=
"$unique"
;
KEY
*
key_info
=
tab
->
key_info
;
KEY
*
key_info
=
tab
->
key_info
;
const
char
**
key_name
=
tab
->
keynames
.
type_names
;
const
char
**
key_name
=
tab
->
keynames
.
type_names
;
NdbDictionary
::
Dictionary
*
dict
=
m_ndb
->
getDictionary
();
Ndb
*
ndb
=
get_ndb
();
NdbDictionary
::
Dictionary
*
dict
=
ndb
->
getDictionary
();
DBUG_ENTER
(
"ha_ndbcluster::build_index_list"
);
DBUG_ENTER
(
"ha_ndbcluster::build_index_list"
);
// Save information about all known indexes
// Save information about all known indexes
...
@@ -1800,7 +1811,8 @@ int ha_ndbcluster::write_row(byte *record)
...
@@ -1800,7 +1811,8 @@ int ha_ndbcluster::write_row(byte *record)
if
(
table
->
primary_key
==
MAX_KEY
)
if
(
table
->
primary_key
==
MAX_KEY
)
{
{
// Table has hidden primary key
// Table has hidden primary key
Uint64
auto_value
=
m_ndb
->
getAutoIncrementValue
((
const
NDBTAB
*
)
m_table
);
Ndb
*
ndb
=
get_ndb
();
Uint64
auto_value
=
ndb
->
getAutoIncrementValue
((
const
NDBTAB
*
)
m_table
);
if
(
set_hidden_key
(
op
,
table
->
fields
,
(
const
byte
*
)
&
auto_value
))
if
(
set_hidden_key
(
op
,
table
->
fields
,
(
const
byte
*
)
&
auto_value
))
ERR_RETURN
(
op
->
getNdbError
());
ERR_RETURN
(
op
->
getNdbError
());
}
}
...
@@ -1877,11 +1889,12 @@ int ha_ndbcluster::write_row(byte *record)
...
@@ -1877,11 +1889,12 @@ int ha_ndbcluster::write_row(byte *record)
}
}
if
((
has_auto_increment
)
&&
(
m_skip_auto_increment
))
if
((
has_auto_increment
)
&&
(
m_skip_auto_increment
))
{
{
Ndb
*
ndb
=
get_ndb
();
Uint64
next_val
=
(
Uint64
)
table
->
next_number_field
->
val_int
()
+
1
;
Uint64
next_val
=
(
Uint64
)
table
->
next_number_field
->
val_int
()
+
1
;
DBUG_PRINT
(
"info"
,
DBUG_PRINT
(
"info"
,
(
"Trying to set next auto increment value to %lu"
,
(
"Trying to set next auto increment value to %lu"
,
(
ulong
)
next_val
));
(
ulong
)
next_val
));
if
(
m_
ndb
->
setAutoIncrementValue
((
const
NDBTAB
*
)
m_table
,
next_val
,
TRUE
))
if
(
ndb
->
setAutoIncrementValue
((
const
NDBTAB
*
)
m_table
,
next_val
,
TRUE
))
DBUG_PRINT
(
"info"
,
DBUG_PRINT
(
"info"
,
(
"Setting next auto increment value to %u"
,
next_val
));
(
"Setting next auto increment value to %u"
,
next_val
));
}
}
...
@@ -2766,9 +2779,12 @@ void ha_ndbcluster::info(uint flag)
...
@@ -2766,9 +2779,12 @@ void ha_ndbcluster::info(uint flag)
}
}
else
else
{
{
Uint64
rows
=
100
;
if
((
my_errno
=
check_ndb_connection
()))
DBUG_VOID_RETURN
;
Ndb
*
ndb
=
get_ndb
();
Uint64
rows
;
if
(
current_thd
->
variables
.
ndb_use_exact_count
)
if
(
current_thd
->
variables
.
ndb_use_exact_count
)
ndb_get_table_statistics
(
m_
ndb
,
m_tabname
,
&
rows
,
0
);
ndb_get_table_statistics
(
ndb
,
m_tabname
,
&
rows
,
0
);
records
=
rows
;
records
=
rows
;
}
}
}
}
...
@@ -3097,6 +3113,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
...
@@ -3097,6 +3113,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
Thd_ndb
*
thd_ndb
=
(
Thd_ndb
*
)
thd
->
transaction
.
thd_ndb
;
Thd_ndb
*
thd_ndb
=
(
Thd_ndb
*
)
thd
->
transaction
.
thd_ndb
;
Ndb
*
ndb
=
thd_ndb
->
ndb
;
DBUG_PRINT
(
"enter"
,
(
"transaction.thd_ndb->lock_count: %d"
,
DBUG_PRINT
(
"enter"
,
(
"transaction.thd_ndb->lock_count: %d"
,
thd_ndb
->
lock_count
));
thd_ndb
->
lock_count
));
...
@@ -3114,9 +3131,9 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
...
@@ -3114,9 +3131,9 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
DBUG_ASSERT
(
!
thd
->
transaction
.
stmt
.
ndb_tid
);
DBUG_ASSERT
(
!
thd
->
transaction
.
stmt
.
ndb_tid
);
DBUG_PRINT
(
"trans"
,(
"Starting transaction stmt"
));
DBUG_PRINT
(
"trans"
,(
"Starting transaction stmt"
));
trans
=
m_
ndb
->
startTransaction
();
trans
=
ndb
->
startTransaction
();
if
(
trans
==
NULL
)
if
(
trans
==
NULL
)
ERR_RETURN
(
m_
ndb
->
getNdbError
());
ERR_RETURN
(
ndb
->
getNdbError
());
no_uncommitted_rows_reset
(
thd
);
no_uncommitted_rows_reset
(
thd
);
thd
->
transaction
.
stmt
.
ndb_tid
=
trans
;
thd
->
transaction
.
stmt
.
ndb_tid
=
trans
;
}
}
...
@@ -3128,9 +3145,9 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
...
@@ -3128,9 +3145,9 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
// A "master" transaction ha not been started yet
// A "master" transaction ha not been started yet
DBUG_PRINT
(
"trans"
,(
"starting transaction, all"
));
DBUG_PRINT
(
"trans"
,(
"starting transaction, all"
));
trans
=
m_
ndb
->
startTransaction
();
trans
=
ndb
->
startTransaction
();
if
(
trans
==
NULL
)
if
(
trans
==
NULL
)
ERR_RETURN
(
m_
ndb
->
getNdbError
());
ERR_RETURN
(
ndb
->
getNdbError
());
no_uncommitted_rows_reset
(
thd
);
no_uncommitted_rows_reset
(
thd
);
/*
/*
...
@@ -3180,7 +3197,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
...
@@ -3180,7 +3197,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
m_retrieve_primary_key
=
FALSE
;
m_retrieve_primary_key
=
FALSE
;
m_ops_pending
=
0
;
m_ops_pending
=
0
;
{
{
NDBDICT
*
dict
=
m_
ndb
->
getDictionary
();
NDBDICT
*
dict
=
ndb
->
getDictionary
();
const
NDBTAB
*
tab
;
const
NDBTAB
*
tab
;
void
*
tab_info
;
void
*
tab_info
;
if
(
!
(
tab
=
dict
->
getTable
(
m_tabname
,
&
tab_info
)))
if
(
!
(
tab
=
dict
->
getTable
(
m_tabname
,
&
tab_info
)))
...
@@ -3207,7 +3224,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
...
@@ -3207,7 +3224,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
We must in this case close the transaction to release resources
We must in this case close the transaction to release resources
*/
*/
DBUG_PRINT
(
"trans"
,(
"ending non-updating transaction"
));
DBUG_PRINT
(
"trans"
,(
"ending non-updating transaction"
));
m_
ndb
->
closeTransaction
(
m_active_trans
);
ndb
->
closeTransaction
(
m_active_trans
);
thd
->
transaction
.
stmt
.
ndb_tid
=
0
;
thd
->
transaction
.
stmt
.
ndb_tid
=
0
;
}
}
}
}
...
@@ -3257,16 +3274,17 @@ int ha_ndbcluster::start_stmt(THD *thd)
...
@@ -3257,16 +3274,17 @@ int ha_ndbcluster::start_stmt(THD *thd)
NdbConnection
*
trans
=
(
NdbConnection
*
)
thd
->
transaction
.
stmt
.
ndb_tid
;
NdbConnection
*
trans
=
(
NdbConnection
*
)
thd
->
transaction
.
stmt
.
ndb_tid
;
if
(
!
trans
){
if
(
!
trans
){
Ndb
*
ndb
=
((
Thd_ndb
*
)
thd
->
transaction
.
thd_ndb
)
->
ndb
;
DBUG_PRINT
(
"trans"
,(
"Starting transaction stmt"
));
DBUG_PRINT
(
"trans"
,(
"Starting transaction stmt"
));
NdbConnection
*
tablock_trans
=
NdbConnection
*
tablock_trans
=
(
NdbConnection
*
)
thd
->
transaction
.
all
.
ndb_tid
;
(
NdbConnection
*
)
thd
->
transaction
.
all
.
ndb_tid
;
DBUG_PRINT
(
"info"
,
(
"tablock_trans: %x"
,
(
uint
)
tablock_trans
));
DBUG_PRINT
(
"info"
,
(
"tablock_trans: %x"
,
(
uint
)
tablock_trans
));
DBUG_ASSERT
(
tablock_trans
);
DBUG_ASSERT
(
tablock_trans
);
// trans=
m_
ndb->hupp(tablock_trans);
// trans= ndb->hupp(tablock_trans);
trans
=
m_
ndb
->
startTransaction
();
trans
=
ndb
->
startTransaction
();
if
(
trans
==
NULL
)
if
(
trans
==
NULL
)
ERR_RETURN
(
m_
ndb
->
getNdbError
());
ERR_RETURN
(
ndb
->
getNdbError
());
no_uncommitted_rows_reset
(
thd
);
no_uncommitted_rows_reset
(
thd
);
thd
->
transaction
.
stmt
.
ndb_tid
=
trans
;
thd
->
transaction
.
stmt
.
ndb_tid
=
trans
;
}
}
...
@@ -3668,7 +3686,8 @@ int ha_ndbcluster::create(const char *name,
...
@@ -3668,7 +3686,8 @@ int ha_ndbcluster::create(const char *name,
DBUG_RETURN
(
my_errno
);
DBUG_RETURN
(
my_errno
);
// Create the table in NDB
// Create the table in NDB
NDBDICT
*
dict
=
m_ndb
->
getDictionary
();
Ndb
*
ndb
=
get_ndb
();
NDBDICT
*
dict
=
ndb
->
getDictionary
();
if
(
dict
->
createTable
(
tab
)
!=
0
)
if
(
dict
->
createTable
(
tab
)
!=
0
)
{
{
const
NdbError
err
=
dict
->
getNdbError
();
const
NdbError
err
=
dict
->
getNdbError
();
...
@@ -3713,7 +3732,8 @@ int ha_ndbcluster::create_index(const char *name,
...
@@ -3713,7 +3732,8 @@ int ha_ndbcluster::create_index(const char *name,
KEY
*
key_info
,
KEY
*
key_info
,
bool
unique
)
bool
unique
)
{
{
NdbDictionary
::
Dictionary
*
dict
=
m_ndb
->
getDictionary
();
Ndb
*
ndb
=
get_ndb
();
NdbDictionary
::
Dictionary
*
dict
=
ndb
->
getDictionary
();
KEY_PART_INFO
*
key_part
=
key_info
->
key_part
;
KEY_PART_INFO
*
key_part
=
key_info
->
key_part
;
KEY_PART_INFO
*
end
=
key_part
+
key_info
->
key_parts
;
KEY_PART_INFO
*
end
=
key_part
+
key_info
->
key_parts
;
...
@@ -3772,14 +3792,15 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
...
@@ -3772,14 +3792,15 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
if
(
check_ndb_connection
())
if
(
check_ndb_connection
())
DBUG_RETURN
(
my_errno
=
HA_ERR_NO_CONNECTION
);
DBUG_RETURN
(
my_errno
=
HA_ERR_NO_CONNECTION
);
dict
=
m_ndb
->
getDictionary
();
Ndb
*
ndb
=
get_ndb
();
dict
=
ndb
->
getDictionary
();
if
(
!
(
orig_tab
=
dict
->
getTable
(
m_tabname
)))
if
(
!
(
orig_tab
=
dict
->
getTable
(
m_tabname
)))
ERR_RETURN
(
dict
->
getNdbError
());
ERR_RETURN
(
dict
->
getNdbError
());
m_table
=
(
void
*
)
orig_tab
;
m_table
=
(
void
*
)
orig_tab
;
// Change current database to that of target table
// Change current database to that of target table
set_dbname
(
to
);
set_dbname
(
to
);
m_
ndb
->
setDatabaseName
(
m_dbname
);
ndb
->
setDatabaseName
(
m_dbname
);
if
(
!
(
result
=
alter_table_name
(
new_tabname
)))
if
(
!
(
result
=
alter_table_name
(
new_tabname
)))
{
{
// Rename .ndb file
// Rename .ndb file
...
@@ -3796,7 +3817,8 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
...
@@ -3796,7 +3817,8 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
int
ha_ndbcluster
::
alter_table_name
(
const
char
*
to
)
int
ha_ndbcluster
::
alter_table_name
(
const
char
*
to
)
{
{
NDBDICT
*
dict
=
m_ndb
->
getDictionary
();
Ndb
*
ndb
=
get_ndb
();
NDBDICT
*
dict
=
ndb
->
getDictionary
();
const
NDBTAB
*
orig_tab
=
(
const
NDBTAB
*
)
m_table
;
const
NDBTAB
*
orig_tab
=
(
const
NDBTAB
*
)
m_table
;
int
ret
;
int
ret
;
DBUG_ENTER
(
"alter_table_name_table"
);
DBUG_ENTER
(
"alter_table_name_table"
);
...
@@ -3838,8 +3860,9 @@ int ha_ndbcluster::delete_table(const char *name)
...
@@ -3838,8 +3860,9 @@ int ha_ndbcluster::delete_table(const char *name)
int
ha_ndbcluster
::
drop_table
()
int
ha_ndbcluster
::
drop_table
()
{
{
NdbDictionary
::
Dictionary
*
dict
=
m_ndb
->
getDictionary
();
Ndb
*
ndb
=
get_ndb
();
NdbDictionary
::
Dictionary
*
dict
=
ndb
->
getDictionary
();
DBUG_ENTER
(
"drop_table"
);
DBUG_ENTER
(
"drop_table"
);
DBUG_PRINT
(
"enter"
,
(
"Deleting %s"
,
m_tabname
));
DBUG_PRINT
(
"enter"
,
(
"Deleting %s"
,
m_tabname
));
...
@@ -3874,6 +3897,7 @@ ulonglong ha_ndbcluster::get_auto_increment()
...
@@ -3874,6 +3897,7 @@ ulonglong ha_ndbcluster::get_auto_increment()
Uint64
auto_value
;
Uint64
auto_value
;
DBUG_ENTER
(
"get_auto_increment"
);
DBUG_ENTER
(
"get_auto_increment"
);
DBUG_PRINT
(
"enter"
,
(
"m_tabname: %s"
,
m_tabname
));
DBUG_PRINT
(
"enter"
,
(
"m_tabname: %s"
,
m_tabname
));
Ndb
*
ndb
=
get_ndb
();
cache_size
=
cache_size
=
(
m_rows_to_insert
-
m_rows_inserted
<
m_autoincrement_prefetch
)
?
(
m_rows_to_insert
-
m_rows_inserted
<
m_autoincrement_prefetch
)
?
m_rows_to_insert
-
m_rows_inserted
m_rows_to_insert
-
m_rows_inserted
...
@@ -3882,8 +3906,8 @@ ulonglong ha_ndbcluster::get_auto_increment()
...
@@ -3882,8 +3906,8 @@ ulonglong ha_ndbcluster::get_auto_increment()
:
m_autoincrement_prefetch
;
:
m_autoincrement_prefetch
;
auto_value
=
auto_value
=
(
m_skip_auto_increment
)
?
(
m_skip_auto_increment
)
?
m_
ndb
->
readAutoIncrementValue
((
const
NDBTAB
*
)
m_table
)
ndb
->
readAutoIncrementValue
((
const
NDBTAB
*
)
m_table
)
:
m_
ndb
->
getAutoIncrementValue
((
const
NDBTAB
*
)
m_table
,
cache_size
);
:
ndb
->
getAutoIncrementValue
((
const
NDBTAB
*
)
m_table
,
cache_size
);
DBUG_RETURN
((
longlong
)
auto_value
);
DBUG_RETURN
((
longlong
)
auto_value
);
}
}
...
@@ -3897,7 +3921,6 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
...
@@ -3897,7 +3921,6 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
m_active_trans
(
NULL
),
m_active_trans
(
NULL
),
m_active_cursor
(
NULL
),
m_active_cursor
(
NULL
),
m_multi_cursor
(
NULL
),
m_multi_cursor
(
NULL
),
m_ndb
(
NULL
),
m_table
(
NULL
),
m_table
(
NULL
),
m_table_info
(
NULL
),
m_table_info
(
NULL
),
m_table_flags
(
HA_REC_NOT_IN_SEQ
|
m_table_flags
(
HA_REC_NOT_IN_SEQ
|
...
@@ -4030,7 +4053,6 @@ int ha_ndbcluster::close(void)
...
@@ -4030,7 +4053,6 @@ int ha_ndbcluster::close(void)
DBUG_ENTER
(
"close"
);
DBUG_ENTER
(
"close"
);
free_share
(
m_share
);
m_share
=
0
;
free_share
(
m_share
);
m_share
=
0
;
release_metadata
();
release_metadata
();
m_ndb
=
NULL
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
@@ -4092,11 +4114,12 @@ Ndb* check_ndb_in_thd(THD* thd)
...
@@ -4092,11 +4114,12 @@ Ndb* check_ndb_in_thd(THD* thd)
int
ha_ndbcluster
::
check_ndb_connection
()
int
ha_ndbcluster
::
check_ndb_connection
()
{
{
THD
*
thd
=
current_thd
;
THD
*
thd
=
current_thd
;
Ndb
*
ndb
;
DBUG_ENTER
(
"check_ndb_connection"
);
DBUG_ENTER
(
"check_ndb_connection"
);
if
(
!
(
m_
ndb
=
check_ndb_in_thd
(
thd
)))
if
(
!
(
ndb
=
check_ndb_in_thd
(
thd
)))
DBUG_RETURN
(
HA_ERR_NO_CONNECTION
);
DBUG_RETURN
(
HA_ERR_NO_CONNECTION
);
m_
ndb
->
setDatabaseName
(
m_dbname
);
ndb
->
setDatabaseName
(
m_dbname
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
...
sql/ha_ndbcluster.h
View file @
9647a076
...
@@ -220,7 +220,6 @@ class ha_ndbcluster: public handler
...
@@ -220,7 +220,6 @@ class ha_ndbcluster: public handler
NdbTransaction
*
m_active_trans
;
NdbTransaction
*
m_active_trans
;
NdbScanOperation
*
m_active_cursor
;
NdbScanOperation
*
m_active_cursor
;
Ndb
*
m_ndb
;
void
*
m_table
;
void
*
m_table
;
void
*
m_table_info
;
void
*
m_table_info
;
char
m_dbname
[
FN_HEADLEN
];
char
m_dbname
[
FN_HEADLEN
];
...
@@ -265,6 +264,7 @@ class ha_ndbcluster: public handler
...
@@ -265,6 +264,7 @@ class ha_ndbcluster: public handler
byte
*
m_multi_range_cursor_result_ptr
;
byte
*
m_multi_range_cursor_result_ptr
;
int
setup_recattr
(
const
NdbRecAttr
*
);
int
setup_recattr
(
const
NdbRecAttr
*
);
Ndb
*
get_ndb
();
void
set_rec_per_key
();
void
set_rec_per_key
();
void
records_update
();
void
records_update
();
void
no_uncommitted_rows_execute_failure
();
void
no_uncommitted_rows_execute_failure
();
...
...
sql/item_strfunc.cc
View file @
9647a076
...
@@ -1185,21 +1185,29 @@ String *Item_func_substr_index::val_str(String *str)
...
@@ -1185,21 +1185,29 @@ String *Item_func_substr_index::val_str(String *str)
String
*
Item_func_ltrim
::
val_str
(
String
*
str
)
String
*
Item_func_ltrim
::
val_str
(
String
*
str
)
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
String
*
res
=
args
[
0
]
->
val_str
(
str
);
char
buff
[
MAX_FIELD_WIDTH
],
*
ptr
,
*
end
;
if
((
null_value
=
args
[
0
]
->
null_value
))
String
tmp
(
buff
,
sizeof
(
buff
),
system_charset_info
);
return
0
;
/* purecov: inspected */
String
*
res
,
*
remove_str
;
char
buff
[
MAX_FIELD_WIDTH
];
String
tmp
(
buff
,
sizeof
(
buff
),
res
->
charset
());
String
*
remove_str
=
(
arg_count
==
2
)
?
args
[
1
]
->
val_str
(
&
tmp
)
:
&
remove
;
uint
remove_length
;
uint
remove_length
;
LINT_INIT
(
remove_length
);
LINT_INIT
(
remove_length
);
if
(
!
remove_str
||
(
remove_length
=
remove_str
->
length
())
==
0
||
res
=
args
[
0
]
->
val_str
(
str
);
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
remove_str
=
&
remove
;
/* Default value. */
if
(
arg_count
==
2
)
{
remove_str
=
args
[
1
]
->
val_str
(
&
tmp
);
if
((
null_value
=
args
[
1
]
->
null_value
))
return
0
;
}
if
((
remove_length
=
remove_str
->
length
())
==
0
||
remove_length
>
res
->
length
())
remove_length
>
res
->
length
())
return
res
;
return
res
;
char
*
ptr
=
(
char
*
)
res
->
ptr
();
ptr
=
(
char
*
)
res
->
ptr
();
char
*
end
=
ptr
+
res
->
length
();
end
=
ptr
+
res
->
length
();
if
(
remove_length
==
1
)
if
(
remove_length
==
1
)
{
{
char
chr
=
(
*
remove_str
)[
0
];
char
chr
=
(
*
remove_str
)[
0
];
...
@@ -1224,21 +1232,29 @@ String *Item_func_ltrim::val_str(String *str)
...
@@ -1224,21 +1232,29 @@ String *Item_func_ltrim::val_str(String *str)
String
*
Item_func_rtrim
::
val_str
(
String
*
str
)
String
*
Item_func_rtrim
::
val_str
(
String
*
str
)
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
String
*
res
=
args
[
0
]
->
val_str
(
str
);
char
buff
[
MAX_FIELD_WIDTH
],
*
ptr
,
*
end
;
if
((
null_value
=
args
[
0
]
->
null_value
))
String
tmp
(
buff
,
sizeof
(
buff
),
system_charset_info
);
return
0
;
/* purecov: inspected */
String
*
res
,
*
remove_str
;
char
buff
[
MAX_FIELD_WIDTH
];
String
tmp
(
buff
,
sizeof
(
buff
),
res
->
charset
());
String
*
remove_str
=
(
arg_count
==
2
)
?
args
[
1
]
->
val_str
(
&
tmp
)
:
&
remove
;
uint
remove_length
;
uint
remove_length
;
LINT_INIT
(
remove_length
);
LINT_INIT
(
remove_length
);
if
(
!
remove_str
||
(
remove_length
=
remove_str
->
length
())
==
0
||
res
=
args
[
0
]
->
val_str
(
str
);
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
remove_str
=
&
remove
;
/* Default value. */
if
(
arg_count
==
2
)
{
remove_str
=
args
[
1
]
->
val_str
(
&
tmp
);
if
((
null_value
=
args
[
1
]
->
null_value
))
return
0
;
}
if
((
remove_length
=
remove_str
->
length
())
==
0
||
remove_length
>
res
->
length
())
remove_length
>
res
->
length
())
return
res
;
return
res
;
char
*
ptr
=
(
char
*
)
res
->
ptr
();
ptr
=
(
char
*
)
res
->
ptr
();
char
*
end
=
ptr
+
res
->
length
();
end
=
ptr
+
res
->
length
();
#ifdef USE_MB
#ifdef USE_MB
char
*
p
=
ptr
;
char
*
p
=
ptr
;
register
uint32
l
;
register
uint32
l
;
...
@@ -1297,31 +1313,31 @@ String *Item_func_rtrim::val_str(String *str)
...
@@ -1297,31 +1313,31 @@ String *Item_func_rtrim::val_str(String *str)
String
*
Item_func_trim
::
val_str
(
String
*
str
)
String
*
Item_func_trim
::
val_str
(
String
*
str
)
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
String
*
res
=
args
[
0
]
->
val_str
(
str
);
char
buff
[
MAX_FIELD_WIDTH
],
*
ptr
,
*
end
;
if
((
null_value
=
args
[
0
]
->
null_value
))
const
char
*
r_ptr
;
return
0
;
/* purecov: inspected */
String
tmp
(
buff
,
sizeof
(
buff
),
system_charset_info
);
char
buff
[
MAX_FIELD_WIDTH
];
String
*
res
,
*
remove_str
;
String
tmp
(
buff
,
sizeof
(
buff
),
res
->
charset
());
uint
remove_length
;
uint
remove_length
;
LINT_INIT
(
remove_length
);
LINT_INIT
(
remove_length
);
String
*
remove_str
;
/* The string to remove from res. */
res
=
args
[
0
]
->
val_str
(
str
);
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
remove_str
=
&
remove
;
/* Default value. */
if
(
arg_count
==
2
)
if
(
arg_count
==
2
)
{
{
remove_str
=
args
[
1
]
->
val_str
(
&
tmp
);
remove_str
=
args
[
1
]
->
val_str
(
&
tmp
);
if
((
null_value
=
args
[
1
]
->
null_value
))
if
((
null_value
=
args
[
1
]
->
null_value
))
return
0
;
return
0
;
}
}
else
remove_str
=
&
remove
;
/* Default value. */
if
(
!
remove_str
||
(
remove_length
=
remove_str
->
length
())
==
0
||
if
(
(
remove_length
=
remove_str
->
length
())
==
0
||
remove_length
>
res
->
length
())
remove_length
>
res
->
length
())
return
res
;
return
res
;
char
*
ptr
=
(
char
*
)
res
->
ptr
();
ptr
=
(
char
*
)
res
->
ptr
();
char
*
end
=
ptr
+
res
->
length
();
end
=
ptr
+
res
->
length
();
const
char
*
r_ptr
=
remove_str
->
ptr
();
r_ptr
=
remove_str
->
ptr
();
while
(
ptr
+
remove_length
<=
end
&&
!
memcmp
(
ptr
,
r_ptr
,
remove_length
))
while
(
ptr
+
remove_length
<=
end
&&
!
memcmp
(
ptr
,
r_ptr
,
remove_length
))
ptr
+=
remove_length
;
ptr
+=
remove_length
;
#ifdef USE_MB
#ifdef USE_MB
...
...
sql/sql_base.cc
View file @
9647a076
...
@@ -1069,6 +1069,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
...
@@ -1069,6 +1069,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
table
->
outer_join
=
table
->
null_row
=
table
->
maybe_null
=
table
->
force_index
=
0
;
table
->
outer_join
=
table
->
null_row
=
table
->
maybe_null
=
table
->
force_index
=
0
;
table
->
status
=
STATUS_NO_RECORD
;
table
->
status
=
STATUS_NO_RECORD
;
table
->
keys_in_use_for_query
=
table
->
keys_in_use
;
table
->
keys_in_use_for_query
=
table
->
keys_in_use
;
table
->
insert_values
=
0
;
table
->
used_keys
=
table
->
keys_for_keyread
;
table
->
used_keys
=
table
->
keys_for_keyread
;
if
(
table
->
timestamp_field
)
if
(
table
->
timestamp_field
)
table
->
timestamp_field_type
=
table
->
timestamp_field
->
get_auto_set_type
();
table
->
timestamp_field_type
=
table
->
timestamp_field
->
get_auto_set_type
();
...
...
sql/sql_insert.cc
View file @
9647a076
...
@@ -501,7 +501,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
...
@@ -501,7 +501,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
::
send_ok
(
thd
,
(
ulong
)
thd
->
row_count_func
,
id
,
buff
);
::
send_ok
(
thd
,
(
ulong
)
thd
->
row_count_func
,
id
,
buff
);
}
}
free_underlaid_joins
(
thd
,
&
thd
->
lex
->
select_lex
);
free_underlaid_joins
(
thd
,
&
thd
->
lex
->
select_lex
);
table_list
->
clear_insert_values
();
thd
->
abort_on_warning
=
0
;
thd
->
abort_on_warning
=
0
;
DBUG_RETURN
(
FALSE
);
DBUG_RETURN
(
FALSE
);
...
@@ -511,7 +510,6 @@ abort:
...
@@ -511,7 +510,6 @@ abort:
end_delayed_insert
(
thd
);
end_delayed_insert
(
thd
);
#endif
#endif
free_underlaid_joins
(
thd
,
&
thd
->
lex
->
select_lex
);
free_underlaid_joins
(
thd
,
&
thd
->
lex
->
select_lex
);
table_list
->
clear_insert_values
();
thd
->
abort_on_warning
=
0
;
thd
->
abort_on_warning
=
0
;
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
...
...
sql/sql_parse.cc
View file @
9647a076
...
@@ -3009,9 +3009,6 @@ create_error:
...
@@ -3009,9 +3009,6 @@ create_error:
lex
->
select_lex
.
resolve_mode
=
SELECT_LEX
::
INSERT_MODE
;
lex
->
select_lex
.
resolve_mode
=
SELECT_LEX
::
INSERT_MODE
;
delete
result
;
delete
result
;
}
}
/* in case of error first_table->table can be 0 */
if
(
first_table
->
table
)
first_table
->
table
->
insert_values
=
0
;
/* revert changes for SP */
/* revert changes for SP */
lex
->
select_lex
.
table_list
.
first
=
(
byte
*
)
first_table
;
lex
->
select_lex
.
table_list
.
first
=
(
byte
*
)
first_table
;
}
}
...
...
sql/sql_prepare.cc
View file @
9647a076
...
@@ -908,7 +908,11 @@ static bool mysql_test_insert(Prepared_statement *stmt,
...
@@ -908,7 +908,11 @@ static bool mysql_test_insert(Prepared_statement *stmt,
Item
*
unused_conds
=
0
;
Item
*
unused_conds
=
0
;
if
(
table_list
->
table
)
if
(
table_list
->
table
)
table_list
->
table
->
insert_values
=
(
byte
*
)
1
;
// don't allocate insert_values
{
// don't allocate insert_values
table_list
->
table
->
insert_values
=
(
byte
*
)
1
;
}
if
((
res
=
mysql_prepare_insert
(
thd
,
table_list
,
table_list
->
table
,
if
((
res
=
mysql_prepare_insert
(
thd
,
table_list
,
table_list
->
table
,
fields
,
values
,
update_fields
,
fields
,
values
,
update_fields
,
update_values
,
duplic
,
update_values
,
duplic
,
...
@@ -934,8 +938,7 @@ static bool mysql_test_insert(Prepared_statement *stmt,
...
@@ -934,8 +938,7 @@ static bool mysql_test_insert(Prepared_statement *stmt,
res
=
0
;
res
=
0
;
error:
error:
lex
->
unit
.
cleanup
();
lex
->
unit
.
cleanup
();
if
(
table_list
->
table
)
/* insert_values is cleared in open_table */
table_list
->
table
->
insert_values
=
0
;
DBUG_RETURN
(
res
);
DBUG_RETURN
(
res
);
}
}
...
@@ -1401,6 +1404,11 @@ static int mysql_test_insert_select(Prepared_statement *stmt,
...
@@ -1401,6 +1404,11 @@ static int mysql_test_insert_select(Prepared_statement *stmt,
DBUG_ASSERT
(
first_local_table
!=
0
);
DBUG_ASSERT
(
first_local_table
!=
0
);
/* Skip first table, which is the table we are inserting in */
/* Skip first table, which is the table we are inserting in */
lex
->
select_lex
.
table_list
.
first
=
(
byte
*
)
first_local_table
->
next_local
;
lex
->
select_lex
.
table_list
.
first
=
(
byte
*
)
first_local_table
->
next_local
;
if
(
tables
->
table
)
{
// don't allocate insert_values
tables
->
table
->
insert_values
=
(
byte
*
)
1
;
}
/*
/*
insert/replace from SELECT give its SELECT_LEX for SELECT,
insert/replace from SELECT give its SELECT_LEX for SELECT,
...
...
sql/table.cc
View file @
9647a076
...
@@ -2026,26 +2026,6 @@ bool st_table_list::set_insert_values(MEM_ROOT *mem_root)
...
@@ -2026,26 +2026,6 @@ bool st_table_list::set_insert_values(MEM_ROOT *mem_root)
}
}
/*
clear insert_values reference
SYNOPSIS
clear_insert_values()
*/
void
st_table_list
::
clear_insert_values
()
{
if
(
table
)
table
->
insert_values
=
0
;
else
{
DBUG_ASSERT
(
view
&&
ancestor
&&
ancestor
->
next_local
);
for
(
TABLE_LIST
*
tbl
=
ancestor
;
tbl
;
tbl
=
tbl
->
next_local
)
tbl
->
clear_insert_values
();
}
}
void
Field_iterator_view
::
set
(
TABLE_LIST
*
table
)
void
Field_iterator_view
::
set
(
TABLE_LIST
*
table
)
{
{
ptr
=
table
->
field_translation
;
ptr
=
table
->
field_translation
;
...
...
sql/table.h
View file @
9647a076
...
@@ -387,7 +387,6 @@ typedef struct st_table_list
...
@@ -387,7 +387,6 @@ typedef struct st_table_list
void
restore_want_privilege
();
void
restore_want_privilege
();
bool
check_single_table
(
st_table_list
**
table
,
table_map
map
);
bool
check_single_table
(
st_table_list
**
table
,
table_map
map
);
bool
set_insert_values
(
MEM_ROOT
*
mem_root
);
bool
set_insert_values
(
MEM_ROOT
*
mem_root
);
void
clear_insert_values
();
}
TABLE_LIST
;
}
TABLE_LIST
;
class
Item
;
class
Item
;
...
...
tests/client_test.c
View file @
9647a076
...
@@ -734,8 +734,8 @@ static void verify_st_affected_rows(MYSQL_STMT *stmt, ulonglong exp_count)
...
@@ -734,8 +734,8 @@ static void verify_st_affected_rows(MYSQL_STMT *stmt, ulonglong exp_count)
{
{
ulonglong
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
ulonglong
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
if
(
!
opt_silent
)
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
total affected rows: `%l
ld` (expected: `%l
ld`)"
,
fprintf
(
stdout
,
"
\n
total affected rows: `%l
d` (expected: `%
ld`)"
,
affected_rows
,
exp_count
);
(
long
)
affected_rows
,
(
long
)
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
}
}
...
@@ -746,8 +746,8 @@ static void verify_affected_rows(ulonglong exp_count)
...
@@ -746,8 +746,8 @@ static void verify_affected_rows(ulonglong exp_count)
{
{
ulonglong
affected_rows
=
mysql_affected_rows
(
mysql
);
ulonglong
affected_rows
=
mysql_affected_rows
(
mysql
);
if
(
!
opt_silent
)
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
total affected rows: `%l
ld` (expected: `%l
ld`)"
,
fprintf
(
stdout
,
"
\n
total affected rows: `%l
d` (expected: `%
ld`)"
,
affected_rows
,
exp_count
);
(
long
)
affected_rows
,
(
long
)
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
}
}
...
@@ -780,8 +780,8 @@ static void execute_prepare_query(const char *query, ulonglong exp_count)
...
@@ -780,8 +780,8 @@ static void execute_prepare_query(const char *query, ulonglong exp_count)
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
if
(
!
opt_silent
)
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
total affected rows: `%l
ld` (expected: `%l
ld`)"
,
fprintf
(
stdout
,
"
\n
total affected rows: `%l
d` (expected: `%
ld`)"
,
affected_rows
,
exp_count
);
(
long
)
affected_rows
,
(
long
)
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
mysql_stmt_close
(
stmt
);
mysql_stmt_close
(
stmt
);
...
@@ -1017,7 +1017,8 @@ my_bool fetch_n(const char **query_list, unsigned query_count)
...
@@ -1017,7 +1017,8 @@ my_bool fetch_n(const char **query_list, unsigned query_count)
fprintf
(
stderr
,
fprintf
(
stderr
,
"Got error reading rows from statement %d,
\n
"
"Got error reading rows from statement %d,
\n
"
"query is: %s,
\n
"
"query is: %s,
\n
"
"error message: %s"
,
fetch
-
fetch_array
,
fetch
->
query
,
"error message: %s"
,
(
int
)
(
fetch
-
fetch_array
),
fetch
->
query
,
mysql_stmt_error
(
fetch
->
handle
));
mysql_stmt_error
(
fetch
->
handle
));
error_count
++
;
error_count
++
;
}
}
...
@@ -1479,6 +1480,7 @@ static void test_prepare()
...
@@ -1479,6 +1480,7 @@ static void test_prepare()
double
double_data
,
o_double_data
;
double
double_data
,
o_double_data
;
ulong
length
[
7
],
len
;
ulong
length
[
7
],
len
;
my_bool
is_null
[
7
];
my_bool
is_null
[
7
];
char
llbuf
[
22
];
MYSQL_BIND
bind
[
7
];
MYSQL_BIND
bind
[
7
];
myheader
(
"test_prepare"
);
myheader
(
"test_prepare"
);
...
@@ -1596,7 +1598,8 @@ static void test_prepare()
...
@@ -1596,7 +1598,8 @@ static void test_prepare()
fprintf
(
stdout
,
"
\n\t
tiny : %d (%lu)"
,
tiny_data
,
length
[
0
]);
fprintf
(
stdout
,
"
\n\t
tiny : %d (%lu)"
,
tiny_data
,
length
[
0
]);
fprintf
(
stdout
,
"
\n\t
short : %d (%lu)"
,
small_data
,
length
[
3
]);
fprintf
(
stdout
,
"
\n\t
short : %d (%lu)"
,
small_data
,
length
[
3
]);
fprintf
(
stdout
,
"
\n\t
int : %d (%lu)"
,
int_data
,
length
[
2
]);
fprintf
(
stdout
,
"
\n\t
int : %d (%lu)"
,
int_data
,
length
[
2
]);
fprintf
(
stdout
,
"
\n\t
big : %lld (%lu)"
,
big_data
,
length
[
4
]);
fprintf
(
stdout
,
"
\n\t
big : %s (%lu)"
,
llstr
(
big_data
,
llbuf
),
length
[
4
]);
fprintf
(
stdout
,
"
\n\t
float : %f (%lu)"
,
real_data
,
length
[
5
]);
fprintf
(
stdout
,
"
\n\t
float : %f (%lu)"
,
real_data
,
length
[
5
]);
fprintf
(
stdout
,
"
\n\t
double : %f (%lu)"
,
double_data
,
length
[
6
]);
fprintf
(
stdout
,
"
\n\t
double : %f (%lu)"
,
double_data
,
length
[
6
]);
...
@@ -3446,7 +3449,7 @@ static void test_bind_result_ext()
...
@@ -3446,7 +3449,7 @@ static void test_bind_result_ext()
MYSQL_BIND
bind
[
8
];
MYSQL_BIND
bind
[
8
];
ulong
length
[
8
];
ulong
length
[
8
];
my_bool
is_null
[
8
];
my_bool
is_null
[
8
];
char
llbuf
[
22
];
myheader
(
"test_bind_result_ext"
);
myheader
(
"test_bind_result_ext"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS test_bind_result"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS test_bind_result"
);
...
@@ -3520,7 +3523,7 @@ static void test_bind_result_ext()
...
@@ -3520,7 +3523,7 @@ static void test_bind_result_ext()
fprintf
(
stdout
,
"
\n
data (tiny) : %d"
,
t_data
);
fprintf
(
stdout
,
"
\n
data (tiny) : %d"
,
t_data
);
fprintf
(
stdout
,
"
\n
data (short) : %d"
,
s_data
);
fprintf
(
stdout
,
"
\n
data (short) : %d"
,
s_data
);
fprintf
(
stdout
,
"
\n
data (int) : %d"
,
i_data
);
fprintf
(
stdout
,
"
\n
data (int) : %d"
,
i_data
);
fprintf
(
stdout
,
"
\n
data (big) : %
lld"
,
b_data
);
fprintf
(
stdout
,
"
\n
data (big) : %
s"
,
llstr
(
b_data
,
llbuf
)
);
fprintf
(
stdout
,
"
\n
data (float) : %f"
,
f_data
);
fprintf
(
stdout
,
"
\n
data (float) : %f"
,
f_data
);
fprintf
(
stdout
,
"
\n
data (double) : %f"
,
d_data
);
fprintf
(
stdout
,
"
\n
data (double) : %f"
,
d_data
);
...
@@ -5286,7 +5289,7 @@ static void test_manual_sample()
...
@@ -5286,7 +5289,7 @@ static void test_manual_sample()
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
if
(
!
opt_silent
)
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
total affected rows: %l
ld"
,
affected_rows
);
fprintf
(
stdout
,
"
\n
total affected rows: %l
d"
,
(
ulong
)
affected_rows
);
if
(
affected_rows
!=
1
)
/* validate affected rows */
if
(
affected_rows
!=
1
)
/* validate affected rows */
{
{
fprintf
(
stderr
,
"
\n
invalid affected rows by MySQL"
);
fprintf
(
stderr
,
"
\n
invalid affected rows by MySQL"
);
...
@@ -5311,7 +5314,7 @@ static void test_manual_sample()
...
@@ -5311,7 +5314,7 @@ static void test_manual_sample()
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
if
(
!
opt_silent
)
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
total affected rows: %l
ld"
,
affected_rows
);
fprintf
(
stdout
,
"
\n
total affected rows: %l
d"
,
(
ulong
)
affected_rows
);
if
(
affected_rows
!=
1
)
/* validate affected rows */
if
(
affected_rows
!=
1
)
/* validate affected rows */
{
{
fprintf
(
stderr
,
"
\n
invalid affected rows by MySQL"
);
fprintf
(
stderr
,
"
\n
invalid affected rows by MySQL"
);
...
@@ -5467,9 +5470,9 @@ DROP TABLE IF EXISTS test_multi_tab";
...
@@ -5467,9 +5470,9 @@ DROP TABLE IF EXISTS test_multi_tab";
mysql_free_result
(
result
);
mysql_free_result
(
result
);
}
}
else
if
(
!
opt_silent
)
else
if
(
!
opt_silent
)
fprintf
(
stdout
,
"OK, %l
ld row(s) affected, %
d warning(s)
\n
"
,
fprintf
(
stdout
,
"OK, %l
d row(s) affected, %l
d warning(s)
\n
"
,
mysql_affected_rows
(
mysql_local
),
(
ulong
)
mysql_affected_rows
(
mysql_local
),
mysql_warning_count
(
mysql_local
));
(
ulong
)
mysql_warning_count
(
mysql_local
));
exp_value
=
(
uint
)
mysql_affected_rows
(
mysql_local
);
exp_value
=
(
uint
)
mysql_affected_rows
(
mysql_local
);
if
(
rows
[
count
]
!=
exp_value
)
if
(
rows
[
count
]
!=
exp_value
)
...
@@ -6549,7 +6552,7 @@ static void test_ushort_bug()
...
@@ -6549,7 +6552,7 @@ static void test_ushort_bug()
ulonglong
longlong_value
;
ulonglong
longlong_value
;
int
rc
;
int
rc
;
uchar
tiny_value
;
uchar
tiny_value
;
char
llbuf
[
22
];
myheader
(
"test_ushort_bug"
);
myheader
(
"test_ushort_bug"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS test_ushort"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS test_ushort"
);
...
@@ -6601,7 +6604,8 @@ static void test_ushort_bug()
...
@@ -6601,7 +6604,8 @@ static void test_ushort_bug()
{
{
fprintf
(
stdout
,
"
\n
ushort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
ushort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
ulong : %lu (%ld)"
,
(
ulong
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
ulong : %lu (%ld)"
,
(
ulong
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
longlong : %lld (%ld)"
,
longlong_value
,
ll_length
);
fprintf
(
stdout
,
"
\n
longlong : %s (%ld)"
,
llstr
(
longlong_value
,
llbuf
),
ll_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
}
}
...
@@ -6636,6 +6640,7 @@ static void test_sshort_bug()
...
@@ -6636,6 +6640,7 @@ static void test_sshort_bug()
ulonglong
longlong_value
;
ulonglong
longlong_value
;
int
rc
;
int
rc
;
uchar
tiny_value
;
uchar
tiny_value
;
char
llbuf
[
22
];
myheader
(
"test_sshort_bug"
);
myheader
(
"test_sshort_bug"
);
...
@@ -6686,7 +6691,8 @@ static void test_sshort_bug()
...
@@ -6686,7 +6691,8 @@ static void test_sshort_bug()
{
{
fprintf
(
stdout
,
"
\n
sshort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
sshort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
slong : %ld (%ld)"
,
(
long
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
slong : %ld (%ld)"
,
(
long
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
longlong : %lld (%ld)"
,
longlong_value
,
ll_length
);
fprintf
(
stdout
,
"
\n
longlong : %s (%ld)"
,
llstr
(
longlong_value
,
llbuf
),
ll_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
}
}
...
@@ -6721,6 +6727,7 @@ static void test_stiny_bug()
...
@@ -6721,6 +6727,7 @@ static void test_stiny_bug()
ulonglong
longlong_value
;
ulonglong
longlong_value
;
int
rc
;
int
rc
;
uchar
tiny_value
;
uchar
tiny_value
;
char
llbuf
[
22
];
myheader
(
"test_stiny_bug"
);
myheader
(
"test_stiny_bug"
);
...
@@ -6770,7 +6777,8 @@ static void test_stiny_bug()
...
@@ -6770,7 +6777,8 @@ static void test_stiny_bug()
{
{
fprintf
(
stdout
,
"
\n
sshort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
sshort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
slong : %ld (%ld)"
,
(
long
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
slong : %ld (%ld)"
,
(
long
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
longlong : %lld (%ld)"
,
longlong_value
,
ll_length
);
fprintf
(
stdout
,
"
\n
longlong : %s (%ld)"
,
llstr
(
longlong_value
,
llbuf
),
ll_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
}
}
...
@@ -11263,7 +11271,7 @@ static void test_bug5399()
...
@@ -11263,7 +11271,7 @@ static void test_bug5399()
for
(
stmt
=
stmt_list
;
stmt
!=
stmt_list
+
NUM_OF_USED_STMT
;
++
stmt
)
for
(
stmt
=
stmt_list
;
stmt
!=
stmt_list
+
NUM_OF_USED_STMT
;
++
stmt
)
{
{
sprintf
(
buff
,
"select %d"
,
stmt
-
stmt_list
);
sprintf
(
buff
,
"select %d"
,
(
int
)
(
stmt
-
stmt_list
)
);
*
stmt
=
mysql_stmt_init
(
mysql
);
*
stmt
=
mysql_stmt_init
(
mysql
);
rc
=
mysql_stmt_prepare
(
*
stmt
,
buff
,
strlen
(
buff
));
rc
=
mysql_stmt_prepare
(
*
stmt
,
buff
,
strlen
(
buff
));
check_execute
(
*
stmt
,
rc
);
check_execute
(
*
stmt
,
rc
);
...
@@ -11452,7 +11460,7 @@ static void test_bug5194()
...
@@ -11452,7 +11460,7 @@ static void test_bug5194()
if
(
!
opt_silent
)
if
(
!
opt_silent
)
printf
(
"Insert: query length= %d, row count= %d, param count= %lu
\n
"
,
printf
(
"Insert: query length= %d, row count= %d, param count= %lu
\n
"
,
strlen
(
query
),
nrows
,
mysql_stmt_param_count
(
stmt
));
(
int
)
strlen
(
query
),
nrows
,
mysql_stmt_param_count
(
stmt
));
/* bind the parameter array and execute the query */
/* bind the parameter array and execute the query */
rc
=
mysql_stmt_bind_param
(
stmt
,
bind
);
rc
=
mysql_stmt_bind_param
(
stmt
,
bind
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment