From d33d693ef15bc923a9b64c4a8eca2e042cd1a0e8 Mon Sep 17 00:00:00 2001 From: freemine Date: Thu, 8 Oct 2020 12:19:33 +0800 Subject: [PATCH] remove obsoletes, ignore->ignored for better understanding --- src/connector/odbc/src/todbc.c | 72 --------------------------------- src/connector/odbc/tests/main.c | 22 +++++----- 2 files changed, 11 insertions(+), 83 deletions(-) diff --git a/src/connector/odbc/src/todbc.c b/src/connector/odbc/src/todbc.c index 58659a2346..1a14d4b3b1 100644 --- a/src/connector/odbc/src/todbc.c +++ b/src/connector/odbc/src/todbc.c @@ -729,14 +729,6 @@ SQLRETURN SQL_API SQLBindParameter( } // LengthPrecision ignored; // ParameterScale ignored; - // if (LengthPrecision != sizeof(v.b)) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] not matching length precision", ParameterNumber); - // return SQL_ERROR; - // } - // if (ParameterScale != 0) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] scale not supported yet", ParameterNumber); - // return SQL_ERROR; - // } param_bind_t *ar = (param_bind_t*)(sql->n_params>=ParameterNumber ? sql->params : realloc(sql->params, ParameterNumber * sizeof(*ar))); TAOS_BIND *binds = (TAOS_BIND*)(sql->n_params>=ParameterNumber ? sql->binds : realloc(sql->binds, ParameterNumber * sizeof(*binds))); if (!ar || !binds) { @@ -770,14 +762,6 @@ SQLRETURN SQL_API SQLBindParameter( } // LengthPrecision ignored; // ParameterScale ignored; - // if (LengthPrecision != sizeof(v.v1)) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] not matching length precision", ParameterNumber); - // return SQL_ERROR; - // } - // if (ParameterScale != 0) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] scale not supported yet", ParameterNumber); - // return SQL_ERROR; - // } param_bind_t *ar = (param_bind_t*)(sql->n_params>=ParameterNumber ? sql->params : realloc(sql->params, ParameterNumber * sizeof(*ar))); TAOS_BIND *binds = (TAOS_BIND*)(sql->n_params>=ParameterNumber ? sql->binds : realloc(sql->binds, ParameterNumber * sizeof(*binds))); if (!ar || !binds) { @@ -811,14 +795,6 @@ SQLRETURN SQL_API SQLBindParameter( } // LengthPrecision ignored; // ParameterScale ignored; - // if (LengthPrecision != sizeof(v.v2)) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] not matching length precision", ParameterNumber); - // return SQL_ERROR; - // } - // if (ParameterScale != 0) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] scale not supported yet", ParameterNumber); - // return SQL_ERROR; - // } param_bind_t *ar = (param_bind_t*)(sql->n_params>=ParameterNumber ? sql->params : realloc(sql->params, ParameterNumber * sizeof(*ar))); TAOS_BIND *binds = (TAOS_BIND*)(sql->n_params>=ParameterNumber ? sql->binds : realloc(sql->binds, ParameterNumber * sizeof(*binds))); if (!ar || !binds) { @@ -852,14 +828,6 @@ SQLRETURN SQL_API SQLBindParameter( } // LengthPrecision ignored; // ParameterScale ignored; - // if (LengthPrecision != sizeof(v.v4)) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] not matching length precision", ParameterNumber); - // return SQL_ERROR; - // } - // if (ParameterScale != 0) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] scale not supported yet", ParameterNumber); - // return SQL_ERROR; - // } param_bind_t *ar = (param_bind_t*)(sql->n_params>=ParameterNumber ? sql->params : realloc(sql->params, ParameterNumber * sizeof(*ar))); TAOS_BIND *binds = (TAOS_BIND*)(sql->n_params>=ParameterNumber ? sql->binds : realloc(sql->binds, ParameterNumber * sizeof(*binds))); if (!ar || !binds) { @@ -893,14 +861,6 @@ SQLRETURN SQL_API SQLBindParameter( } // LengthPrecision ignored; // ParameterScale ignored; - // if (LengthPrecision != sizeof(v.v8)) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] not matching length precision", ParameterNumber); - // return SQL_ERROR; - // } - // if (ParameterScale != 0) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] scale not supported yet", ParameterNumber); - // return SQL_ERROR; - // } param_bind_t *ar = (param_bind_t*)(sql->n_params>=ParameterNumber ? sql->params : realloc(sql->params, ParameterNumber * sizeof(*ar))); TAOS_BIND *binds = (TAOS_BIND*)(sql->n_params>=ParameterNumber ? sql->binds : realloc(sql->binds, ParameterNumber * sizeof(*binds))); if (!ar || !binds) { @@ -934,14 +894,6 @@ SQLRETURN SQL_API SQLBindParameter( } // LengthPrecision ignored; // ParameterScale ignored; - // if (LengthPrecision != sizeof(v.f4)) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] not matching length precision", ParameterNumber); - // return SQL_ERROR; - // } - // if (ParameterScale != 0) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] scale not supported yet", ParameterNumber); - // return SQL_ERROR; - // } param_bind_t *ar = (param_bind_t*)(sql->n_params>=ParameterNumber ? sql->params : realloc(sql->params, ParameterNumber * sizeof(*ar))); TAOS_BIND *binds = (TAOS_BIND*)(sql->n_params>=ParameterNumber ? sql->binds : realloc(sql->binds, ParameterNumber * sizeof(*binds))); if (!ar || !binds) { @@ -975,14 +927,6 @@ SQLRETURN SQL_API SQLBindParameter( } // LengthPrecision ignored; // ParameterScale ignored; - // if (LengthPrecision != sizeof(v.f8)) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] not matching length precision", ParameterNumber); - // return SQL_ERROR; - // } - // if (ParameterScale != 0) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] scale not supported yet", ParameterNumber); - // return SQL_ERROR; - // } param_bind_t *ar = (param_bind_t*)(sql->n_params>=ParameterNumber ? sql->params : realloc(sql->params, ParameterNumber * sizeof(*ar))); TAOS_BIND *binds = (TAOS_BIND*)(sql->n_params>=ParameterNumber ? sql->binds : realloc(sql->binds, ParameterNumber * sizeof(*binds))); if (!ar || !binds) { @@ -1016,14 +960,6 @@ SQLRETURN SQL_API SQLBindParameter( } // LengthPrecision ignored; // ParameterScale ignored; - // if (LengthPrecision != sizeof(v.v8)) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] not matching length precision", ParameterNumber); - // return SQL_ERROR; - // } - // if (ParameterScale != 0) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] scale not supported yet", ParameterNumber); - // return SQL_ERROR; - // } param_bind_t *ar = (param_bind_t*)(sql->n_params>=ParameterNumber ? sql->params : realloc(sql->params, ParameterNumber * sizeof(*ar))); TAOS_BIND *binds = (TAOS_BIND*)(sql->n_params>=ParameterNumber ? sql->binds : realloc(sql->binds, ParameterNumber * sizeof(*binds))); if (!ar || !binds) { @@ -1060,10 +996,6 @@ SQLRETURN SQL_API SQLBindParameter( return SQL_ERROR; } // ParameterScale ignored; - // if (ParameterScale != 0) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] scale not supported yet", ParameterNumber); - // return SQL_ERROR; - // } param_bind_t *ar = (param_bind_t*)(sql->n_params>=ParameterNumber ? sql->params : realloc(sql->params, ParameterNumber * sizeof(*ar))); TAOS_BIND *binds = (TAOS_BIND*)(sql->n_params>=ParameterNumber ? sql->binds : realloc(sql->binds, ParameterNumber * sizeof(*binds))); if (!ar || !binds) { @@ -1100,10 +1032,6 @@ SQLRETURN SQL_API SQLBindParameter( return SQL_ERROR; } // ParameterScale ignored; - // if (ParameterScale != 0) { - // SET_ERROR(sql, "HY000", TSDB_CODE_COM_OPS_NOT_SUPPORT, "parameter [@%d] scale not supported yet", ParameterNumber); - // return SQL_ERROR; - // } param_bind_t *ar = (param_bind_t*)(sql->n_params>=ParameterNumber ? sql->params : realloc(sql->params, ParameterNumber * sizeof(*ar))); TAOS_BIND *binds = (TAOS_BIND*)(sql->n_params>=ParameterNumber ? sql->binds : realloc(sql->binds, ParameterNumber * sizeof(*binds))); if (!ar || !binds) { diff --git a/src/connector/odbc/tests/main.c b/src/connector/odbc/tests/main.c index 1680e22620..980194f27a 100644 --- a/src/connector/odbc/tests/main.c +++ b/src/connector/odbc/tests/main.c @@ -58,7 +58,7 @@ static int do_insert(SQLHSTMT stmt, data_t data) { SQLLEN lblob; const char *statement = "insert into t values (?, ?, ?, ?, ?, ?, ?, ?, ?,?)"; - int ignore = 0; + int ignored = 0; do { fprintf(stderr, "prepare [%s]\n", statement); @@ -66,46 +66,46 @@ static int do_insert(SQLHSTMT stmt, data_t data) { if (r) break; fprintf(stderr, "bind 1 [%s]\n", statement); - r = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_SBIGINT, SQL_TIMESTAMP, ignore, ignore, &data.ts, ignore, NULL); + r = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_SBIGINT, SQL_TIMESTAMP, ignored, ignored, &data.ts, ignored, NULL); if (r) break; fprintf(stderr, "bind 2 [%s]\n", statement); - r = SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_BIT, SQL_BIT, ignore, ignore, &data.b, ignore, NULL); + r = SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_BIT, SQL_BIT, ignored, ignored, &data.b, ignored, NULL); if (r) break; fprintf(stderr, "bind 3 [%s]\n", statement); - r = SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_TINYINT, SQL_TINYINT, ignore, ignore, &data.v1, ignore, NULL); + r = SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_TINYINT, SQL_TINYINT, ignored, ignored, &data.v1, ignored, NULL); if (r) break; fprintf(stderr, "bind 4 [%s]\n", statement); - r = SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_SHORT, SQL_SMALLINT, ignore, ignore, &data.v2, ignore, NULL); + r = SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_SHORT, SQL_SMALLINT, ignored, ignored, &data.v2, ignored, NULL); if (r) break; fprintf(stderr, "bind 5 [%s]\n", statement); - r = SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, ignore, ignore, &data.v4, ignore, NULL); + r = SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, ignored, ignored, &data.v4, ignored, NULL); if (r) break; fprintf(stderr, "bind 6 [%s]\n", statement); - r = SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_SBIGINT, SQL_BIGINT, ignore, ignore, &data.v8, ignore, NULL); + r = SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_SBIGINT, SQL_BIGINT, ignored, ignored, &data.v8, ignored, NULL); if (r) break; fprintf(stderr, "bind 7 [%s]\n", statement); - r = SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_FLOAT, SQL_FLOAT, ignore, ignore, &data.f4, ignore, NULL); + r = SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_FLOAT, SQL_FLOAT, ignored, ignored, &data.f4, ignored, NULL); if (r) break; fprintf(stderr, "bind 8 [%s]\n", statement); SQLLEN l8 = SQL_NULL_DATA; - r = SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_DOUBLE, ignore, ignore, &data.f8, ignore, &l8); + r = SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_DOUBLE, ignored, ignored, &data.f8, ignored, &l8); if (r) break; fprintf(stderr, "bind 9 [%s]\n", statement); lbin = SQL_NTS; - r = SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_VARBINARY, sizeof(data.bin)-1, ignore, &data.bin, ignore, &lbin); + r = SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_VARBINARY, sizeof(data.bin)-1, ignored, &data.bin, ignored, &lbin); if (r) break; fprintf(stderr, "bind 10 [%s]\n", statement); lblob = SQL_NTS; - r = SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(data.blob)-1, ignore, &data.blob, ignore, &lblob); + r = SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(data.blob)-1, ignored, &data.blob, ignored, &lblob); if (r) break; fprintf(stderr, "execute [%s]\n", statement); -- GitLab