Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wt9fm-0008Eg-8j for pgsql-odbc@arkaria.postgresql.org; Sat, 07 Jun 2014 06:00:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wt9fk-0007vH-Rk for pgsql-odbc@arkaria.postgresql.org; Sat, 07 Jun 2014 06:00:08 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Wt9fi-0007v6-TZ for pgsql-odbc@postgresql.org; Sat, 07 Jun 2014 06:00:07 +0000 Received: from sd.tpf.co.jp ([210.161.239.34]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wt9fb-0003MT-1B for pgsql-odbc@postgresql.org; Sat, 07 Jun 2014 06:00:05 +0000 Received: (qmail 9269 invoked by uid 512); 7 Jun 2014 05:59:57 -0000 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 7 Jun 2014 05:59:57 -0000 Received: from unknown (HELO ?192.168.1.4?) (183.76.63.174) by sd.tpf.co.jp with SMTP; 7 Jun 2014 05:59:57 -0000 Message-ID: <5392AA58.5030101@tpf.co.jp> Date: Sat, 07 Jun 2014 14:59:52 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: "John C. Frickson" CC: Michael Paquier , PostgreSQL ODBC List Subject: Re: SQLBulkOperations References: <1402025533.8234.13.camel@server.frickson.pvt> <1402055839.8234.18.camel@server.frickson.pvt> <5391B076.8070208@tpf.co.jp> <1402059306.8234.34.camel@server.frickson.pvt> <1402071245.8234.39.camel@server.frickson.pvt> In-Reply-To: <1402071245.8234.39.camel@server.frickson.pvt> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org (2014/06/07 1:14), John C. Frickson wrote: > Ok, I boiled my code down to the following sample. The comments show > the errors that get printed. > > ----------8<----------8<----------8<----------8<----------8<----------8<---------- > #include > #include > #include > #include > > void printerr(int); > > SQLHANDLE henv, hdbc, hstmt; > > int main() > { > SQLLEN length_or_ind[3]; > char connOut[2048], colVal[3][32]; > const char *query = "SELECT * FROM pvsystem.loginfails WHERE userid='foo'"; > const char *cstr = "DRIVER={PSQL};SERVER=server.frickson.pvt;UID=pvwebuser;" > "PWD=Zjgg2WuNwO52XGVT;UseServerSidePrepare=1;DATABASE=PortVantage;"; > int i, rc; > > colVal[0][0] = colVal[1][0] = colVal[2][0] = 0; > > rc = SQLSetEnvAttr(NULL, SQL_ATTR_CONNECTION_POOLING, (SQLPOINTER)SQL_CP_ONE_PER_HENV, 0); > if (rc) printerr(rc); > rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); > if (rc) printerr(rc); > rc = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0); > if (rc) printerr(rc); > rc = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc); > rc = SQLSetConnectAttr(hdbc, SQL_ATTR_ODBC_CURSORS, (SQLPOINTER)SQL_CUR_USE_ODBC, 0); > if (rc) printerr(rc); Please try to skip the above SQLSetConnectAttr operation. > rc = SQLDriverConnect(hdbc, NULL, (SQLCHAR*)cstr, strlen(cstr), > (SQLCHAR*)connOut, 2048, NULL, SQL_DRIVER_NOPROMPT); > if (rc) printerr(rc); > rc = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt); > if (rc) printerr(rc); > rc = SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)1, SQL_IS_INTEGER); > if (rc) printerr(rc); > rc = SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER)SQL_CURSOR_KEYSET_DRIVEN, 0); > // rc=1 State=01S02 Native=0 Message=[unixODBC][Driver Manager]Option value changed > if (rc) printerr(rc); > rc = SQLSetStmtAttr(hstmt, SQL_ATTR_MAX_ROWS, 0, SQL_IS_INTEGER); > if (rc) printerr(rc); > rc = SQLSetStmtAttr(hstmt, SQL_ATTR_CONCURRENCY, (SQLPOINTER)SQL_CONCUR_ROWVER, 0); > // rc=1 State=01S02 Native=0 Message=[unixODBC][Driver Manager]Option value changed > if (rc) printerr(rc); > rc = SQLPrepare(hstmt, (UCHAR*)query, strlen(query)); > if (rc) printerr(rc); > rc = SQLExecute(hstmt); > if (rc) printerr(rc); > for (i = 0; i < 3; ++i) { > length_or_ind[i] = SQL_NTS; > rc = SQLBindCol(hstmt, (SQLUSMALLINT)i+1, SQL_C_CHAR, colVal[i], 32, &length_or_ind[i]); > if (rc) printerr(rc); > } > rc = SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0); > // rc=100 - Record Not Found > if (rc) printerr(rc); > strcpy(colVal[0], "foo"); > length_or_ind[0] = 3; > strcpy(colVal[1], "1"); > length_or_ind[1] = 1; > strcpy(colVal[2], "2014-06-06 10:15:00"); > length_or_ind[2] = 19; > rc = SQLBulkOperations(hstmt, SQL_ADD); > // rc=-1 State=IM001 Native=0 Message=[unixODBC][Driver Manager]Driver does not support this function > if (rc) printerr(rc); > rc = 0; > } -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc