OCT 解决数据库一条命令设置多个相同类型值被覆盖的问题

This commit is contained in:
mengqingchao 2019-07-29 16:50:52 +08:00
parent ec916db6fb
commit c26c7db68f
1 changed files with 18 additions and 18 deletions

View File

@ -242,9 +242,9 @@ int update_database(int module_id, void * db_handle, int op_type, char * tabl
int type; int type;
int len; int len;
SQLLEN ind_name = SQL_NTS; SQLLEN ind_name = SQL_NTS;
long long int_temp; long long int_temp[DB_ROWS + 1];
va_list ap; va_list ap;
double double_temp; double double_temp[DB_ROWS + 1];
SQLPrepare(hstmt, sql_str, SQL_NTS); SQLPrepare(hstmt, sql_str, SQL_NTS);
@ -258,8 +258,8 @@ int update_database(int module_id, void * db_handle, int op_type, char * tabl
if (DB_DATA_INT_TYPE == type) if (DB_DATA_INT_TYPE == type)
{ {
int_temp = va_arg(ap, long long); int_temp[i] = va_arg(ap, long long);
ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_UBIGINT, SQL_C_UBIGINT, len, 0, &int_temp, len, &ind_name); ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_UBIGINT, SQL_C_UBIGINT, len, 0, &int_temp[i], len, &ind_name);
} }
else if (DB_DATA_STRING_TYPE == type) else if (DB_DATA_STRING_TYPE == type)
{ {
@ -267,8 +267,8 @@ int update_database(int module_id, void * db_handle, int op_type, char * tabl
} }
else if (DB_DATA_FLOAT_TYPE == type) else if (DB_DATA_FLOAT_TYPE == type)
{ {
double_temp = va_arg(ap, double); double_temp[i] = va_arg(ap, double);
ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_DOUBLE, len, 0, &double_temp, len, &ind_name); ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_DOUBLE, len, 0, &double_temp[i], len, &ind_name);
} }
else else
{ {
@ -400,9 +400,9 @@ void * select_datebase_by_number(int module_id, void * db_handle, char * table_
int type; int type;
int len; int len;
SQLLEN ind_name = SQL_NTS; SQLLEN ind_name = SQL_NTS;
long long int_temp; long long int_temp[DB_ROWS + 1];
va_list ap; va_list ap;
double double_temp; double double_temp[DB_ROWS + 1];
SQLPrepare(hstmt, sql_str, SQL_NTS); SQLPrepare(hstmt, sql_str, SQL_NTS);
@ -415,8 +415,8 @@ void * select_datebase_by_number(int module_id, void * db_handle, char * table_
if (DB_DATA_INT_TYPE == type) if (DB_DATA_INT_TYPE == type)
{ {
int_temp = va_arg(ap, long long); int_temp[i] = va_arg(ap, long long);
ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_UBIGINT, SQL_C_UBIGINT, len, 0, &int_temp, len, &ind_name); ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_UBIGINT, SQL_C_UBIGINT, len, 0, &int_temp[i], len, &ind_name);
} }
else if (DB_DATA_STRING_TYPE == type) else if (DB_DATA_STRING_TYPE == type)
{ {
@ -424,8 +424,8 @@ void * select_datebase_by_number(int module_id, void * db_handle, char * table_
} }
else if (DB_DATA_FLOAT_TYPE == type) else if (DB_DATA_FLOAT_TYPE == type)
{ {
double_temp = va_arg(ap, double); double_temp[i] = va_arg(ap, double);
ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_DOUBLE, len, 0, &double_temp, len, &ind_name); ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_DOUBLE, len, 0, &double_temp[i], len, &ind_name);
} }
else else
{ {
@ -674,9 +674,9 @@ int get_select_datebase_number(int module_id, void * db_handle, char * table_n
int type; int type;
int len; int len;
SQLLEN ind_name = SQL_NTS; SQLLEN ind_name = SQL_NTS;
long long int_temp; long long int_temp[DB_ROWS + 1];
va_list ap; va_list ap;
double double_temp; double double_temp[DB_ROWS + 1];
SQLPrepare(hstmt, sql_str, SQL_NTS); SQLPrepare(hstmt, sql_str, SQL_NTS);
@ -689,8 +689,8 @@ int get_select_datebase_number(int module_id, void * db_handle, char * table_n
if (DB_DATA_INT_TYPE == type) if (DB_DATA_INT_TYPE == type)
{ {
int_temp = va_arg(ap, long long); int_temp[i] = va_arg(ap, long long);
ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_UBIGINT, SQL_C_UBIGINT, len, 0, &int_temp, len, &ind_name); ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_UBIGINT, SQL_C_UBIGINT, len, 0, &int_temp[i], len, &ind_name);
} }
else if (DB_DATA_STRING_TYPE == type) else if (DB_DATA_STRING_TYPE == type)
{ {
@ -698,8 +698,8 @@ int get_select_datebase_number(int module_id, void * db_handle, char * table_n
} }
else if (DB_DATA_FLOAT_TYPE == type) else if (DB_DATA_FLOAT_TYPE == type)
{ {
double_temp = va_arg(ap, double); double_temp[i] = va_arg(ap, double);
ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_DOUBLE, len, 0, &double_temp, len, &ind_name); ret = SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_DOUBLE, len, 0, &double_temp[i], len, &ind_name);
} }
else else
{ {