]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Minor fixes to compile on unix for v6-40-0002
authorByron Nikolaidis <byronn@insightdist.com>
Tue, 29 Dec 1998 14:59:30 +0000 (14:59 +0000)
committerByron Nikolaidis <byronn@insightdist.com>
Tue, 29 Dec 1998 14:59:30 +0000 (14:59 +0000)
src/interfaces/odbc/execute.c
src/interfaces/odbc/misc.h
src/interfaces/odbc/options.c
src/interfaces/odbc/qresult.c
src/interfaces/odbc/qresult.h
src/interfaces/odbc/results.c
src/interfaces/odbc/statement.c
src/interfaces/odbc/statement.h

index cad5a5ca15f215e072f033ff1a4dd79752ea7a46..59cfa450a10cb4f109672d41e73a9d71d7caa4bc 100644 (file)
@@ -372,8 +372,10 @@ RETCODE SQL_API SQLCancel(
 static char *func="SQLCancel";
 StatementClass *stmt = (StatementClass *) hstmt;
 RETCODE result;
+#ifdef WIN32
 HMODULE hmodule;
 FARPROC addr;
+#endif
 
        mylog( "%s: entering...\n", func);
 
index 8eca682d5aa2d2dd2325ea5822fbb91348a70257..10cb5114d13a0597e5217d632575e41f03761cef 100644 (file)
@@ -26,7 +26,7 @@
        portion of the registry.  You may have to manually add this key.
        This logfile is intended for development use, not for an end user!
 */
-// #define MY_LOG
+#define MY_LOG
 
 
 /*     Uncomment Q_LOG to compile in the qlog() statements (Communications log, i.e. CommLog).
index a263c98c2dd84d37ea36df1d5d5f771f861194f1..6621acadf54a135502363ce42e695c0f55ffd7ab 100644 (file)
 
 extern GLOBAL_VALUES globals;
 
+RETCODE set_statement_option(ConnectionClass *conn, 
+                                                        StatementClass *stmt, 
+                                                        UWORD   fOption,
+                                                        UDWORD  vParam);
+
+
 
 RETCODE set_statement_option(ConnectionClass *conn, 
                                                         StatementClass *stmt, 
index 8e5ffdf55c28e059d4a3f678fda19a7fb81df34b..c13b992b9b5703b8465de82b27910f9e0b52fe86 100644 (file)
@@ -77,7 +77,7 @@ QR_inc_base(QResultClass *self, int base_inc)
 /************************************/
 
 QResultClass *
-QR_Constructor()
+QR_Constructor(void)
 {
 QResultClass *rv;
 
index f26381fc2156065330723cf2e0fbb67e404f7e4c..efb60eefe0e726b3c32bd3e9e7a7d976bcda5c01 100644 (file)
@@ -98,7 +98,7 @@ struct QResultClass_ {
 #define QR_get_status(self)                            (self->status)
 
 //     Core Functions
-QResultClass *QR_Constructor();
+QResultClass *QR_Constructor(void);
 void QR_Destructor(QResultClass *self);
 char QR_read_tuple(QResultClass *self, char binary);
 int QR_next_tuple(QResultClass *self);
index 7f18f6a205fcbb8251975aa625b0fcd9fede12ba..7595fd5e3ba1ccc5f3749671f1f1116d737b704f 100644 (file)
@@ -740,139 +740,6 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
     }
 }
 
-RETCODE
-SC_fetch(StatementClass *stmt)
-{
-static char *func = "SC_fetch";
-QResultClass *res = stmt->result;
-int retval, result;
-Int2 num_cols, lf;
-Oid type;
-char *value;
-ColumnInfoClass *ci;
-// TupleField *tupleField;
-
-       stmt->last_fetch_count = 0;
-       ci = QR_get_fields(res);                /* the column info */
-
-       mylog("manual_result = %d, use_declarefetch = %d\n", stmt->manual_result, globals.use_declarefetch);
-       if ( stmt->manual_result || ! globals.use_declarefetch) {
-
-               if (stmt->currTuple >= QR_get_num_tuples(res) -1 || 
-                       (stmt->options.maxRows > 0 && stmt->currTuple == stmt->options.maxRows - 1)) {
-
-                       /*      if at the end of the tuples, return "no data found" 
-                               and set the cursor past the end of the result set 
-                       */
-                       stmt->currTuple = QR_get_num_tuples(res);       
-                       return SQL_NO_DATA_FOUND;
-               }
-               mylog("**** SQLFetch: manual_result\n");
-               (stmt->currTuple)++;
-       }
-       else {
-
-               // read from the cache or the physical next tuple
-               retval = QR_next_tuple(res);
-               if (retval < 0) {
-                       mylog("**** SQLFetch: end_tuples\n");
-                       return SQL_NO_DATA_FOUND;
-               }
-               else if (retval > 0)
-                       (stmt->currTuple)++;            // all is well
-
-               else {
-                       mylog("SQLFetch: error\n");
-                       stmt->errornumber = STMT_EXEC_ERROR;
-                       stmt->errormsg = "Error fetching next row";
-                       SC_log_error(func, "", stmt);
-                       return SQL_ERROR;
-               }
-       }
-
-       num_cols = QR_NumResultCols(res);
-
-       result = SQL_SUCCESS;
-       stmt->last_fetch_count = 1;
-
-       for (lf=0; lf < num_cols; lf++) {
-
-               mylog("fetch: cols=%d, lf=%d, stmt = %u, stmt->bindings = %u, buffer[] = %u\n", num_cols, lf, stmt, stmt->bindings, stmt->bindings[lf].buffer);
-
-               /*      reset for SQLGetData */
-               stmt->bindings[lf].data_left = -1;
-
-               if (stmt->bindings[lf].buffer != NULL) {
-            // this column has a binding
-
-            // type = QR_get_field_type(res, lf);
-                       type = CI_get_oid(ci, lf);              /* speed things up */
-
-                       mylog("type = %d\n", type);
-
-                       if (stmt->manual_result) {
-                               value = QR_get_value_manual(res, stmt->currTuple, lf);
-                               mylog("manual_result\n");
-                       }
-                       else if (globals.use_declarefetch)
-                               value = QR_get_value_backend(res, lf);
-                       else {
-                               value = QR_get_value_backend_row(res, stmt->currTuple, lf);
-                       }
-
-                       mylog("value = '%s'\n",  (value==NULL)?"<NULL>":value);
-
-                       retval = copy_and_convert_field_bindinfo(stmt, type, value, lf);
-
-                       mylog("copy_and_convert: retval = %d\n", retval);
-
-                       switch(retval) {
-                       case COPY_OK:
-                               break;  /*      OK, do next bound column */
-
-                       case COPY_UNSUPPORTED_TYPE:
-                               stmt->errormsg = "Received an unsupported type from Postgres.";
-                               stmt->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
-                               SC_log_error(func, "", stmt);
-                               result = SQL_ERROR;
-                               break;
-
-                       case COPY_UNSUPPORTED_CONVERSION:
-                               stmt->errormsg = "Couldn't handle the necessary data type conversion.";
-                               stmt->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
-                               SC_log_error(func, "", stmt);
-                               result = SQL_ERROR;
-                               break;
-
-                       case COPY_RESULT_TRUNCATED:
-                               stmt->errornumber = STMT_TRUNCATED;
-                               stmt->errormsg = "The buffer was too small for the result.";
-                               result = SQL_SUCCESS_WITH_INFO;
-                               break;
-
-                       case COPY_GENERAL_ERROR:        /* error msg already filled in */
-                               SC_log_error(func, "", stmt);
-                               result = SQL_ERROR;
-                               break;
-
-                       /*  This would not be meaningful in SQLFetch. */
-                       case COPY_NO_DATA_FOUND:
-                               break;
-
-                       default:
-                               stmt->errormsg = "Unrecognized return value from copy_and_convert_field.";
-                               stmt->errornumber = STMT_INTERNAL_ERROR;
-                               SC_log_error(func, "", stmt);
-                               result = SQL_ERROR;
-                               break;
-                       }
-               }
-       }
-
-       return result;
-}
 
 
 //      Returns data for bound columns in the current row ("hstmt->iCursor"),
index f185e2220a4ae4b07f7c0e0c1add4d5a05452cfe..86bce41a8f9427e1bc94c94a9f08d4fd0dfde1e9 100644 (file)
@@ -566,6 +566,142 @@ char rv;
        return rv;
 }
 
+
+RETCODE
+SC_fetch(StatementClass *self)
+{
+static char *func = "SC_fetch";
+QResultClass *res = self->result;
+int retval, result;
+Int2 num_cols, lf;
+Oid type;
+char *value;
+ColumnInfoClass *ci;
+// TupleField *tupleField;
+
+       self->last_fetch_count = 0;
+       ci = QR_get_fields(res);                /* the column info */
+
+       mylog("manual_result = %d, use_declarefetch = %d\n", self->manual_result, globals.use_declarefetch);
+       if ( self->manual_result || ! globals.use_declarefetch) {
+
+               if (self->currTuple >= QR_get_num_tuples(res) -1 || 
+                       (self->options.maxRows > 0 && self->currTuple == self->options.maxRows - 1)) {
+
+                       /*      if at the end of the tuples, return "no data found" 
+                               and set the cursor past the end of the result set 
+                       */
+                       self->currTuple = QR_get_num_tuples(res);       
+                       return SQL_NO_DATA_FOUND;
+               }
+               mylog("**** SQLFetch: manual_result\n");
+               (self->currTuple)++;
+       }
+       else {
+
+               // read from the cache or the physical next tuple
+               retval = QR_next_tuple(res);
+               if (retval < 0) {
+                       mylog("**** SQLFetch: end_tuples\n");
+                       return SQL_NO_DATA_FOUND;
+               }
+               else if (retval > 0)
+                       (self->currTuple)++;            // all is well
+
+               else {
+                       mylog("SQLFetch: error\n");
+                       self->errornumber = STMT_EXEC_ERROR;
+                       self->errormsg = "Error fetching next row";
+                       SC_log_error(func, "", self);
+                       return SQL_ERROR;
+               }
+       }
+
+       num_cols = QR_NumResultCols(res);
+
+       result = SQL_SUCCESS;
+       self->last_fetch_count = 1;
+
+       for (lf=0; lf < num_cols; lf++) {
+
+               mylog("fetch: cols=%d, lf=%d, self = %u, self->bindings = %u, buffer[] = %u\n", num_cols, lf, self, self->bindings, self->bindings[lf].buffer);
+
+               /*      reset for SQLGetData */
+               self->bindings[lf].data_left = -1;
+
+               if (self->bindings[lf].buffer != NULL) {
+            // this column has a binding
+
+            // type = QR_get_field_type(res, lf);
+                       type = CI_get_oid(ci, lf);              /* speed things up */
+
+                       mylog("type = %d\n", type);
+
+                       if (self->manual_result) {
+                               value = QR_get_value_manual(res, self->currTuple, lf);
+                               mylog("manual_result\n");
+                       }
+                       else if (globals.use_declarefetch)
+                               value = QR_get_value_backend(res, lf);
+                       else {
+                               value = QR_get_value_backend_row(res, self->currTuple, lf);
+                       }
+
+                       mylog("value = '%s'\n",  (value==NULL)?"<NULL>":value);
+
+                       retval = copy_and_convert_field_bindinfo(self, type, value, lf);
+
+                       mylog("copy_and_convert: retval = %d\n", retval);
+
+                       switch(retval) {
+                       case COPY_OK:
+                               break;  /*      OK, do next bound column */
+
+                       case COPY_UNSUPPORTED_TYPE:
+                               self->errormsg = "Received an unsupported type from Postgres.";
+                               self->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
+                               SC_log_error(func, "", self);
+                               result = SQL_ERROR;
+                               break;
+
+                       case COPY_UNSUPPORTED_CONVERSION:
+                               self->errormsg = "Couldn't handle the necessary data type conversion.";
+                               self->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
+                               SC_log_error(func, "", self);
+                               result = SQL_ERROR;
+                               break;
+
+                       case COPY_RESULT_TRUNCATED:
+                               self->errornumber = STMT_TRUNCATED;
+                               self->errormsg = "The buffer was too small for the result.";
+                               result = SQL_SUCCESS_WITH_INFO;
+                               break;
+
+                       case COPY_GENERAL_ERROR:        /* error msg already filled in */
+                               SC_log_error(func, "", self);
+                               result = SQL_ERROR;
+                               break;
+
+                       /*  This would not be meaningful in SQLFetch. */
+                       case COPY_NO_DATA_FOUND:
+                               break;
+
+                       default:
+                               self->errormsg = "Unrecognized return value from copy_and_convert_field.";
+                               self->errornumber = STMT_INTERNAL_ERROR;
+                               SC_log_error(func, "", self);
+                               result = SQL_ERROR;
+                               break;
+                       }
+               }
+       }
+
+       return result;
+}
+
+
 RETCODE SC_execute(StatementClass *self)
 {
 static char *func="SC_execute";
index 32a93a29659c390cc607c7e7c060e4e53f8e93f8..4349e9e004ba9d3d664a3fa07dee2b38ac4ac383 100644 (file)
@@ -202,7 +202,8 @@ char SC_recycle_statement(StatementClass *self);
 void SC_clear_error(StatementClass *self);
 char SC_get_error(StatementClass *self, int *number, char **message);
 char *SC_create_errormsg(StatementClass *self);
-RETCODE SC_execute(StatementClass *stmt);
+RETCODE SC_execute(StatementClass *self);
+RETCODE SC_fetch(StatementClass *self);
 void SC_free_params(StatementClass *self, char option);
 void SC_log_error(char *func, char *desc, StatementClass *self);