首页>计算机>Oracle认证>应用技术>正文
Oracle Pro*C/C++游标和存储过程性能测试报告

www.zige365.com 2007-8-7 18:24:43 点击:发送给好友 和学友门交流一下 收藏到我的会员中心
//倒出数据到zdb

void CBOARDT::WriteZdb(int SubNetID,int NodeBID)

{

EXEC SQL BEGIN DECLARE SECTION;

int iSubNetID = SubNetID;

int iNodeBID = NodeBID;

EXEC SQL END DECLARE SECTION;

char tmpbuf[128],StartTime[256],EndTime[256];

/* Set time zone from TZ environment variable. If TZ is not set,

* the operating system is queried to obtain the default value

* for the variable.

*/

_tzset();

/* Display operating system-style date and time. */

_strtime( tmpbuf );

sprintf( StartTime,"OS time:\t\t\t%s\n", tmpbuf );

/* Declare a cursor for the FETCH. */

EXEC SQL DECLARE CUR_R_BOARDT CURSOR FOR

SELECT byBoardType, abyBoardName FROM TB_BOARDT;

EXEC SQL OPEN CUR_R_BOARDT;

/* Initialize the number of rows. */

num_ret = 0;

int rows_ret=BATCHSIZE;

while (BATCHSIZE == rows_ret)

{

// Fetch from the Cursor, catching all ORA ERROR condition

EXEC SQL WHENEVER SQLERROR DO sqlerror(m_dbheader);

EXEC SQL FETCH CUR_R_BOARDT INTO

:bHostVar1,:chHostVar1;

/* Write however many rows were returned. */

rows_ret=sqlca.sqlerrd[2] - num_ret;

WriteBatchToZdb(rows_ret,"b01c01");

num_ret = sqlca.sqlerrd[2]; /* Reset the number. */

}

/* Write remaining rows from last fetch, if any. */

if ((sqlca.sqlerrd[2] - num_ret) > 0)

WriteBatchToZdb(sqlca.sqlerrd[2] - num_ret,"b01c01");

m_dbheader.dbTupleNum=sqlca.sqlerrd[2];

EXEC SQL CLOSE CUR_R_BOARDT;

_strtime(tmpbuf);

sprintf(EndTime,"OS time:\t\t\t\t%s\n", tmpbuf );

printf("begin time: %s\n",StartTime);

printf("end time: %s\n",EndTime);

WriteZdbHeader();

}

    1.3.3 存储过程方式:

本新闻共5页,当前在第4页  1  2  3  4  5  

我要投稿 新闻来源:豆豆技术网 编辑: 作者:
相关新闻