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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
a9b2d525
Commit
a9b2d525
authored
Jan 09, 2003
by
venu@myvenu.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge work.mysql.com:/home/bk/mysql-4.1
into myvenu.com:/home/venu/bk/src-4.1
parents
af76ac08
79dd162e
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1075 additions
and
97 deletions
+1075
-97
include/mysql.h
include/mysql.h
+2
-2
libmysql/libmysql.c
libmysql/libmysql.c
+32
-48
mysql-test/r/create.result
mysql-test/r/create.result
+1
-1
mysql-test/r/warnings.result
mysql-test/r/warnings.result
+17
-0
mysql-test/t/create.test
mysql-test/t/create.test
+1
-1
mysql-test/t/warnings.test
mysql-test/t/warnings.test
+7
-0
tests/client_test.c
tests/client_test.c
+1015
-45
No files found.
include/mysql.h
View file @
a9b2d525
...
...
@@ -439,13 +439,12 @@ typedef struct st_mysql_bind
{
long
*
length
;
/* output length pointer */
gptr
buffer
;
/* buffer */
unsigned
long
buffer_length
;
/* buffer length */
enum
enum_field_types
buffer_type
;
/* buffer type */
enum
enum_field_types
field_type
;
/* field type */
my_bool
is_null
;
/* NULL indicator */
my_bool
is_long_data
;
/* long data indicator */
/* The following are for internal use. Set by mysql_bind_param */
unsigned
long
buffer_length
;
/* buffer length */
long
bind_length
;
/* Default length of data */
my_bool
long_ended
;
/* All data supplied for long */
unsigned
int
param_number
;
/* For null count and error messages */
...
...
@@ -511,6 +510,7 @@ MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt);
#define MYSQL_NO_DATA 100
#define MYSQL_NEED_DATA 99
#define MYSQL_NULL_DATA (-1)
#define MYSQL_LONG_DATA (-2)
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
...
...
libmysql/libmysql.c
View file @
a9b2d525
...
...
@@ -4097,8 +4097,7 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param)
DBUG_PRINT
(
"enter"
,(
"type: %d, buffer:%lx, length: %d"
,
param
->
buffer_type
,
param
->
buffer
?
param
->
buffer
:
"0"
,
*
param
->
length
));
if
(
param
->
is_null
||
param
->
buffer_type
==
MYSQL_TYPE_NULL
||
*
param
->
length
==
MYSQL_NULL_DATA
)
if
(
param
->
is_null
||
*
param
->
length
==
MYSQL_NULL_DATA
)
store_param_null
(
net
,
param
);
else
{
...
...
@@ -4190,7 +4189,7 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt)
for
(
param
=
stmt
->
params
;
param
<
param_end
;
param
++
)
{
/* Check for long data which has not been propery given/terminated */
if
(
param
->
is_long_data
)
if
(
param
->
is_long_data
||
*
param
->
length
==
MYSQL_LONG_DATA
)
{
if
(
!
param
->
long_ended
)
DBUG_RETURN
(
MYSQL_NEED_DATA
);
...
...
@@ -4281,7 +4280,7 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
/* Setup data copy functions for the different supported types */
switch
(
param
->
buffer_type
)
{
case
MYSQL_TYPE_NULL
:
param
->
is_null
=
1
;
param
->
is_null
=
1
;
break
;
case
MYSQL_TYPE_TINY
:
param
->
bind_length
=
1
;
...
...
@@ -4412,41 +4411,32 @@ mysql_send_long_data(MYSQL_STMT *stmt, uint param_number,
1 Error (Can't alloc net->buffer)
****************************************************************************/
static
u
long
get_field
_length
(
uint
type
)
/* Return the default binary data length for the common types */
static
u
nsigned
int
get_binary
_length
(
uint
type
)
{
ulong
length
;
switch
(
type
)
{
switch
(
type
)
{
case
MYSQL_TYPE_TINY
:
length
=
1
;
break
;
return
1
;
case
MYSQL_TYPE_SHORT
:
case
MYSQL_TYPE_YEAR
:
length
=
2
;
break
;
return
2
;
case
MYSQL_TYPE_LONG
:
case
MYSQL_TYPE_FLOAT
:
length
=
4
;
break
;
return
4
;
case
MYSQL_TYPE_LONGLONG
:
case
MYSQL_TYPE_DOUBLE
:
length
=
8
;
break
;
return
8
;
default:
length
=
0
;
return
0
;
}
return
length
;
}
/* Convert Numeric to buffer types */
static
void
send_data_long
(
MYSQL_BIND
*
param
,
longlong
value
)
{
char
*
buffer
=
param
->
buffer
;
*
param
->
length
=
get_field_length
(
param
->
buffer_type
);
switch
(
param
->
buffer_type
)
{
case
MYSQL_TYPE_TINY
:
*
param
->
buffer
=
(
uchar
)
value
;
break
;
...
...
@@ -4480,13 +4470,12 @@ static void send_data_long(MYSQL_BIND *param, longlong value)
}
}
/* Convert Double to buffer types */
static
void
send_data_double
(
MYSQL_BIND
*
param
,
double
value
)
{
char
*
buffer
=
param
->
buffer
;
*
param
->
length
=
get_field_length
(
param
->
buffer_type
);
switch
(
param
->
buffer_type
)
{
case
MYSQL_TYPE_TINY
:
*
buffer
=
(
uchar
)
value
;
break
;
...
...
@@ -4520,63 +4509,64 @@ static void send_data_double(MYSQL_BIND *param, double value)
}
}
static
void
send_data_str
(
MYSQL_BIND
*
param
,
char
*
value
,
uint
src_length
)
/* Convert string to buffer types */
static
void
send_data_str
(
MYSQL_BIND
*
param
,
char
*
value
,
uint
length
)
{
char
*
buffer
=
param
->
buffer
;
*
param
->
length
=
get_field_length
(
param
->
buffer_type
);
switch
(
param
->
buffer_type
)
{
case
MYSQL_TYPE_TINY
:
*
buffer
=
(
char
)
*
value
;
{
uchar
data
=
(
uchar
)
my_strntol
(
system_charset_info
,
value
,
length
,
NULL
,
10
);
*
buffer
=
data
;
break
;
}
case
MYSQL_TYPE_SHORT
:
{
short
data
=
(
short
)
sint2korr
(
value
);
short
data
=
(
short
)
my_strntol
(
system_charset_info
,
value
,
length
,
NULL
,
10
);
int2store
(
buffer
,
data
);
break
;
}
case
MYSQL_TYPE_LONG
:
{
int32
data
=
(
int32
)
sint4korr
(
value
);
int32
data
=
(
int32
)
my_strntol
(
system_charset_info
,
value
,
length
,
NULL
,
10
);
int4store
(
buffer
,
data
);
break
;
}
case
MYSQL_TYPE_LONGLONG
:
{
longlong
data
=
sint8korr
(
value
);
longlong
data
=
my_strntoll
(
system_charset_info
,
value
,
length
,
NULL
,
10
);
int8store
(
buffer
,
data
);
break
;
}
case
MYSQL_TYPE_FLOAT
:
{
float
data
;
float4get
(
data
,
value
);
float
data
=
(
float
)
my_strntod
(
system_charset_info
,
value
,
length
,
NULL
);
float4store
(
buffer
,
data
);
break
;
}
case
MYSQL_TYPE_DOUBLE
:
{
double
data
;
float8get
(
data
,
value
);
double
data
=
my_strntod
(
system_charset_info
,
value
,
length
,
NULL
);
float8store
(
buffer
,
data
);
break
;
}
default:
*
param
->
length
=
src_
length
;
memcpy
(
buffer
,
value
,
src_
length
);
buffer
[
src_
length
]
=
'\0'
;
*
param
->
length
=
length
;
memcpy
(
buffer
,
value
,
length
);
buffer
[
length
]
=
'\0'
;
}
}
/* Fetch data to buffers */
static
my_bool
fetch_results
(
MYSQL_STMT
*
stmt
,
MYSQL_BIND
*
param
,
uint
field_type
,
uchar
**
row
)
{
ulong
length
;
length
=
get_field_length
(
field_type
);
length
=
(
ulong
)
get_binary_length
(
field_type
);
switch
(
field_type
)
{
case
MYSQL_TYPE_TINY
:
{
uchar
value
=
(
uchar
)
**
row
;
...
...
@@ -4813,27 +4803,21 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
/* Setup data copy functions for the different supported types */
switch
(
param
->
buffer_type
)
{
case
MYSQL_TYPE_TINY
:
param
->
bind_length
=
1
;
param
->
fetch_result
=
fetch_result_tinyint
;
break
;
case
MYSQL_TYPE_SHORT
:
param
->
bind_length
=
2
;
param
->
fetch_result
=
fetch_result_short
;
break
;
case
MYSQL_TYPE_LONG
:
param
->
bind_length
=
4
;
param
->
fetch_result
=
fetch_result_int32
;
break
;
case
MYSQL_TYPE_LONGLONG
:
param
->
bind_length
=
8
;
param
->
fetch_result
=
fetch_result_int64
;
break
;
case
MYSQL_TYPE_FLOAT
:
param
->
bind_length
=
4
;
param
->
fetch_result
=
fetch_result_float
;
break
;
case
MYSQL_TYPE_DOUBLE
:
param
->
bind_length
=
8
;
param
->
fetch_result
=
fetch_result_double
;
break
;
case
MYSQL_TYPE_TINY_BLOB
:
...
...
@@ -4842,7 +4826,6 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
case
MYSQL_TYPE_BLOB
:
case
MYSQL_TYPE_VAR_STRING
:
case
MYSQL_TYPE_STRING
:
param
->
bind_length
=
0
;
param
->
fetch_result
=
fetch_result_str
;
break
;
default:
...
...
@@ -4852,6 +4835,7 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
}
if
(
!
param
->
length
)
param
->
length
=
&
param
->
bind_length
;
*
param
->
length
=
(
long
)
get_binary_length
(
param
->
buffer_type
);
}
stmt
->
res_buffers
=
1
;
DBUG_RETURN
(
0
);
...
...
mysql-test/r/create.result
View file @
a9b2d525
drop table if exists t1,t2;
drop table if exists t1,t2
,t3
;
create table t1 (b char(0));
insert into t1 values (""),(null);
select * from t1;
...
...
mysql-test/r/warnings.result
View file @
a9b2d525
...
...
@@ -13,3 +13,20 @@ set SQL_WARNINGS=0;
drop temporary table if exists not_exists;
Warnings:
Note 1051 Unknown table 'not_exists'
drop table if exists not_exists_table;
Warnings:
Note 1051 Unknown table 'not_exists_table'
show warnings limit 1;
Level Code Message
Note 1051 Unknown table 'not_exists_table'
drop database if exists not_exists_db;
Warnings:
Note 1008 Can't drop database 'not_exists_db'. Database doesn't exist
show count(*) warnings;
@@session.warning_count
1
create table t1(id int);
create table if not exists t1(id int);
select @@warning_count;
@@warning_count
0
mysql-test/t/create.test
View file @
a9b2d525
...
...
@@ -3,7 +3,7 @@
#
--
disable_warnings
drop
table
if
exists
t1
,
t2
;
drop
table
if
exists
t1
,
t2
,
t3
;
--
enable_warnings
create
table
t1
(
b
char
(
0
));
...
...
mysql-test/t/warnings.test
View file @
a9b2d525
...
...
@@ -19,3 +19,10 @@ set SQL_WARNINGS=0;
# Test other warnings
drop
temporary
table
if
exists
not_exists
;
drop
table
if
exists
not_exists_table
;
show
warnings
limit
1
;
drop
database
if
exists
not_exists_db
;
show
count
(
*
)
warnings
;
create
table
t1
(
id
int
);
create
table
if
not
exists
t1
(
id
int
);
select
@@
warning_count
;
tests/client_test.c
View file @
a9b2d525
This diff is collapsed.
Click to expand it.
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