i have a question regarding the binding of variables using the otl_stream. No matter how i bind, using indexed or naming the order/naming does not affect which column is being updated. It seems always sequential.
You can see that in otl_stream
the column-names have been switched. However
the postgres DB shows that both inserts yield equal results.
- OS:Windows
- OTL:4.0
- Visual Studio 2013.
- Platform: x64
- ODBC: PostgreSQL ANSI(x64) 9.03.04.00
Any ideas? Kind Regards Auke-Dirk
#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;
}