From fac1344a6b27fd7bdef89bbbc6f21f5e59b5c4ec Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Thu, 18 Apr 2013 22:29:59 +0300 Subject: [PATCH] Silence compiler warnings about variables set but not used. --- bind.c | 2 -- connection.c | 5 +---- convert.c | 3 --- execute.c | 13 ++++++------- results.c | 12 +----------- statement.c | 3 +-- 6 files changed, 9 insertions(+), 29 deletions(-) diff --git a/bind.c b/bind.c index db6afc3..cb53087 100644 --- a/bind.c +++ b/bind.c @@ -319,7 +319,6 @@ PGAPI_DescribeParam( { StatementClass *stmt = (StatementClass *) hstmt; CSTR func = "PGAPI_DescribeParam"; - APDFields *apdopts; IPDFields *ipdopts; RETCODE ret = SQL_SUCCESS; int num_params; @@ -334,7 +333,6 @@ PGAPI_DescribeParam( } SC_clear_error(stmt); - apdopts = SC_get_APDF(stmt); ipdopts = SC_get_IPDF(stmt); /*if ((ipar < 1) || (ipar > ipdopts->allocated))*/ num_params = stmt->num_params; diff --git a/connection.c b/connection.c index 288b914..87e70d3 100644 --- a/connection.c +++ b/connection.c @@ -3279,7 +3279,6 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_ { CSTR func = "CC_send_function"; char id, - c, done; SocketClass *sock = self->sock; @@ -3424,7 +3423,7 @@ inolog("send_func response_length=%d\n", response_length); } if (beforeV3) { - c = SOCK_get_char(sock); /* get the last '0' */ + SOCK_get_char(sock); /* get the last '0' */ if (beforeV2) done = TRUE; resultResponse = FALSE; @@ -3732,7 +3731,6 @@ static void CC_lookup_pg_version(ConnectionClass *self) { HSTMT hstmt; - StatementClass *stmt; RETCODE result; char szVersion[32]; int major, @@ -3748,7 +3746,6 @@ CC_lookup_pg_version(ConnectionClass *self) result = PGAPI_AllocStmt(self, &hstmt, 0); if (!SQL_SUCCEEDED(result)) return; - stmt = (StatementClass *) hstmt; /* get the server's version if possible */ result = PGAPI_ExecDirect(hstmt, "select version()", SQL_NTS, 0); diff --git a/convert.c b/convert.c index 14ab061..ea30157 100644 --- a/convert.c +++ b/convert.c @@ -2876,7 +2876,6 @@ copy_statement_with_parameters(StatementClass *stmt, BOOL buildPrepareStatement) BOOL begin_first = FALSE, prepare_dummy_cursor = FALSE, bPrepConv; ConnectionClass *conn = SC_get_conn(stmt); ConnInfo *ci = &(conn->connInfo); - SQLLEN current_row; const char *bestitem = NULL; inolog("%s: enter prepared=%d\n", func, stmt->prepared); @@ -2886,7 +2885,6 @@ inolog("%s: enter prepared=%d\n", func, stmt->prepared); return SQL_ERROR; } - current_row = stmt->exec_current_row < 0 ? 0 : stmt->exec_current_row; qp = &query_org; QP_initialize(qp, stmt); @@ -3916,7 +3914,6 @@ ResolveOneParam(QueryBuild *qb, QueryParse *qp) CSTR func = "ResolveOneParam"; ConnectionClass *conn = qb->conn; - ConnInfo *ci = &(conn->connInfo); const APDFields *apdopts = qb->apdopts; const IPDFields *ipdopts = qb->ipdopts; PutDataInfo *pdata = qb->pdata; diff --git a/execute.c b/execute.c index 2bc4fde..ba034f9 100644 --- a/execute.c +++ b/execute.c @@ -462,8 +462,7 @@ inolog("prepare_before_exec=%d srv=%d\n", prepare_before_exec, conn->connInfo.us if (stmt->inaccurate_result && SC_is_parse_tricky(stmt)) { BOOL in_trans = CC_is_in_trans(conn); - BOOL issued_begin = FALSE, - begin_included = FALSE; + BOOL issued_begin = FALSE; QResultClass *curres; stmt->exec_current_row = -1; @@ -471,7 +470,9 @@ inolog("prepare_before_exec=%d srv=%d\n", prepare_before_exec, conn->connInfo.us if (!SC_is_pre_executable(stmt)) return SQL_SUCCESS; if (strnicmp(stmt->stmt_with_params, "BEGIN;", 6) == 0) - begin_included = TRUE; + { + /* do nothing */ + } else if (!in_trans) { if (issued_begin = CC_begin(conn), !issued_begin) @@ -1240,7 +1241,6 @@ PGAPI_Cancel( ConnectionClass *conn; RETCODE ret = SQL_SUCCESS; BOOL entered_cs = FALSE; - ConnInfo *ci; mylog("%s: entering...\n", func); @@ -1251,7 +1251,6 @@ PGAPI_Cancel( return SQL_INVALID_HANDLE; } conn = SC_get_conn(stmt); - ci = &(conn->connInfo); #define return DONT_CALL_RETURN_FROM_HERE??? /* StartRollbackState(stmt); */ @@ -1289,6 +1288,8 @@ PGAPI_Cancel( if (conn->driver_version < 0x0350) { #ifdef WIN32 + ConnInfo *ci = &(conn->connInfo); + if (ci->drivers.cancel_as_freestmt) { typedef SQLRETURN (SQL_API *SQLAPIPROC)(); @@ -1410,7 +1411,6 @@ PGAPI_ParamData( int i; Int2 num_p; ConnectionClass *conn = NULL; - ConnInfo *ci; mylog("%s: entering...\n", func); @@ -1421,7 +1421,6 @@ PGAPI_ParamData( goto cleanup; } conn = SC_get_conn(stmt); - ci = &(conn->connInfo); estmt = stmt->execute_delegate ? stmt->execute_delegate : stmt; apdopts = SC_get_APDF(estmt); diff --git a/results.c b/results.c index a6f5aaf..ea7d0e2 100644 --- a/results.c +++ b/results.c @@ -45,7 +45,6 @@ PGAPI_RowCount( CSTR func = "PGAPI_RowCount"; StatementClass *stmt = (StatementClass *) hstmt; QResultClass *res; - ConnInfo *ci; mylog("%s: entering...\n", func); if (!stmt) @@ -53,7 +52,6 @@ PGAPI_RowCount( SC_log_error(func, NULL_STRING, NULL); return SQL_INVALID_HANDLE; } - ci = &(SC_get_conn(stmt)->connInfo); if (stmt->proc_return > 0) { if (pcrow) @@ -151,7 +149,6 @@ PGAPI_NumResultCols( StatementClass *stmt = (StatementClass *) hstmt; QResultClass *result; char parse_ok; - ConnInfo *ci; RETCODE ret = SQL_SUCCESS; mylog("%s: entering...\n", func); @@ -160,7 +157,6 @@ PGAPI_NumResultCols( SC_log_error(func, NULL_STRING, NULL); return SQL_INVALID_HANDLE; } - ci = &(SC_get_conn(stmt)->connInfo); SC_clear_error(stmt); #define return DONT_CALL_RETURN_FROM_HERE??? @@ -917,7 +913,6 @@ PGAPI_GetData( void *value = NULL; RETCODE result = SQL_SUCCESS; char get_bookmark = FALSE; - ConnInfo *ci; SQLSMALLINT target_type; int precision = -1; @@ -928,7 +923,6 @@ PGAPI_GetData( SC_log_error(func, NULL_STRING, NULL); return SQL_INVALID_HANDLE; } - ci = &(SC_get_conn(stmt)->connInfo); res = SC_get_Curres(stmt); if (STMT_EXECUTING == stmt->status) @@ -1410,11 +1404,9 @@ PGAPI_ExtendedFetch( BindInfoClass *bookmark; SQLLEN num_tuples, i, fc_io; SQLLEN save_rowset_size, progress_size; - SQLLEN save_rowset_start, - rowset_start; + SQLLEN rowset_start; RETCODE result = SQL_SUCCESS; char truncated, error, should_set_rowset_start = FALSE; - ConnInfo *ci; SQLLEN currp; UWORD pstatus; BOOL currp_is_valid, reached_eof, useCursor; @@ -1426,7 +1418,6 @@ PGAPI_ExtendedFetch( SC_log_error(func, NULL_STRING, NULL); return SQL_INVALID_HANDLE; } - ci = &(SC_get_conn(stmt)->connInfo); /* if (SC_is_fetchcursor(stmt) && !stmt->manual_result) */ if (SQL_CURSOR_FORWARD_ONLY == stmt->options.cursor_type) @@ -1495,7 +1486,6 @@ PGAPI_ExtendedFetch( inolog("num_tuples=%d\n", num_tuples); /* Save and discard the saved rowset size */ - save_rowset_start = SC_get_rowset_start(stmt); save_rowset_size = stmt->save_rowset_size; stmt->save_rowset_size = -1; rowset_start = SC_get_rowset_start(stmt); diff --git a/statement.c b/statement.c index 09b2cce..2512313 100644 --- a/statement.c +++ b/statement.c @@ -169,7 +169,6 @@ PGAPI_AllocStmt(HDBC hdbc, ConnectionClass *conn = (ConnectionClass *) hdbc; StatementClass *stmt; ARDFields *ardopts; - BindInfoClass *bookmark; mylog("%s: entering...\n", func); @@ -214,7 +213,7 @@ PGAPI_AllocStmt(HDBC hdbc, InitializeARDFields(&stmt->ardi.ardopts); } ardopts = SC_get_ARDF(stmt); - bookmark = ARD_AllocBookmark(ardopts); + ARD_AllocBookmark(ardopts); stmt->stmt_size_limit = CC_get_max_query_len(conn); /* Save the handle for later */ -- 2.39.5