summaryrefslogtreecommitdiff
path: root/sql-common/client.c
diff options
context:
space:
mode:
authorkostja@bodhi.(none) <>2007-10-31 23:48:41 +0300
committerkostja@bodhi.(none) <>2007-10-31 23:48:41 +0300
commitc26aef8fc6a026808fc41f78c55440bfe7c5a008 (patch)
treec8bb5acf54006b60617572bd0a3aae8db3b9aea5 /sql-common/client.c
parent3154b2bee4dc99b3313081effe2ac9c4c4a487f9 (diff)
downloadmariadb-git-c26aef8fc6a026808fc41f78c55440bfe7c5a008.tar.gz
Try to fix a Windows compilation warning.
Diffstat (limited to 'sql-common/client.c')
-rw-r--r--sql-common/client.c125
1 files changed, 70 insertions, 55 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index e92a9bd0cdc..5ece9c39d6c 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -272,6 +272,76 @@ static int wait_for_data(my_socket fd, uint timeout)
}
#endif /* defined(__WIN__) || defined(__NETWARE__) */
+/**
+ Set the internal error message to mysql handler
+
+ @param mysql connection handle (client side)
+ @param errcode CR_ error code, passed to ER macro to get
+ error text
+ @parma sqlstate SQL standard sqlstate
+*/
+
+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);
+
+ DBUG_VOID_RETURN;
+}
+
+/**
+ Clear possible error state of struct NET
+
+ @param net clear the state of the argument
+*/
+
+void net_clear_error(NET *net)
+{
+ net->last_errno= 0;
+ net->last_error[0]= '\0';
+ strmov(net->sqlstate, not_error_sqlstate);
+}
+
+/**
+ Set an error message on the client.
+
+ @param mysql connection handle
+ @param errcode CR_* errcode, for client errors
+ @param sqlstate SQL standard sql state, unknown_sqlstate for the
+ majority of client errors.
+ @param format error message template, in sprintf format
+ @param ... variable number of arguments
+*/
+
+static void set_mysql_extended_error(MYSQL *mysql, int errcode,
+ const char *sqlstate,
+ const char *format, ...)
+{
+ NET *net;
+ va_list args;
+ DBUG_ENTER("set_mysql_extended_error");
+ DBUG_PRINT("enter", ("error :%d '%s'", errcode, format));
+ DBUG_ASSERT(mysql != 0);
+
+ net= &mysql->net;
+ net->last_errno= errcode;
+ va_start(args, format);
+ my_vsnprintf(net->last_error, sizeof(net->last_error)-1,
+ format, args);
+ va_end(args);
+ strmov(net->sqlstate, sqlstate);
+
+ DBUG_VOID_RETURN;
+}
+
+
/*
Create a named pipe connection
@@ -728,61 +798,6 @@ void free_old_query(MYSQL *mysql)
}
/*
- 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);
-
- DBUG_VOID_RETURN;
-}
-
-/**
- Clear possible error state of struct NET
-
- @param net clear the state of the argument
-*/
-
-void net_clear_error(NET *net)
-{
- net->last_errno= 0;
- net->last_error[0]= '\0';
- strmov(net->sqlstate, not_error_sqlstate);
-}
-
-
-static void set_mysql_extended_error(MYSQL *mysql, int errcode,
- const char *sqlstate,
- const char *format, ...)
-{
- NET *net;
- va_list args;
- DBUG_ENTER("set_mysql_extended_error");
- DBUG_PRINT("enter", ("error :%d '%s'", errcode, format));
- DBUG_ASSERT(mysql != 0);
-
- net= &mysql->net;
- net->last_errno= errcode;
- va_start(args, format);
- my_vsnprintf(net->last_error, sizeof(net->last_error)-1,
- format, args);
- va_end(args);
- strmov(net->sqlstate, sqlstate);
-
- DBUG_VOID_RETURN;
-}
-
-
-/*
Flush result set sent from server
*/