• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            寶杉的博客

            UNIX/LINUX;ACE;SNMP;C++
            posts - 33, comments - 23, trackbacks - 0, articles - 0

            example1

            Posted on 2007-08-20 17:01 寶杉 閱讀(691) 評論(2)  編輯 收藏 引用 所屬分類: OTL

            #include <iostream>
            using namespace std;
            #include <stdio.h>

            #define OTL_ORA7 // Compile OTL 3.1/OCI7
            #include <otlv4.h> // include the OTL 4 header file

            otl_connect db; // connect object

            void insert()
            // insert rows into table
            {
             otl_stream o(50, // buffer size
                          "insert into test_tab values(:f1<float>,:f2<char[31]>)",
                             // SQL statement
                          db // connect object
                         );
             char tmp[32];

             for(int i=1;i<=100;++i){
              sprintf(tmp,"Name%d",i);
              o<<(float)i<<tmp;
             }
            }

            void select()
            {
             otl_stream i(50, // buffer size
                          "select * from test_tab where f1>=:f<int> and f1<=:f*2",
                             // SELECT statement
                          db // connect object
                         );
               // create select stream
             
             float f1;
             char f2[31];

             i<<8; // assigning :f = 8
               // SELECT automatically executes when all input variables are
               // assigned. First portion of output rows is fetched to the buffer

             while(!i.eof()){ // while not end-of-data
              i>>f1>>f2;
              cout<<"f1="<<f1<<", f2="<<f2<<endl;
             }

             i<<4; // assigning :f = 4
               // SELECT automatically executes when all input variables are
               // assigned. First portion of output rows is fetched to the buffer

             while(!i.eof()){ // while not end-of-data
              i>>f1>>f2;
              cout<<"f1="<<f1<<", f2="<<f2<<endl;
             }

            }

            int main()
            {
             otl_connect::otl_initialize(); // initialize OCI environment
             try{

              db.rlogon("scott/tiger"); // connect to Oracle

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

              otl_cursor::direct_exec
               (
                db,
                "create table test_tab(f1 number, f2 varchar2(30))"
                );  // create table

              insert(); // insert records into table
              select(); // select records from table

             }

             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.var_info<<endl; // print out the variable that caused the error
             }

             db.logoff(); // disconnect from Oracle

             return 0;

            }

            Feedback

            提交失敗后,可以通過“恢復上次提交”恢復剛剛提交的內容
            fatal error C1083: Cannot open include file: 'otlv4.h': No such file or directory
            久久国产色av免费看| 久久国产乱子伦精品免费强| 国产一区二区三精品久久久无广告| 久久99精品综合国产首页| 成人精品一区二区久久| 精品国产乱码久久久久软件| 亚洲精品国精品久久99热一| 大蕉久久伊人中文字幕| 精品久久久中文字幕人妻| 999久久久国产精品| 狠狠色丁香久久婷婷综合蜜芽五月 | 一本一道久久a久久精品综合| 亚洲欧洲日产国码无码久久99| 99久久国产综合精品五月天喷水| 久久综合亚洲色HEZYO社区| 狠狠色丁香婷婷久久综合不卡| 久久久久亚洲?V成人无码| 久久精品国产亚洲AV大全| 免费精品国产日韩热久久| 久久免费美女视频| 亚洲成色www久久网站夜月| 一本色道久久综合狠狠躁篇 | 亚洲精品无码久久久久去q| 久久精品国产国产精品四凭| 九九99精品久久久久久| 无码人妻久久一区二区三区免费| 久久人人爽人人爽人人片AV东京热| 久久天天躁狠狠躁夜夜96流白浆| 久久久久久久免费视频| 精品人妻伦九区久久AAA片69 | 亚洲国产精品久久66| 久久不射电影网| 国产精品视频久久久| 国产精品久久亚洲不卡动漫| 久久久亚洲欧洲日产国码二区| 精品国产乱码久久久久软件| 无码人妻久久一区二区三区蜜桃| 欧洲国产伦久久久久久久| 亚洲精品乱码久久久久久蜜桃| 亚洲美日韩Av中文字幕无码久久久妻妇 | 思思久久精品在热线热|