Commit 6a2fbae6 authored by unknown's avatar unknown

Remove/change unwanted variables in client protocol

Add missed mysql_stmt_affected_rows()
sql_yacc.yy : Fix the compilation error .. bison 1.75


sql/sql_yacc.yy:
  Fix the compilarion error .. bison 1.75
parent a91caf8f
......@@ -501,12 +501,12 @@ int STDCALL mysql_multi_query(MYSQL *mysql,const char *query,
unsigned long len);
MYSQL_RES *STDCALL mysql_next_result(MYSQL *mysql);
MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt);
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
/* new status messages */
#define MYSQL_SUCCESS 0
#define MYSQL_WARNING 1
#define MYSQL_STATUS_ERROR 2
#define MYSQL_STATUS_ERROR 1
#define MYSQL_NO_DATA 100
#define MYSQL_NEED_DATA 99
#define MYSQL_NULL_DATA (-1)
......
......@@ -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,
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);
else
{
......@@ -4189,7 +4190,7 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt)
for (param= stmt->params; param < param_end; param++)
{
/* 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)
DBUG_RETURN(MYSQL_NEED_DATA);
......@@ -4224,6 +4225,14 @@ ulong STDCALL mysql_param_count(MYSQL_STMT * stmt)
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
......@@ -4257,7 +4266,7 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
param++)
{
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_STRING))
{
......@@ -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 */
switch (param->buffer_type) {
case MYSQL_TYPE_NULL:
param->is_null= 1;
param->bind_length= MYSQL_NULL_DATA;
break;
case MYSQL_TYPE_TINY:
param->bind_length= 1;
......@@ -4788,6 +4797,11 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
DBUG_ASSERT(stmt != 0);
#ifdef CHECK_EXTRA_ARGUMENTS
if (stmt->state == MY_ST_UNKNOWN)
{
set_stmt_error(stmt, CR_NO_PREPARE_STMT);
DBUG_RETURN(1);
}
if (!bind)
{
set_stmt_error(stmt, CR_NULL_POINTER);
......@@ -4916,7 +4930,7 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt)
{
set_stmt_errmsg(stmt,(char *)mysql->net.last_error,
mysql->net.last_errno);
DBUG_RETURN(MYSQL_STATUS_ERROR);
DBUG_RETURN(1);
}
DBUG_PRINT("info", ("end of data"));
DBUG_RETURN(MYSQL_NO_DATA); /* no more data */
......
......@@ -321,10 +321,13 @@ static bool setup_params_data(PREP_STMT *stmt)
if (!param->long_data_supplied)
{
if (IS_PARAM_NULL(pos,param_no))
param->maybe_null=param->null_value=1;
param->maybe_null= param->null_value= 1;
else
{
param->maybe_null= param->null_value= 0;
param->setup_param_func(param,&read_pos);
}
}
param_no++;
}
DBUG_RETURN(0);
......
......@@ -1382,7 +1382,7 @@ opt_unique_or_fulltext:
key_alg:
/* empty */ { $$= HA_KEY_ALG_UNDEF; }
| USING opt_btree_or_rtree { $$= $2; };
| USING opt_btree_or_rtree { $$= $2; }
| TYPE_SYM opt_btree_or_rtree { $$= $2; };
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