diff options
author | unknown <monty@narttu.mysql.fi> | 2003-06-24 12:10:35 +0300 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-06-24 12:10:35 +0300 |
commit | 85bf4de6aafcdc4aa206398549ca1a5d14922ec8 (patch) | |
tree | 415b1821c33eac5fc78fcb02664dfd546daa9406 /libmysqld/libmysqld.c | |
parent | 20a2f6c5ee648cd7d1e2b7006419b287e2f93068 (diff) | |
download | mariadb-git-85bf4de6aafcdc4aa206398549ca1a5d14922ec8.tar.gz |
Fixed some new memory leaks
Updated VC++ files
VC++Files/client/mysql.dsp:
Update of VC++ files
VC++Files/client/mysqlclient.dsp:
Update of VC++ files
VC++Files/libmysqld/examples/test_libmysqld.dsp:
Update of VC++ files
VC++Files/libmysqld/libmysqld.def:
Update of VC++ files
VC++Files/libmysqld/libmysqld.dsp:
Update of VC++ files
VC++Files/myisam/myisam.dsp:
Update of VC++ files
VC++Files/mysql.dsw:
Update of VC++ files
VC++Files/sql/mysqld.dsp:
Update of VC++ files
include/mysql.h:
Add missing client functions to embedded server
libmysql/libmysql.def:
sort functions to enable comparison with libmysqld.def
libmysqld/libmysqld.c:
Add missing client functions to embedded server
libmysqld/libmysqld.def:
sort functions to enable comparison with libmysql.def
Added missing functions
myisam/mi_preload.c:
Fixed compiler warning.
Small code cleanup
scripts/make_win_src_distribution.sh:
Fixed typo
Don't run zip in verbose mode
scripts/mysql_create_system_tables.sh:
Change so that localhost has full access (to make this like 4.0)
scripts/mysql_fix_privilege_tables.sh:
Allow on to run this from the source distribution
sql-common/client.c:
Fixed memory leak
sql/item_sum.cc:
Removed compiler warning
sql/slave.cc:
Cleanup
sql/sql_client.cc:
Portability fix
sql/sql_help.cc:
Fixed memory leak
Diffstat (limited to 'libmysqld/libmysqld.c')
-rw-r--r-- | libmysqld/libmysqld.c | 102 |
1 files changed, 99 insertions, 3 deletions
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index a2d69b30c0d..ba2dfd68c00 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -49,6 +49,8 @@ static my_bool mysql_client_init=0; uint mysql_port=0; my_string mysql_unix_port=0; +const char *not_error_sqlstate= "00000"; + const char *sql_protocol_names_lib[] = { "TCP", "SOCKET", "PIPE", "MEMORY",NullS }; TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"", @@ -516,6 +518,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, client_flag&= ~CLIENT_COMPRESS; if (db) client_flag|=CLIENT_CONNECT_WITH_DB; + mysql->server_status= SERVER_STATUS_AUTOCOMMIT; if (mysql->options.init_commands) { @@ -1040,9 +1043,9 @@ mysql_list_fields(MYSQL *mysql __attribute__((unused)), const char *table __attr /* List all running processes (threads) in server */ MYSQL_RES * STDCALL -mysql_list_processes(MYSQL *mysql) +mysql_list_processes(MYSQL *mysql __attribute__((unused))) { -#ifdef DUMMY +#ifdef FOR_THE_FUTURE MYSQL_DATA *fields; uint field_count; uchar *pos; @@ -1063,7 +1066,7 @@ mysql_list_processes(MYSQL *mysql) mysql->status=MYSQL_STATUS_GET_RESULT; mysql->field_count=field_count; DBUG_RETURN(mysql_store_result(mysql)); -#endif /*DUMMY*/ +#endif /* FOR_THE_FUTURE */ return 0; } @@ -1535,3 +1538,96 @@ myodbc_remove_escape(MYSQL *mysql,char *name) } *to=0; } + + +/******************************************************************** + Transactional APIs +*********************************************************************/ + +/* + Commit the current transaction +*/ + +my_bool STDCALL mysql_commit(MYSQL * mysql) +{ + DBUG_ENTER("mysql_commit"); + DBUG_RETURN((my_bool) mysql_real_query(mysql, "commit", 6)); +} + +/* + Rollback the current transaction +*/ + +my_bool STDCALL mysql_rollback(MYSQL * mysql) +{ + DBUG_ENTER("mysql_rollback"); + DBUG_RETURN((my_bool) mysql_real_query(mysql, "rollback", 8)); +} + + +/* + Set autocommit to either true or false +*/ + +my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode) +{ + DBUG_ENTER("mysql_autocommit"); + DBUG_PRINT("enter", ("mode : %d", auto_mode)); + + if (auto_mode) /* set to true */ + DBUG_RETURN((my_bool) mysql_real_query(mysql, "set autocommit=1", 16)); + DBUG_RETURN((my_bool) mysql_real_query(mysql, "set autocommit=0", 16)); +} + + +/******************************************************************** + Multi query execution + SPs APIs +*********************************************************************/ + +/* + Returns if there are any more query results exists to be read using + mysql_next_result() +*/ + +my_bool STDCALL mysql_more_results(MYSQL *mysql) +{ + my_bool res; + DBUG_ENTER("mysql_more_results"); + + res= ((mysql->server_status & SERVER_MORE_RESULTS_EXISTS) ? + 1: 0); + DBUG_PRINT("exit",("More results exists ? %d", res)); + DBUG_RETURN(res); +} + + +/* + Reads and returns the next query results +*/ + +my_bool STDCALL mysql_next_result(MYSQL *mysql) +{ + DBUG_ENTER("mysql_next_result"); + + mysql->last_error[0]= 0; + mysql->last_errno= 0; + strmov(mysql->sqlstate, not_error_sqlstate); + mysql->affected_rows= ~(my_ulonglong) 0; + + if (mysql->server_status & SERVER_MORE_RESULTS_EXISTS) + DBUG_RETURN(mysql_read_query_result(mysql)); + + DBUG_RETURN(0); +} + + +my_bool STDCALL +mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , + const char *key __attribute__((unused)), + const char *cert __attribute__((unused)), + const char *ca __attribute__((unused)), + const char *capath __attribute__((unused)), + const char *cipher __attribute__((unused))) +{ + return 0; +} |