1. 程式人生 > >在使用otl的時候,otl_stream建構函式第一個引數buffer size的使用說明.

在使用otl的時候,otl_stream建構函式第一個引數buffer size的使用說明.

http://otl.sourceforge.net/otl3_stream_class.htm 中對buffer size 的說明是:The buffer size is defined in logical rows to inserted into a table, selected from a table / view in one round-trip to the database (a.k.a. batch size, array size).
為此做了如下例子進行了測試.

程式碼如下:

// TestOCT.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include <iostream>
using namespace std;

#include <stdio.h>
//#define OTL_ORA10G
#define OTL_ORA9I // Compile OTL 4.0/OCI9i
#define OTL_ORA_UTF8 // Enable UTF8 OTL for OCI9i
#include <otlv4.h> // include the OTL 4.0 header file
#pragma comment(lib, "oci.lib")
otl_connect db; // connect object
#define CONNECTSTRING "test/[email protected]"

char strSql[100]  = { "select f1,f2 from test_tab"};
void insert()
{
 otl_stream o(3,"INSERT INTO TEST_TAB(f1,f2)values(4,'b')",db);

}
void select()
{
 otl_stream o(1,strSql,db);
 int count = 0;
 int myf1;
 char myf2[30] = {""};
 while(!o.eof())
 {
  o>>myf1;
  o>>myf2;
  count++;
  cout<<"f1: "<<myf1<<", f2: "<<myf2<<", 當前行數: "<<count<<endl;
 }
 return ;
}

int main()
{
    otl_connect::otl_initialize(); // initialize OCI environment
    try
 {
  db.rlogon(CONNECTSTRING); // connect to Oracle

  otl_cursor::direct_exec(db,"drop table test_tab",otl_exception::disabled); // drop table
  otl_cursor::direct_exec(db,"create table test_tab(f1 number, f2 nvarchar2(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;

插入資料: otl_stream o(3,"INSERT INTO TEST_TAB(f1,f2)values(4,'b')",db);中otl_stream的建構函式的第一個 引數表示要插入的資料條數.

查詢資料:otl_stream o(1,strSql,db);中otl_stream的建構函式的第一個引數表示查詢到的資料從伺服器傳遞到客戶端的往返次數

執行上面的程式,得到的結果就是:

f1: 4, f2: b, 當前行數1

f1: 4, f2: b, 當前行數1

f1: 4, f2: b, 當前行數1

相關推薦

在使用otl的時候,otl_stream建構函式第一引數buffer size的使用說明.

在http://otl.sourceforge.net/otl3_stream_class.htm 中對buffer size 的說明是:The buffer size is defined in logical rows to inserted into a table,

reshape函式第一引數-1是什麼意思

比如一個數組【1,2,3,4,5】 shape是(5,)reshape(-1,1)的結果是:[[1] [2] [3] [4] [5]]是一個一行5行1列的二維陣列,shape為(5,1)讓我們再來看看reshape(-1,2)呢:ValueError: cannot resh

複雜的react元件 setState不更新 - 使用函式作為setState的第一引數

寫了一個很複雜的stateful元件, 結果在某一個功能上, 觸發函式它卻不更新檢視了, 難以排查, … 問題的關鍵在這行程式碼 this.setState({ value: doSomething(this.state.value) }) 千萬不要在this.setSt

boost::bind繫結成員函式時,第一引數傳遞物件的特殊情況

boost::bind(&memberfunction, obj, _1, _2........)類似這樣的用法,我們叫做成員函式繫結,boost庫的文件中說的很清楚,第一個引數可以是value、pointer和reference,即傳值、傳地址和傳引用都是可以的

編寫一個函式 接受兩字串引數 如果 第一引數被第二包含 則輸出第一引數的首字元(圖)

#include "stdAfx.h" #include "ctype.h" #include "stdlib.h" #include "string.h" int main() { int z;

call和apply的第一引數是null/undefined時函式內的的this指向window或global

call/apply用來改變函式的執行上下文(this),它們的第一個引數thisArg是個物件,即作為函式內的this。 多數時候你傳啥函式內就是啥。僅以call示例 1 2 3 4 5 6 7 functionfun() { alert(this); } fun.c

GetMessage函式第二引數的問題

轉載地址:https://blog.csdn.net/shyrgst/article/details/7322268 今天在學習VC++深入詳解的過程中發現當GetMessage的Hwnd引數不為NULL的時候,會導致應用程式接收不到WM_QUIT訊息,此

apply/call第一引數傳入不同型別的值,分別表示什麼意義

apply/call動態改變函式的執行上下文,即改變this的指向。 以call為例: function fun () { console.log(this) } fun.call(1) // [Number: 1] fun.call(‘2’) // [String: ‘2’]

Intent.setClass(this,className),第一引數

問題: Intent.setClass(Context packageContext, Class<?> cls),中第一個引數是那個Context。(呼叫方,被呼叫方?)  假設結構如下 包:com.package1----》Activity1,Activit

2016/09/18 print_r函式第二引數是否使用過,如果用過請說出具體功能

2016/09/18 print_r函式第二個引數是否使用過,如果用過請說出具體功能 print_r函式結構 bool print_r ( mixed $expression [,bool

js奇葩需求 第一引數拆開為陣列 指定位置替換 字串特定位置拆分陣列

比如  '43242 : fsfsdfs : r232:fsfsdf'  這樣的字串  希望得到的結果是['43242', 'fsfsdfs : r232:fsfsdf'] 方法1: str='43242 : fsfsdfs : r232:fsfsdf';

[Android]Snackbar的第一引數

一般選擇點選一個view就會在底部彈出snackbar 但是如果我要在一個內部類傳值到snackbar裡面怎麼辦呢,第一個引數就是問題。 我們可以這麼用getWindow().getDecorVie

setInterval() 第一引數的用法

setInterval(cod,time) 定時器(每隔一段時間執行程式碼); 要求第一個引數必須是含Javascript命令的字串或函式物件 // 正常使用 setInterval(function(){ alert("10") },1000); setInterva

建構函式使用預設引數後不能使用建構函式過載

#include<iostream> class Date { public: Date(int,int,int); Date(int,int); Date(int); Date(); void display(); private:

Android fragment.replace()第一引數不能真正替換的解決方法

在用tabhost切換fragment的時候,會用到切換fragment的,Android fragment .replace()的第一個引數要選對 首先貼一段佈局檔案  <RelativeLayout xmlns:android="http://schemas

關於QT/C++中explicit關鍵字和建構函式的*parent引數的簡單說明

文章僅僅是用來說明一下一個引數的作用  程式寫的多了,你會發現幾乎所有的Qt類的建構函式都會有一個parent引數。這個引數通常是QObject* 或者是 QWidget* 型別的(定義新的類是通常首先初始化為0,在類的實現函式中賦值)。很多情況下它都會有一個初始值0,因此,即便你不去給它複製也沒有絲毫的問

有預設引數建構函式等同於無引數建構函式

class DateTimeType : public DateType ,public TimeType{public: DateTimeType(void); ~DateTimeType(void); DateTimeType(int year=1,int month=1

C# 不包含採用0引數建構函式

內容: 一、建構函式是什麼? (1)建構函式 ,是一種特殊的方法。建構函式具有與類相同的名稱(方法名與類名一樣),它主要用來在建立物件時初始化物件, 即為物件成員變數賦初始值,總與new運算子一

Android中自定義樣式與View的建構函式中的第三引數defStyle的意義

零、序 零、序   系統自帶的View可以在xml中配置屬性,對於寫的好的Custom View同樣可以在xml中配置屬性,為了使自定義的View的屬性可以在xml中配置,需要以下4個步驟: 通過<declare-styleable>為自定

自定義View中,四引數建構函式,其最後兩引數的含義

先看兩個引數的建構函式: public View(Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); }public View(Context conte