Commit 045b2f23 authored by venu@myvenu.com's avatar venu@myvenu.com

Remove/change unwanted variables in client protocol

Add missed mysql_stmt_affected_rows()
sql_yacc.yy : Fix the compilation error .. bison 1.75
parent 389aa45c
...@@ -501,16 +501,16 @@ int STDCALL mysql_multi_query(MYSQL *mysql,const char *query, ...@@ -501,16 +501,16 @@ int STDCALL mysql_multi_query(MYSQL *mysql,const char *query,
unsigned long len); unsigned long len);
MYSQL_RES *STDCALL mysql_next_result(MYSQL *mysql); MYSQL_RES *STDCALL mysql_next_result(MYSQL *mysql);
MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt); MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt);
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
/* new status messages */ /* new status messages */
#define MYSQL_SUCCESS 0 #define MYSQL_SUCCESS 0
#define MYSQL_WARNING 1 #define MYSQL_STATUS_ERROR 1
#define MYSQL_STATUS_ERROR 2 #define MYSQL_NO_DATA 100
#define MYSQL_NO_DATA 100 #define MYSQL_NEED_DATA 99
#define MYSQL_NEED_DATA 99 #define MYSQL_NULL_DATA (-1)
#define MYSQL_NULL_DATA (-1) #define MYSQL_LONG_DATA (-2)
#define MYSQL_LONG_DATA (-2)
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
......
...@@ -4097,7 +4097,8 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param) ...@@ -4097,7 +4097,8 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param)
DBUG_PRINT("enter",("type: %d, buffer:%lx, length: %d", param->buffer_type, DBUG_PRINT("enter",("type: %d, buffer:%lx, length: %d", param->buffer_type,
param->buffer ? param->buffer : "0", *param->length)); param->buffer ? param->buffer : "0", *param->length));
if (param->is_null || *param->length == MYSQL_NULL_DATA) if (param->buffer_type == MYSQL_TYPE_NULL ||
*param->length == MYSQL_NULL_DATA)
store_param_null(net, param); store_param_null(net, param);
else else
{ {
...@@ -4189,7 +4190,7 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt) ...@@ -4189,7 +4190,7 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt)
for (param= stmt->params; param < param_end; param++) for (param= stmt->params; param < param_end; param++)
{ {
/* Check for long data which has not been propery given/terminated */ /* Check for long data which has not been propery given/terminated */
if (param->is_long_data || *param->length == MYSQL_LONG_DATA) if (*param->length == MYSQL_LONG_DATA)
{ {
if (!param->long_ended) if (!param->long_ended)
DBUG_RETURN(MYSQL_NEED_DATA); DBUG_RETURN(MYSQL_NEED_DATA);
...@@ -4224,6 +4225,14 @@ ulong STDCALL mysql_param_count(MYSQL_STMT * stmt) ...@@ -4224,6 +4225,14 @@ ulong STDCALL mysql_param_count(MYSQL_STMT * stmt)
DBUG_RETURN(stmt->param_count); DBUG_RETURN(stmt->param_count);
} }
/*
Return total affected rows from the last statement
*/
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt)
{
return stmt->mysql->last_used_con->affected_rows;
}
/* /*
Setup the parameter data buffers from application Setup the parameter data buffers from application
...@@ -4257,7 +4266,7 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind) ...@@ -4257,7 +4266,7 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
param++) param++)
{ {
param->param_number= count++; param->param_number= count++;
if (param->is_long_data && if (param->length && *param->length == MYSQL_LONG_DATA &&
(param->buffer_type < MYSQL_TYPE_TINY_BLOB || (param->buffer_type < MYSQL_TYPE_TINY_BLOB ||
param->buffer_type > MYSQL_TYPE_STRING)) param->buffer_type > MYSQL_TYPE_STRING))
{ {
...@@ -4280,7 +4289,7 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind) ...@@ -4280,7 +4289,7 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
/* Setup data copy functions for the different supported types */ /* Setup data copy functions for the different supported types */
switch (param->buffer_type) { switch (param->buffer_type) {
case MYSQL_TYPE_NULL: case MYSQL_TYPE_NULL:
param->is_null= 1; param->bind_length= MYSQL_NULL_DATA;
break; break;
case MYSQL_TYPE_TINY: case MYSQL_TYPE_TINY:
param->bind_length= 1; param->bind_length= 1;
...@@ -4688,7 +4697,7 @@ static my_bool fetch_results(MYSQL_STMT *stmt, MYSQL_BIND *param, ...@@ -4688,7 +4697,7 @@ static my_bool fetch_results(MYSQL_STMT *stmt, MYSQL_BIND *param,
*/ */
sprintf(stmt->last_error, sprintf(stmt->last_error,
ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE), ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE),
param->buffer_type, param->param_number); param->buffer_type, param->param_number);
return 1; return 1;
} }
arg_length= 0; arg_length= 0;
...@@ -4788,6 +4797,11 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) ...@@ -4788,6 +4797,11 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
DBUG_ASSERT(stmt != 0); DBUG_ASSERT(stmt != 0);
#ifdef CHECK_EXTRA_ARGUMENTS #ifdef CHECK_EXTRA_ARGUMENTS
if (stmt->state == MY_ST_UNKNOWN)
{
set_stmt_error(stmt, CR_NO_PREPARE_STMT);
DBUG_RETURN(1);
}
if (!bind) if (!bind)
{ {
set_stmt_error(stmt, CR_NULL_POINTER); set_stmt_error(stmt, CR_NULL_POINTER);
...@@ -4914,9 +4928,9 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt) ...@@ -4914,9 +4928,9 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt)
mysql->status= MYSQL_STATUS_READY; mysql->status= MYSQL_STATUS_READY;
if (res < 0) /* Network error */ if (res < 0) /* Network error */
{ {
set_stmt_errmsg(stmt,(char *)mysql->net.last_error, set_stmt_errmsg(stmt,(char *)mysql->net.last_error,
mysql->net.last_errno); mysql->net.last_errno);
DBUG_RETURN(MYSQL_STATUS_ERROR); DBUG_RETURN(1);
} }
DBUG_PRINT("info", ("end of data")); DBUG_PRINT("info", ("end of data"));
DBUG_RETURN(MYSQL_NO_DATA); /* no more data */ DBUG_RETURN(MYSQL_NO_DATA); /* no more data */
......
...@@ -321,9 +321,12 @@ static bool setup_params_data(PREP_STMT *stmt) ...@@ -321,9 +321,12 @@ static bool setup_params_data(PREP_STMT *stmt)
if (!param->long_data_supplied) if (!param->long_data_supplied)
{ {
if (IS_PARAM_NULL(pos,param_no)) if (IS_PARAM_NULL(pos,param_no))
param->maybe_null=param->null_value=1; param->maybe_null= param->null_value= 1;
else else
{
param->maybe_null= param->null_value= 0;
param->setup_param_func(param,&read_pos); param->setup_param_func(param,&read_pos);
}
} }
param_no++; param_no++;
} }
......
...@@ -1382,7 +1382,7 @@ opt_unique_or_fulltext: ...@@ -1382,7 +1382,7 @@ opt_unique_or_fulltext:
key_alg: key_alg:
/* empty */ { $$= HA_KEY_ALG_UNDEF; } /* empty */ { $$= HA_KEY_ALG_UNDEF; }
| USING opt_btree_or_rtree { $$= $2; }; | USING opt_btree_or_rtree { $$= $2; }
| TYPE_SYM opt_btree_or_rtree { $$= $2; }; | TYPE_SYM opt_btree_or_rtree { $$= $2; };
opt_btree_or_rtree: opt_btree_or_rtree:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment