2015-10-19 13 views
0

我對使用otl_stream的變量綁定有疑問。 無論我如何綁定,使用索引或命名命令/命名不會影響正在更新的列。它似乎總是連續的。你可以看到otl_stream列名已被切換。但是 postgres數據庫顯示這兩個插入產生相同的結果。OTL4.0 otl_stream綁定問題

  1. 操作系統:Windows
  2. OTL:4.0
  3. 的Visual Studio 2013
  4. 平臺:64
  5. ODBC:PostgreSQL的ANSI(64)9.03.04.00

任何想法? 親切的問候奧克 - 德克

#include <iostream> 
#include <stdio.h> 
#include <string.h> 
#include <stdlib.h> 

using namespace std; 

// #define OTL_ODBC_UNIX // uncomment this line if UnixODBC is used 
#define OTL_ODBC_ALTERNATE_RPC 
#if !defined(_WIN32) && !defined(_WIN64) 
#define OTL_ODBC 
#else 
#define OTL_ODBC_POSTGRESQL // required with PG ODBC on Windows 
#endif 

#include "otlv4_h2\otlv4.h" 

int _tmain(int argc, _TCHAR* argv[]) 
{ 
    otl_connect db; 

    otl_connect::otl_initialize(); // initialize ODBC environment 
    try{ 

     db.rlogon("Driver=PostgreSQL ANSI;Server=localhost;Database=Horus;UID=postgres;PWD=12odsc7a"); 

     otl_cursor::direct_exec 
      (
      db, 
      "drop table test_tab", 
      otl_exception::disabled // disable OTL exceptions 
      ); // drop table 

     db.commit(); 

     otl_cursor::direct_exec 
      (
      db, 
      "create table test_tab(f1 int, f2 int)" 
      ); // create table 

     db.commit(); 

     otl_stream ostr1(1, // no buffers 
      "insert into test_tab values(:f1<int>,:f2<int>)", 
      db 
      ); 
     ostr1 << 1 << 2; 
     db.commit(); 

     otl_stream ostr2(1, // no buffers 
      "insert into test_tab values(:f2<int>,:f1<int>)", 
      db 
      ); 
     ostr2 << 1 << 2; 
     db.commit(); 
    } 
    catch (otl_exception& p){ // intercept OTL exceptions 
     cerr << p.msg << endl; // print out error message 
     cerr << p.stm_text << endl; // print out SQL that caused the error 
     cerr << p.sqlstate << endl; // print out SQLSTATE message 
     cerr << p.var_info << endl; // print out the variable that caused the error 
    } 

    db.logoff(); // disconnect from ODBC 

    return 0; 
} 

回答

0

我無法解決這一問題,併爲此轉移到SOCI。

Regards