用動態SQL方法4串連Oracle的實現(第1.0版)

來源:互聯網
上載者:User

摘要

動態SQL的第4種方法通過SQLDA(The SQL Descriptor Area)和oracle內部交換資料,可以執行直到程式運行時還不知道選擇表項或虛擬輸入宿主變數的個數和類型的SQL語句。

模組 oracle 的資料

jmp_buf jmp_continue   儲存程式斷點
FILE* ORAin stdin 預設輸入源
FILE* ORAout stdout 預設輸出源
Int ORAresult 0 錯誤標誌
Char* Dml_commands[] 資料操縱語句動詞表
ORAquery Query   封裝SQL執行過程
ORAqueryBase pQuery &query 為外部提供介面

與外部的介面

  • ORAin,ORAout: 應用程式通過操縱這兩個變數改變oracle模組的輸入輸出源。
  • ORAresult:oracle模組的執行結果(有待細分錯誤原因)。
  • ORAconnect(user,password),ORAdisconnect():與資料庫建立與中斷連線,必須在執行任何SQL語句前建立串連。
  • JMP_FOR_ERROR(label):如果oracle模組出現錯誤便轉到標號label處繼續執行,建立串連時出錯除外。
  • ORAqueryBase* pQuery:見抽象類別ORAqueryBase的說明。

抽象類別 ORAqueryBase

返回資料類型 方法名稱 參數 描述
int set int,int,int 設定SQL描述區的大小
int Alloc   分配SQL描述區
int get_statement   從輸入源讀取SQL語句
int set_statement] const char* 以字串格式輸入SQL語句
int execute   執行準備好的SQL語句
int free   釋放SQL描述區

參考資料

《programmer''s Guide to the Oracle Precompilers》Release 1.8

《C++進階參考手冊》

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.