首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OTL4.0 otl_stream绑定问题

OTL4.0 otl_stream绑定问题
EN

Stack Overflow用户
提问于 2015-10-19 15:04:00
回答 1查看 327关注 0票数 0

我有一个关于使用otl_stream绑定变量的问题。无论如何绑定,使用索引或命名顺序/命名都不会影响正在更新的列。看上去总是顺序的。

您可以看到,在otl_stream中,列名已被切换。然而,postgres显示,这两个插入都产生了相同的结果。

  1. 操作系统:Windows
  2. OTL:4.0
  3. 2013。
  4. 平台: x64
  5. ODBC: PostgreSQL ANSI(x64) 9.03.04.00

有什么想法吗?亲切问候奥克-德克

代码语言:javascript
复制
#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;
}
EN

回答 1

Stack Overflow用户

发布于 2015-10-22 10:21:34

我解决不了这个问题,于是转到soci去了。

问候

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33217804

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档