summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2003-12-01 16:14:40 +0100
committerunknown <pem@mysql.com>2003-12-01 16:14:40 +0100
commit38f853d291075a8eaa9d408a23626b09aa7ac1d2 (patch)
tree024f2d18e3cf9f65db53f9f8c2d5413859781e16 /libmysql
parent6573b851e36de43d4cfa39d5eba0b740c3226521 (diff)
parent91de6fdbce2a5c545532acf1124f35378a75ea0c (diff)
downloadmariadb-git-38f853d291075a8eaa9d408a23626b09aa7ac1d2.tar.gz
Merge 4.1 to 5.0
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union configure.in: Auto merged client/mysql.cc: Auto merged client/mysqltest.c: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/mysql_com.h: Auto merged libmysql/libmysql.c: Auto merged myisam/mi_check.c: Auto merged myisam/myisamchk.c: Auto merged myisam/myisamdef.h: Auto merged myisam/sort.c: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/symlink.result: Auto merged mysql-test/t/subselect.test: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol.h: Auto merged sql/protocol_cursor.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_derived.cc: Auto merged sql/sql_error.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_list.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_test.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/client_settings.h18
-rw-r--r--libmysql/conf_to_src.c4
-rw-r--r--libmysql/errmsg.c9
-rw-r--r--libmysql/libmysql.c84
4 files changed, 63 insertions, 52 deletions
diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h
index 582f9613ee0..3798eaa3544 100644
--- a/libmysql/client_settings.h
+++ b/libmysql/client_settings.h
@@ -43,18 +43,18 @@ my_bool send_file_to_server(MYSQL *mysql, const char *filename);
void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group);
-MYSQL * STDCALL
+MYSQL *
cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag);
-void STDCALL cli_mysql_close(MYSQL *mysql);
+void cli_mysql_close(MYSQL *mysql);
-MYSQL_FIELD * STDCALL cli_list_fields(MYSQL *mysql);
-my_bool STDCALL cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt);
-MYSQL_DATA * STDCALL cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
+MYSQL_FIELD * cli_list_fields(MYSQL *mysql);
+my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt);
+MYSQL_DATA * cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
uint fields);
-int STDCALL cli_stmt_execute(MYSQL_STMT *stmt);
-MYSQL_DATA * STDCALL cli_read_binary_rows(MYSQL_STMT *stmt);
-int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row);
-const char * STDCALL cli_read_statistic(MYSQL *mysql);
+int cli_stmt_execute(MYSQL_STMT *stmt);
+MYSQL_DATA * cli_read_binary_rows(MYSQL_STMT *stmt);
+int cli_unbuffered_fetch(MYSQL *mysql, char **row);
+const char * cli_read_statistic(MYSQL *mysql);
diff --git a/libmysql/conf_to_src.c b/libmysql/conf_to_src.c
index 95ffcf1cb2b..8d931309abb 100644
--- a/libmysql/conf_to_src.c
+++ b/libmysql/conf_to_src.c
@@ -16,9 +16,9 @@
/* can't use -lmysys because this prog is used to create -lstrings */
+
+#include <my_global.h>
#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <unistd.h>
diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c
index 148625129b5..4dfcfe6a1d3 100644
--- a/libmysql/errmsg.c
+++ b/libmysql/errmsg.c
@@ -72,7 +72,8 @@ const char *client_errors[]=
"Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol",
"Invalid connection handle",
- "mysql_server_init wasn't called"
+ "mysql_server_init wasn't called",
+ "Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
};
/* Start of code added by Roberto M. Serqueira - martinsc@uol.com.br - 05.24.2001 */
@@ -128,7 +129,8 @@ const char *client_errors[]=
"Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol",
"Invalid connection handle",
- "mysql_server_init wasn't called"
+ "mysql_server_init wasn't called",
+ "Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
};
#else /* ENGLISH */
@@ -182,7 +184,8 @@ const char *client_errors[]=
"Can't open shared memory. Can't send the request event to server (%lu)",
"Wrong or unknown protocol",
"Invalid connection handle",
- "mysql_server_init wasn't called"
+ "mysql_server_init wasn't called",
+ "Connection using old (pre 4.1.1) authentication protocol refused (client option 'secure_auth' enabled)"
};
#endif
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index caa47ba7aad..b3ae6034520 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -15,10 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
-#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
-#include <winsock.h>
-#include <odbcinst.h>
-#endif
#include <my_sys.h>
#include <mysys_err.h>
#include <m_string.h>
@@ -811,29 +807,33 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host,
const char* passwd)
{
MYSQL* child;
- if (!(child = mysql_init(0)))
- return 0;
+ DBUG_ENTER("spawn_init");
+ if (!(child= mysql_init(0)))
+ DBUG_RETURN(0);
- child->options.user = my_strdup((user) ? user :
- (parent->user ? parent->user :
- parent->options.user), MYF(0));
- child->options.password = my_strdup((passwd) ? passwd :
- (parent->passwd ?
- parent->passwd :
- parent->options.password), MYF(0));
- child->options.port = port;
- child->options.host = my_strdup((host) ? host :
- (parent->host ?
- parent->host :
- parent->options.host), MYF(0));
+ child->options.user= my_strdup((user) ? user :
+ (parent->user ? parent->user :
+ parent->options.user), MYF(0));
+ child->options.password= my_strdup((passwd) ? passwd :
+ (parent->passwd ?
+ parent->passwd :
+ parent->options.password), MYF(0));
+ child->options.port= port;
+ child->options.host= my_strdup((host) ? host :
+ (parent->host ?
+ parent->host :
+ parent->options.host), MYF(0));
if (parent->db)
- child->options.db = my_strdup(parent->db, MYF(0));
+ child->options.db= my_strdup(parent->db, MYF(0));
else if (parent->options.db)
- child->options.db = my_strdup(parent->options.db, MYF(0));
-
- child->options.rpl_parse = child->options.rpl_probe = child->rpl_pivot = 0;
+ child->options.db= my_strdup(parent->options.db, MYF(0));
- return child;
+ /*
+ rpl_pivot is set to 1 in mysql_init(); Reset it as we are not doing
+ replication here
+ */
+ child->rpl_pivot= 0;
+ DBUG_RETURN(child);
}
@@ -846,9 +846,6 @@ STDCALL mysql_set_master(MYSQL* mysql, const char* host,
mysql_close(mysql->master);
if (!(mysql->master = spawn_init(mysql, host, port, user, passwd)))
return 1;
- mysql->master->rpl_pivot = 0;
- mysql->master->options.rpl_parse = 0;
- mysql->master->options.rpl_probe = 0;
return 0;
}
@@ -973,16 +970,16 @@ mysql_list_tables(MYSQL *mysql, const char *wild)
DBUG_RETURN (mysql_store_result(mysql));
}
-MYSQL_FIELD * STDCALL cli_list_fields(MYSQL *mysql)
+MYSQL_FIELD *cli_list_fields(MYSQL *mysql)
{
MYSQL_DATA *query;
if (!(query= cli_read_rows(mysql,(MYSQL_FIELD*) 0,
protocol_41(mysql) ? 8 : 6)))
return NULL;
- mysql->field_count= query->rows;
+ mysql->field_count= (uint) query->rows;
return unpack_fields(query,&mysql->field_alloc,
- query->rows, 1, mysql->server_capabilities);
+ mysql->field_count, 1, mysql->server_capabilities);
}
@@ -1112,7 +1109,7 @@ mysql_dump_debug_info(MYSQL *mysql)
DBUG_RETURN(simple_command(mysql,COM_DEBUG,0,0,0));
}
-const char * STDCALL cli_read_statistic(MYSQL *mysql)
+const char *cli_read_statistic(MYSQL *mysql)
{
mysql->net.read_pos[mysql->packet_length]=0; /* End of stat string */
if (!mysql->net.read_pos[0])
@@ -1589,7 +1586,7 @@ static my_bool my_realloc_str(NET *net, ulong length)
1 error
*/
-my_bool STDCALL cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
+my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
{
uchar *pos;
uint field_count;
@@ -2010,7 +2007,8 @@ static my_bool execute(MYSQL_STMT * stmt, char *packet, ulong length)
DBUG_RETURN(0);
}
-int STDCALL cli_stmt_execute(MYSQL_STMT *stmt)
+
+int cli_stmt_execute(MYSQL_STMT *stmt)
{
DBUG_ENTER("cli_stmt_execute");
@@ -2985,12 +2983,13 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
return 0;
}
-int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row)
+int cli_unbuffered_fetch(MYSQL *mysql, char **row)
{
if (packet_error == net_safe_read(mysql))
return 1;
- *row= (mysql->net.read_pos[0] == 254) ? NULL : (mysql->net.read_pos+1);
+ *row= ((mysql->net.read_pos[0] == 254) ? NULL :
+ (char*) (mysql->net.read_pos+1));
return 0;
}
@@ -3108,7 +3107,7 @@ no_data:
Read all rows of data from server (binary format)
*/
-MYSQL_DATA * STDCALL cli_read_binary_rows(MYSQL_STMT *stmt)
+MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt)
{
ulong pkt_len;
uchar *cp;
@@ -3318,7 +3317,7 @@ my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt)
my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt)
{
MYSQL *mysql;
- DBUG_ENTER("mysql_stmt_close");
+ DBUG_ENTER("mysql_stmt_free_result");
DBUG_ASSERT(stmt != 0);
@@ -3499,10 +3498,18 @@ my_bool STDCALL mysql_more_results(MYSQL *mysql)
Reads and returns the next query results
*/
-my_bool STDCALL mysql_next_result(MYSQL *mysql)
+int STDCALL mysql_next_result(MYSQL *mysql)
{
DBUG_ENTER("mysql_next_result");
+ if (mysql->status != MYSQL_STATUS_READY)
+ {
+ strmov(mysql->net.sqlstate, unknown_sqlstate);
+ strmov(mysql->net.last_error,
+ ER(mysql->net.last_errno=CR_COMMANDS_OUT_OF_SYNC));
+ DBUG_RETURN(1);
+ }
+
mysql->net.last_error[0]= 0;
mysql->net.last_errno= 0;
strmov(mysql->net.sqlstate, not_error_sqlstate);
@@ -3511,9 +3518,10 @@ my_bool STDCALL mysql_next_result(MYSQL *mysql)
if (mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS)
DBUG_RETURN((*mysql->methods->read_query_result)(mysql));
- DBUG_RETURN(0);
+ DBUG_RETURN(-1); /* No more results */
}
+
MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql)
{
return (*mysql->methods->use_result)(mysql);