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
a1834919
Commit
a1834919
authored
Mar 12, 2004
by
konstantin@oak.local
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rudimentary part of libmysql patch:
set_mysql_error is deployed
parent
6aa1cc4a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
84 deletions
+46
-84
libmysql/client_settings.h
libmysql/client_settings.h
+1
-0
libmysql/libmysql.c
libmysql/libmysql.c
+3
-20
sql-common/client.c
sql-common/client.c
+42
-64
No files found.
libmysql/client_settings.h
View file @
a1834919
...
@@ -25,6 +25,7 @@ sig_handler pipe_sig_handler(int sig __attribute__((unused)));
...
@@ -25,6 +25,7 @@ sig_handler pipe_sig_handler(int sig __attribute__((unused)));
my_bool
stmt_close
(
MYSQL_STMT
*
stmt
,
my_bool
skip_free
);
my_bool
stmt_close
(
MYSQL_STMT
*
stmt
,
my_bool
skip_free
);
void
read_user_name
(
char
*
name
);
void
read_user_name
(
char
*
name
);
my_bool
send_file_to_server
(
MYSQL
*
mysql
,
const
char
*
filename
);
my_bool
send_file_to_server
(
MYSQL
*
mysql
,
const
char
*
filename
);
void
set_mysql_error
(
MYSQL
*
mysql
,
int
errcode
,
const
char
*
sqlstate
);
/*
/*
Let the user specify that we don't want SIGPIPE; This doesn't however work
Let the user specify that we don't want SIGPIPE; This doesn't however work
...
...
libmysql/libmysql.c
View file @
a1834919
...
@@ -1544,21 +1544,6 @@ void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
...
@@ -1544,21 +1544,6 @@ void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
}
}
/*
Set the internal error message to mysql handler
*/
static
void
set_mysql_error
(
MYSQL
*
mysql
,
int
errcode
,
const
char
*
sqlstate
)
{
DBUG_ENTER
(
"set_mysql_error"
);
DBUG_PRINT
(
"enter"
,
(
"error :%d '%s'"
,
errcode
,
ER
(
errcode
)));
DBUG_ASSERT
(
mysql
!=
0
);
mysql
->
net
.
last_errno
=
errcode
;
strmov
(
mysql
->
net
.
last_error
,
ER
(
errcode
));
strmov
(
mysql
->
net
.
sqlstate
,
sqlstate
);
}
/*
/*
Reallocate the NET package to be at least of 'length' bytes
Reallocate the NET package to be at least of 'length' bytes
...
@@ -2872,7 +2857,7 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
...
@@ -2872,7 +2857,7 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
{
{
/*
/*
Set param->is_null to point to a dummy variable if it's not set.
Set param->is_null to point to a dummy variable if it's not set.
This is to make the excute code easier
This is to make the ex
e
cute code easier
*/
*/
if
(
!
param
->
is_null
)
if
(
!
param
->
is_null
)
param
->
is_null
=
&
param
->
internal_is_null
;
param
->
is_null
=
&
param
->
internal_is_null
;
...
@@ -3142,8 +3127,7 @@ MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt)
...
@@ -3142,8 +3127,7 @@ MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt)
if
(
!
(
result
=
(
MYSQL_DATA
*
)
my_malloc
(
sizeof
(
MYSQL_DATA
),
if
(
!
(
result
=
(
MYSQL_DATA
*
)
my_malloc
(
sizeof
(
MYSQL_DATA
),
MYF
(
MY_WME
|
MY_ZEROFILL
))))
MYF
(
MY_WME
|
MY_ZEROFILL
))))
{
{
set_stmt_errmsg
(
stmt
,
ER
(
CR_OUT_OF_MEMORY
),
CR_OUT_OF_MEMORY
,
set_stmt_error
(
stmt
,
CR_OUT_OF_MEMORY
,
unknown_sqlstate
);
unknown_sqlstate
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
init_alloc_root
(
&
result
->
alloc
,
8192
,
0
);
/* Assume rowlength < 8192 */
init_alloc_root
(
&
result
->
alloc
,
8192
,
0
);
/* Assume rowlength < 8192 */
...
@@ -3159,8 +3143,7 @@ MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt)
...
@@ -3159,8 +3143,7 @@ MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt)
!
(
cur
->
data
=
((
MYSQL_ROW
)
alloc_root
(
&
result
->
alloc
,
pkt_len
))))
!
(
cur
->
data
=
((
MYSQL_ROW
)
alloc_root
(
&
result
->
alloc
,
pkt_len
))))
{
{
free_rows
(
result
);
free_rows
(
result
);
set_stmt_errmsg
(
stmt
,
ER
(
CR_OUT_OF_MEMORY
),
CR_OUT_OF_MEMORY
,
set_stmt_error
(
stmt
,
CR_OUT_OF_MEMORY
,
unknown_sqlstate
);
unknown_sqlstate
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
*
prev_ptr
=
cur
;
*
prev_ptr
=
cur
;
...
...
sql-common/client.c
View file @
a1834919
...
@@ -585,11 +585,8 @@ net_safe_read(MYSQL *mysql)
...
@@ -585,11 +585,8 @@ net_safe_read(MYSQL *mysql)
return
(
packet_error
);
return
(
packet_error
);
#endif
/*MYSQL_SERVER*/
#endif
/*MYSQL_SERVER*/
end_server
(
mysql
);
end_server
(
mysql
);
net
->
last_errno
=
(
net
->
last_errno
==
ER_NET_PACKET_TOO_LARGE
?
set_mysql_error
(
mysql
,
net
->
last_errno
==
ER_NET_PACKET_TOO_LARGE
?
CR_NET_PACKET_TOO_LARGE:
CR_NET_PACKET_TOO_LARGE:
CR_SERVER_LOST
,
unknown_sqlstate
);
CR_SERVER_LOST
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
return
(
packet_error
);
return
(
packet_error
);
}
}
if
(
net
->
read_pos
[
0
]
==
255
)
if
(
net
->
read_pos
[
0
]
==
255
)
...
@@ -609,11 +606,8 @@ net_safe_read(MYSQL *mysql)
...
@@ -609,11 +606,8 @@ net_safe_read(MYSQL *mysql)
min
((
uint
)
len
,(
uint
)
sizeof
(
net
->
last_error
)
-
1
));
min
((
uint
)
len
,(
uint
)
sizeof
(
net
->
last_error
)
-
1
));
}
}
else
else
{
set_mysql_error
(
mysql
,
CR_UNKNOWN_ERROR
,
unknown_sqlstate
);
net
->
last_errno
=
CR_UNKNOWN_ERROR
;
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
}
DBUG_PRINT
(
"error"
,(
"Got error: %d/%s (%s)"
,
DBUG_PRINT
(
"error"
,(
"Got error: %d/%s (%s)"
,
net
->
last_errno
,
net
->
sqlstate
,
net
->
last_error
));
net
->
last_errno
,
net
->
sqlstate
,
net
->
last_error
));
return
(
packet_error
);
return
(
packet_error
);
...
@@ -649,8 +643,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
...
@@ -649,8 +643,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
}
}
if
(
mysql
->
status
!=
MYSQL_STATUS_READY
)
if
(
mysql
->
status
!=
MYSQL_STATUS_READY
)
{
{
strmov
(
net
->
last_error
,
ER
(
mysql
->
net
.
last_errno
=
CR_COMMANDS_OUT_OF_SYNC
));
set_mysql_error
(
mysql
,
CR_COMMANDS_OUT_OF_SYNC
,
unknown_sqlstate
);
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
return
1
;
return
1
;
}
}
...
@@ -704,6 +697,24 @@ void free_old_query(MYSQL *mysql)
...
@@ -704,6 +697,24 @@ void free_old_query(MYSQL *mysql)
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
/*
Set the internal error message to mysql handler
*/
void
set_mysql_error
(
MYSQL
*
mysql
,
int
errcode
,
const
char
*
sqlstate
)
{
NET
*
net
;
DBUG_ENTER
(
"set_mysql_error"
);
DBUG_PRINT
(
"enter"
,
(
"error :%d '%s'"
,
errcode
,
ER
(
errcode
)));
DBUG_ASSERT
(
mysql
!=
0
);
net
=
&
mysql
->
net
;
net
->
last_errno
=
errcode
;
strmov
(
net
->
last_error
,
ER
(
errcode
));
strmov
(
net
->
sqlstate
,
sqlstate
);
}
#ifdef __WIN__
#ifdef __WIN__
static
my_bool
is_NT
(
void
)
static
my_bool
is_NT
(
void
)
{
{
...
@@ -1164,9 +1175,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
...
@@ -1164,9 +1175,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
if
(
!
(
result
=
(
MYSQL_DATA
*
)
my_malloc
(
sizeof
(
MYSQL_DATA
),
if
(
!
(
result
=
(
MYSQL_DATA
*
)
my_malloc
(
sizeof
(
MYSQL_DATA
),
MYF
(
MY_WME
|
MY_ZEROFILL
))))
MYF
(
MY_WME
|
MY_ZEROFILL
))))
{
{
net
->
last_errno
=
CR_OUT_OF_MEMORY
;
set_mysql_error
(
mysql
,
CR_OUT_OF_MEMORY
,
unknown_sqlstate
);
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
init_alloc_root
(
&
result
->
alloc
,
8192
,
0
);
/* Assume rowlength < 8192 */
init_alloc_root
(
&
result
->
alloc
,
8192
,
0
);
/* Assume rowlength < 8192 */
...
@@ -1193,9 +1202,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
...
@@ -1193,9 +1202,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
(
fields
+
1
)
*
sizeof
(
char
*
)
+
pkt_len
))))
(
fields
+
1
)
*
sizeof
(
char
*
)
+
pkt_len
))))
{
{
free_rows
(
result
);
free_rows
(
result
);
net
->
last_errno
=
CR_OUT_OF_MEMORY
;
set_mysql_error
(
mysql
,
CR_OUT_OF_MEMORY
,
unknown_sqlstate
);
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
*
prev_ptr
=
cur
;
*
prev_ptr
=
cur
;
...
@@ -1214,9 +1221,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
...
@@ -1214,9 +1221,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
if
(
len
>
(
ulong
)
(
end_to
-
to
))
if
(
len
>
(
ulong
)
(
end_to
-
to
))
{
{
free_rows
(
result
);
free_rows
(
result
);
net
->
last_errno
=
CR_MALFORMED_PACKET
;
set_mysql_error
(
mysql
,
CR_MALFORMED_PACKET
,
unknown_sqlstate
);
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
memcpy
(
to
,(
char
*
)
cp
,
len
);
to
[
len
]
=
0
;
memcpy
(
to
,(
char
*
)
cp
,
len
);
to
[
len
]
=
0
;
...
@@ -1287,9 +1292,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
...
@@ -1287,9 +1292,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
{
{
if
(
len
>
(
ulong
)
(
end_pos
-
pos
))
if
(
len
>
(
ulong
)
(
end_pos
-
pos
))
{
{
net
->
last_errno
=
CR_UNKNOWN_ERROR
;
set_mysql_error
(
mysql
,
CR_UNKNOWN_ERROR
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
return
-
1
;
return
-
1
;
}
}
row
[
field
]
=
(
char
*
)
pos
;
row
[
field
]
=
(
char
*
)
pos
;
...
@@ -1675,9 +1678,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -1675,9 +1678,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
if
(
!
net
->
vio
)
if
(
!
net
->
vio
)
{
{
DBUG_PRINT
(
"error"
,(
"Unknow protocol %d "
,
mysql
->
options
.
protocol
));
DBUG_PRINT
(
"error"
,(
"Unknow protocol %d "
,
mysql
->
options
.
protocol
));
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
set_mysql_error
(
mysql
,
CR_CONN_UNKNOW_PROTOCOL
,
unknown_sqlstate
);
net
->
last_errno
=
CR_CONN_UNKNOW_PROTOCOL
;
strmov
(
net
->
last_error
,
ER
(
CR_CONN_UNKNOW_PROTOCOL
));
goto
error
;
goto
error
;
}
}
...
@@ -1685,9 +1686,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -1685,9 +1686,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
{
{
vio_delete
(
net
->
vio
);
vio_delete
(
net
->
vio
);
net
->
vio
=
0
;
net
->
vio
=
0
;
net
->
last_errno
=
CR_OUT_OF_MEMORY
;
set_mysql_error
(
mysql
,
CR_OUT_OF_MEMORY
,
unknown_sqlstate
);
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
goto
error
;
goto
error
;
}
}
vio_keepalive
(
net
->
vio
,
TRUE
);
vio_keepalive
(
net
->
vio
,
TRUE
);
...
@@ -1704,9 +1703,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -1704,9 +1703,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
if
(
mysql
->
options
.
connect_timeout
&&
if
(
mysql
->
options
.
connect_timeout
&&
vio_poll_read
(
net
->
vio
,
mysql
->
options
.
connect_timeout
))
vio_poll_read
(
net
->
vio
,
mysql
->
options
.
connect_timeout
))
{
{
net
->
last_errno
=
CR_SERVER_LOST
;
set_mysql_error
(
mysql
,
CR_SERVER_LOST
,
unknown_sqlstate
);
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
goto
error
;
goto
error
;
}
}
...
@@ -1760,8 +1757,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -1760,8 +1757,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
if
(
mysql
->
options
.
secure_auth
&&
passwd
[
0
]
&&
if
(
mysql
->
options
.
secure_auth
&&
passwd
[
0
]
&&
!
(
mysql
->
server_capabilities
&
CLIENT_SECURE_CONNECTION
))
!
(
mysql
->
server_capabilities
&
CLIENT_SECURE_CONNECTION
))
{
{
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
set_mysql_error
(
mysql
,
CR_SECURE_AUTH
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
=
CR_SECURE_AUTH
));
goto
error
;
goto
error
;
}
}
...
@@ -1815,8 +1811,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -1815,8 +1811,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
!
(
mysql
->
user
=
my_strdup
(
user
,
MYF
(
0
)))
||
!
(
mysql
->
user
=
my_strdup
(
user
,
MYF
(
0
)))
||
!
(
mysql
->
passwd
=
my_strdup
(
passwd
,
MYF
(
0
))))
!
(
mysql
->
passwd
=
my_strdup
(
passwd
,
MYF
(
0
))))
{
{
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
set_mysql_error
(
mysql
,
CR_OUT_OF_MEMORY
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
=
CR_OUT_OF_MEMORY
));
goto
error
;
goto
error
;
}
}
strmov
(
mysql
->
host_info
,
host_info
);
strmov
(
mysql
->
host_info
,
host_info
);
...
@@ -1883,9 +1878,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -1883,9 +1878,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
struct
st_mysql_options
*
options
=
&
mysql
->
options
;
struct
st_mysql_options
*
options
=
&
mysql
->
options
;
if
(
my_net_write
(
net
,
buff
,(
uint
)
(
end
-
buff
))
||
net_flush
(
net
))
if
(
my_net_write
(
net
,
buff
,(
uint
)
(
end
-
buff
))
||
net_flush
(
net
))
{
{
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
set_mysql_error
(
mysql
,
CR_SERVER_LOST
,
unknown_sqlstate
);
net
->
last_errno
=
CR_SERVER_LOST
;
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
goto
error
;
goto
error
;
}
}
/* Do the SSL layering. */
/* Do the SSL layering. */
...
@@ -1896,18 +1889,14 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -1896,18 +1889,14 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
options
->
ssl_capath
,
options
->
ssl_capath
,
options
->
ssl_cipher
)))
options
->
ssl_cipher
)))
{
{
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
set_mysql_error
(
mysql
,
CR_SSL_CONNECTION_ERROR
,
unknown_sqlstate
);
net
->
last_errno
=
CR_SSL_CONNECTION_ERROR
;
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
goto
error
;
goto
error
;
}
}
DBUG_PRINT
(
"info"
,
(
"IO layer change in progress..."
));
DBUG_PRINT
(
"info"
,
(
"IO layer change in progress..."
));
if
(
sslconnect
((
struct
st_VioSSLConnectorFd
*
)(
mysql
->
connector_fd
),
if
(
sslconnect
((
struct
st_VioSSLConnectorFd
*
)(
mysql
->
connector_fd
),
mysql
->
net
.
vio
,
(
long
)
(
mysql
->
options
.
connect_timeout
)))
mysql
->
net
.
vio
,
(
long
)
(
mysql
->
options
.
connect_timeout
)))
{
{
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
set_mysql_error
(
mysql
,
CR_SSL_CONNECTION_ERROR
,
unknown_sqlstate
);
net
->
last_errno
=
CR_SSL_CONNECTION_ERROR
;
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
goto
error
;
goto
error
;
}
}
DBUG_PRINT
(
"info"
,
(
"IO layer change done!"
));
DBUG_PRINT
(
"info"
,
(
"IO layer change done!"
));
...
@@ -1956,9 +1945,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -1956,9 +1945,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* Write authentication package */
/* Write authentication package */
if
(
my_net_write
(
net
,
buff
,(
ulong
)
(
end
-
buff
))
||
net_flush
(
net
))
if
(
my_net_write
(
net
,
buff
,(
ulong
)
(
end
-
buff
))
||
net_flush
(
net
))
{
{
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
set_mysql_error
(
mysql
,
CR_SERVER_LOST
,
unknown_sqlstate
);
net
->
last_errno
=
CR_SERVER_LOST
;
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
goto
error
;
goto
error
;
}
}
...
@@ -1980,9 +1967,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -1980,9 +1967,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
scramble_323
(
buff
,
mysql
->
scramble
,
passwd
);
scramble_323
(
buff
,
mysql
->
scramble
,
passwd
);
if
(
my_net_write
(
net
,
buff
,
SCRAMBLE_LENGTH_323
+
1
)
||
net_flush
(
net
))
if
(
my_net_write
(
net
,
buff
,
SCRAMBLE_LENGTH_323
+
1
)
||
net_flush
(
net
))
{
{
net
->
last_errno
=
CR_SERVER_LOST
;
set_mysql_error
(
mysql
,
CR_SERVER_LOST
,
unknown_sqlstate
);
strmov
(
net
->
sqlstate
,
unknown_sqlstate
);
strmov
(
net
->
last_error
,
ER
(
net
->
last_errno
));
goto
error
;
goto
error
;
}
}
/* Read what server thinks about out new auth message report */
/* Read what server thinks about out new auth message report */
...
@@ -2077,9 +2062,7 @@ my_bool mysql_reconnect(MYSQL *mysql)
...
@@ -2077,9 +2062,7 @@ my_bool mysql_reconnect(MYSQL *mysql)
{
{
/* Allow reconnect next time */
/* Allow reconnect next time */
mysql
->
server_status
&=
~
SERVER_STATUS_IN_TRANS
;
mysql
->
server_status
&=
~
SERVER_STATUS_IN_TRANS
;
strmov
(
mysql
->
net
.
sqlstate
,
unknown_sqlstate
);
set_mysql_error
(
mysql
,
CR_SERVER_GONE_ERROR
,
unknown_sqlstate
);
mysql
->
net
.
last_errno
=
CR_SERVER_GONE_ERROR
;
strmov
(
mysql
->
net
.
last_error
,
ER
(
mysql
->
net
.
last_errno
));
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
mysql_init
(
&
tmp_mysql
);
mysql_init
(
&
tmp_mysql
);
...
@@ -2363,9 +2346,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql)
...
@@ -2363,9 +2346,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql)
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
if
(
mysql
->
status
!=
MYSQL_STATUS_GET_RESULT
)
if
(
mysql
->
status
!=
MYSQL_STATUS_GET_RESULT
)
{
{
strmov
(
mysql
->
net
.
sqlstate
,
unknown_sqlstate
);
set_mysql_error
(
mysql
,
CR_COMMANDS_OUT_OF_SYNC
,
unknown_sqlstate
);
strmov
(
mysql
->
net
.
last_error
,
ER
(
mysql
->
net
.
last_errno
=
CR_COMMANDS_OUT_OF_SYNC
));
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
mysql
->
status
=
MYSQL_STATUS_READY
;
/* server is ready */
mysql
->
status
=
MYSQL_STATUS_READY
;
/* server is ready */
...
@@ -2374,9 +2355,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql)
...
@@ -2374,9 +2355,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql)
mysql
->
field_count
),
mysql
->
field_count
),
MYF
(
MY_WME
|
MY_ZEROFILL
))))
MYF
(
MY_WME
|
MY_ZEROFILL
))))
{
{
strmov
(
mysql
->
net
.
sqlstate
,
unknown_sqlstate
);
set_mysql_error
(
mysql
,
CR_OUT_OF_MEMORY
,
unknown_sqlstate
);
mysql
->
net
.
last_errno
=
CR_OUT_OF_MEMORY
;
strmov
(
mysql
->
net
.
last_error
,
ER
(
mysql
->
net
.
last_errno
));
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
result
->
methods
=
mysql
->
methods
;
result
->
methods
=
mysql
->
methods
;
...
@@ -2421,9 +2400,7 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql)
...
@@ -2421,9 +2400,7 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql)
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
if
(
mysql
->
status
!=
MYSQL_STATUS_GET_RESULT
)
if
(
mysql
->
status
!=
MYSQL_STATUS_GET_RESULT
)
{
{
strmov
(
mysql
->
net
.
sqlstate
,
unknown_sqlstate
);
set_mysql_error
(
mysql
,
CR_COMMANDS_OUT_OF_SYNC
,
unknown_sqlstate
);
strmov
(
mysql
->
net
.
last_error
,
ER
(
mysql
->
net
.
last_errno
=
CR_COMMANDS_OUT_OF_SYNC
));
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
if
(
!
(
result
=
(
MYSQL_RES
*
)
my_malloc
(
sizeof
(
*
result
)
+
if
(
!
(
result
=
(
MYSQL_RES
*
)
my_malloc
(
sizeof
(
*
result
)
+
...
@@ -2592,3 +2569,4 @@ const char * STDCALL mysql_error(MYSQL *mysql)
...
@@ -2592,3 +2569,4 @@ const char * STDCALL mysql_error(MYSQL *mysql)
{
{
return
mysql
->
net
.
last_error
;
return
mysql
->
net
.
last_error
;
}
}
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