summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-05-26 19:01:20 +0300
committerunknown <monty@mashka.mysql.fi>2003-05-26 19:01:20 +0300
commit5d3eec14dd3e8b2e4656e5559114650bee54a5e6 (patch)
tree8384ed6e6835d6903702a8f44da157d99f0ff97c /include
parent3565727359aaea5f2fab3740d71d36fb9015f77a (diff)
downloadmariadb-git-5d3eec14dd3e8b2e4656e5559114650bee54a5e6.tar.gz
New 4.1 protocol; SQLSTATE, CLIENT_MULTI_RESULTS, client character set
Docs/internals.texi: Updated protocol information include/mysql.h: Added catalog to MYSQL_FIELD Added sqlstate handling to protocol include/mysql_com.h: New 4.1 protocol libmysql/libmysql.c: Added sqlstate handling Added CLIENT_MULTI_RESULTS sql/field.cc: Indentation cleanup sql/field.h: Indentation cleanup sql/mysql_priv.h: Changed arguments to close_connection() sql/mysqld.cc: Changed arguments to close_connection() Added checking of extra arguments to mysqld sql/protocol.cc: Fixed bug in TIME handling Added SQLSTATE on errors Removed net_send_error() sql/protocol.h: Removed net_send_error() sql/repl_failsafe.cc: Fixed arguments to close_connection() sql/sql_parse.cc: New 4.1 protocol
Diffstat (limited to 'include')
-rw-r--r--include/mysql.h5
-rw-r--r--include/mysql_com.h17
2 files changed, 15 insertions, 7 deletions
diff --git a/include/mysql.h b/include/mysql.h
index 67dc9ae08c9..94f2152655d 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -83,6 +83,7 @@ typedef struct st_mysql_field {
char *table; /* Table of column if column was a field */
char *org_table; /* Org table name, if table was an alias */
char *db; /* Database for table */
+ char *catalog; /* Catalog for table */
char *def; /* Default value (set by mysql_list_fields) */
unsigned long length; /* Width of column */
unsigned long max_length; /* Max width of selected set */
@@ -91,6 +92,7 @@ typedef struct st_mysql_field {
unsigned int table_length;
unsigned int org_table_length;
unsigned int db_length;
+ unsigned int catalog_length;
unsigned int def_length;
unsigned int flags; /* Div flags */
unsigned int decimals; /* Number of decimals in field */
@@ -346,6 +348,7 @@ my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
unsigned int STDCALL mysql_errno(MYSQL *mysql);
const char * STDCALL mysql_error(MYSQL *mysql);
+const char *STDCALL mysql_sqlstate(MYSQL *mysql);
unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
const char * STDCALL mysql_info(MYSQL *mysql);
unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
@@ -543,6 +546,7 @@ typedef struct st_mysql_stmt
unsigned int last_errno; /* error code */
enum PREP_STMT_STATE state; /* statement state */
char last_error[MYSQL_ERRMSG_SIZE]; /* error message */
+ char sqlstate[SQLSTATE_LENGTH+1];
my_bool long_alloced; /* flag to indicate long alloced */
my_bool send_types_to_server; /* Types sent to server */
my_bool param_buffers; /* param bound buffers */
@@ -560,6 +564,7 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
+const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt);
my_bool STDCALL mysql_commit(MYSQL * mysql);
my_bool STDCALL mysql_rollback(MYSQL * mysql);
my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
diff --git a/include/mysql_com.h b/include/mysql_com.h
index bbfb869927b..e2fa30e3a18 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -25,6 +25,7 @@
#define HOSTNAME_LENGTH 60
#define USERNAME_LENGTH 16
#define SERVER_VERSION_LENGTH 60
+#define SQLSTATE_LENGTH 6
#define LOCAL_HOST "localhost"
#define LOCAL_HOST_NAMEDPIPE "."
@@ -100,20 +101,22 @@ enum enum_server_command
#define CLIENT_ODBC 64 /* Odbc client */
#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */
#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */
+#define CLIENT_PROTOCOL_41 512 /* New 4.1 protocol */
#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */
-#define CLIENT_SSL 2048 /* Switch to SSL after handshake */
-#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
+#define CLIENT_SSL 2048 /* Switch to SSL after handshake */
+#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
-#define CLIENT_PROTOCOL_41 16384 /* New 4.1 protocol */
-#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
-#define CLIENT_MULTI_QUERIES 65536 /* Enable/disable multi query support */
+#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
+#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
+#define CLIENT_MULTI_QUERIES 65536 /* Enable/disable multiquery support */
+#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
#define SERVER_STATUS_MORE_RESULTS 4 /* More results on server */
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
-#define MYSQL_ERRMSG_SIZE 200
+#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /* Timeout on read */
#define NET_WRITE_TIMEOUT 60 /* Timeout on write */
#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */
@@ -149,7 +152,7 @@ typedef struct st_net {
queries in cache that have not stored its results yet
*/
#endif
- char last_error[MYSQL_ERRMSG_SIZE];
+ char last_error[MYSQL_ERRMSG_SIZE], sqlstate[SQLSTATE_LENGTH+1];
unsigned int last_errno;
unsigned char error;
gptr query_cache_query;