summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-06-05 00:12:45 +0300
committerunknown <monty@narttu.mysql.fi>2003-06-05 00:12:45 +0300
commitad5e39bf12b7aeefbc313e464a1349541a7b15c5 (patch)
tree824e127f68404d3fbe881d6619e34ad389d21202 /libmysqld
parent020baadcfebbd0f2248d9a3fa15f29d6e9d954b4 (diff)
parentc6c60f6ee819a238ab62e3f9608502c9a8f25b36 (diff)
downloadmariadb-git-ad5e39bf12b7aeefbc313e464a1349541a7b15c5.tar.gz
merge with public tree
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union client/mysql.cc: Auto merged configure.in: Auto merged include/config-win.h: Auto merged include/mysql.h: Auto merged include/mysql_version.h.in: Auto merged libmysqld/lib_sql.cc: Auto merged mysql-test/r/alter_table.result: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/ctype_collate.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/type_blob.result: Auto merged mysql-test/t/subselect.test: Auto merged mysys/default.c: Auto merged sql/Makefile.am: Auto merged sql/field.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/protocol.cc: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_string.h: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/Makefile.am2
-rw-r--r--libmysqld/libmysqld.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
index c3c99583ad9..92fc588eda3 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -43,7 +43,7 @@ sqlsources = derror.cc field.cc field_conv.cc filesort.cc \
item.cc item_buff.cc item_cmpfunc.cc item_create.cc \
item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc \
item_geofunc.cc item_uniq.cc item_subselect.cc item_row.cc\
- key.cc lock.cc log.cc log_event.cc \
+ key.cc lock.cc log.cc log_event.cc sql_state.c \
protocol.cc net_serv.cc opt_ft.cc opt_range.cc \
opt_sum.cc procedure.cc records.cc sql_acl.cc \
sql_load.cc sql_olap.cc \
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index e6166f6bbe5..a2d69b30c0d 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -450,6 +450,7 @@ static inline int mysql_init_charset(MYSQL *mysql)
if (!mysql->charset)
{
mysql->last_errno=CR_CANT_READ_CHARSET;
+ strmov(mysql->sqlstate, "HY0000");
if (mysql->options.charset_dir)
sprintf(mysql->last_error,ER(mysql->last_errno),
charset_name ? charset_name : "unknown",
@@ -1130,6 +1131,7 @@ mysql_stat(MYSQL *mysql)
if (!mysql->net.read_pos[0])
{
mysql->net.last_errno=CR_WRONG_HOST_INFO;
+ strmov(mysql->sqlstate, unknown_sqlstate);
strmov(mysql->net.last_error, ER(mysql->net.last_errno));
return mysql->net.last_error;
}
@@ -1284,12 +1286,12 @@ unsigned int STDCALL mysql_field_count(MYSQL *mysql)
my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql)
{
- return (mysql)->affected_rows;
+ return mysql->affected_rows;
}
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql)
{
- return (mysql)->insert_id;
+ return mysql->insert_id;
}
uint STDCALL mysql_errno(MYSQL *mysql)
@@ -1297,6 +1299,11 @@ uint STDCALL mysql_errno(MYSQL *mysql)
return mysql->last_errno;
}
+const char *STDCALL mysql_sqlstate(MYSQL *mysql)
+{
+ return mysql->sqlstate;
+}
+
const char * STDCALL mysql_error(MYSQL *mysql)
{
return mysql->last_error;