欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
OCCI demo2
/**
*occicoll - To exhibit simple insert, delete & update operations"
*     " on table having a Nested Table column
*
*Description
*  Create a program which has insert,delete and update on a
* table having a Nested table column.
*Perform all these operations using  interface.
*/
#include <iostream>
#include <algorithm>
#include <occi.h>
using namespace oracle::occi;
using namespace std;
typedef vector<string> journal;
class occicoll
{
  private:
  Environment *env;
  Connection *conn;
  Statement *stmt;
  string tableName;
  string typeName;
  public:
  occicoll (string user, string passwd, string db)
  {
    env = Environment::createEnvironment (Environment::OBJECT);
    conn = env->createConnection (user, passwd, db);
  }
  ~occicoll ()
  {
    env->terminateConnection (conn);
    Environment::terminateEnvironment (env);
  }
  void setTableName (string s)
  {
    tableName = s;
  }
  /**
   * Insertion of a row
   */
  void insertRow ()
  {
    int c1 = 11;
    journal c2;
    c2.push_back ("LIFE");
    c2.push_back ("TODAY");
    c2.push_back ("INVESTOR");
   
    cout << "Inserting row with jid = " << 11 <<
      " and journal_tab (LIFE, TODAY, INVESTOR )" << endl;
    try{
    stmt = conn->createStatement (
     "INSERT INTO journal_tab (jid, jname) VALUES (:x, :y)");
    stmt->setInt (1, c1);
    setVector (stmt, 2, c2, "JOURNAL");
    stmt->executeUpdate ();
    }catch(SQLException ex)
    {
     cout<<"Exception thrown for insertRow"<<endl;
     cout<<"Error number: "<<  ex.getErrorCode() << endl;
     cout<<ex.getMessage() << endl;
    }
    cout << "Insertion - Successful" << endl;
    conn->terminateStatement (stmt);
  }
  // Displaying all the rows of the table
  void displayAllRows ()
  {
    cout << "Displaying all the rows of the table" << endl;
    stmt = conn->createStatement (
      "SELECT jid, jname FROM journal_tab");
    journal c2;
   
    ResultSet *rs = stmt->executeQuery();
    try{
    while (rs->next())
    {
      cout << "jid: " << rs->getInt(1) << endl;
      cout << "jname: ";
      getVector (rs, 2, c2);
      for (int i = 0; i < c2.size(); ++i)
        cout << c2[i] << " ";
      cout << endl;
    }
   }catch(SQLException ex)
    {
     cout<<"Exception thrown for displayRow"<<endl;
     cout<<"Error number: "<<  ex.getErrorCode() << endl;
     cout<<ex.getMessage() << endl;
    }
    stmt->closeResultSet (rs);
    conn->terminateStatement (stmt);
  } // End of displayAllRows()
  // Deleting a row of the nested table of strings
  void deleteRow (int c1, string str)
  {
    cout << "Deleting a row of the nested table of strings" << endl;
    stmt = conn->createStatement (
      "SELECT jname FROM journal_tab WHERE jid = :x");
    journal c2;
    stmt->setInt (1, c1);
   
    ResultSet *rs = stmt->executeQuery();
    try{
    if (rs->next())
    {
      getVector (rs, 1, c2);
      c2.erase (find (c2.begin(), c2.end(), str));
    }
    stmt->setSQL ("UPDATE journal_tab SET jname = :x WHERE jid = :y");
    stmt->setInt (2, c1);
    setVector (stmt, 1, c2, "JOURNAL");
    stmt->executeUpdate ();
    }catch(SQLException ex)
    {
     cout<<"Exception thrown for delete row"<<endl;
     cout<<"Error number: "<<  ex.getErrorCode() << endl;
     cout<<ex.getMessage() << endl;
    }
    cout << "Deletion - Successful" << endl;
    conn->commit();
    stmt->closeResultSet (rs);
    conn->terminateStatement (stmt);
  } // End of deleteRow (int, string)
  // Updating a row of the nested table of strings
  void updateRow (int c1, string str)
  {
    cout << "Updating a row of the nested table of strings" << endl;
    stmt = conn->createStatement (
      "SELECT jname FROM journal_tab WHERE jid = :x");
    journal c2;
   
    stmt->setInt (1, c1);
    ResultSet *rs = stmt->executeQuery();
    try{
    if (rs->next())
    {
      getVector (rs, 1, c2);
      c2[0] = str;
    }
    stmt->setSQL ("UPDATE journal_tab SET jname = :x WHERE jid = :y");
    stmt->setInt (2, c1);
    setVector (stmt, 1, c2, "JOURNAL");
    stmt->executeUpdate ();
    }catch(SQLException ex)
    {
     cout<<"Exception thrown for updateRow"<<endl;
     cout<<"Error number: "<<  ex.getErrorCode() << endl;
     cout<<ex.getMessage() << endl;
    }
    cout << "Updation - Successful" << endl;
    conn->commit();
    stmt->closeResultSet (rs);
    conn->terminateStatement (stmt);
  } // End of UpdateRow (int, string)
  void cleanup()
  {
    stmt = conn->createStatement ("DELETE FROM journal_tab");
    stmt->execute();
    stmt->setSQL ("INSERT INTO journal_tab (jid, jname) VALUES (22, journal (‘NATION‘, ‘TIMES‘))");
    stmt->executeUpdate();
    stmt->setSQL ("INSERT INTO journal_tab (jid, jname) VALUES (33, journal (‘CRICKET‘, ‘ALIVE‘))");
    stmt->executeUpdate();
    conn->commit();
    conn->terminateStatement (stmt);
  }
};//end of class occicoll
int main (void)
{
  string user = "SCOTT";
  string passwd = "TIGER";
  string db = "";
  try
  {
    cout << "occicoll - Exhibiting simple insert, delete & update operations"
     " on table having a Nested Table column" << endl;
    occicoll *demo = new occicoll (user, passwd, db);
    cout << "Displaying all rows before the operations" << endl;
    demo->displayAllRows ();
    demo->insertRow ();
    demo->deleteRow (11, "TODAY");
 
    demo->updateRow (33, "New_String");
    cout << "Displaying all rows after all the operations" << endl;
    demo->displayAllRows ();
    demo->cleanup();
    delete (demo);
    cout << "occicoll - done" << endl;
  }catch (SQLException ea)
  {
    cerr << "Error running the demo: " << ea.getMessage () << endl;
  }
}
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
通過(guò)OCCI操作Oracle數據庫詳解
轉:c ?Oracle?OCCI?編程
Java連接ODBC數據源的簡(jiǎn)單示例
mysql 字符集 Java
java連接Access數據庫的代碼
Jsp中調用Oracle存儲過(guò)程的小例子
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久