This Domain(Admin5.com) is for Sale:

Oracle Pro*C/C 游标和数据库存储过程性能测试报告

时间:2007-12-23  来源:不详  作者:迈克DB

//倒出数据到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", 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", tmpbuf ); printf("begin time: %s",StartTime); printf("end time: %s",EndTime); WriteZdbHeader();}1.3.3 存储过程方式: copyright dedecms
//倒出数据到zdb void CBRDLIB::WriteZdb(int SubNetID,int NodeBID) { DWORD TupleNum=0; 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", tmpbuf ); do { EXEC SQL EXECUTE BEGIN testEptTbl.get_R0BrdLib (:array_size, :num_ret, :done_flag,:bHostVar1,:chHostVar1); END; END-EXEC; TupleNum=TupleNum num_ret;// print_rows(num_ret); WriteBatchToZdb(num_ret,"b01c01"); }while(!done_flag); m_dbheader.dbTupleNum=TupleNum; _strtime(tmpbuf); sprintf(EndTime,"OS time:\t\t\t\t%s", tmpbuf ); printf("brdlib begin time: %s",StartTime); printf("end time: %s",EndTime); WriteZdbHeader();} /*-------------CTable Factory-----------------*/CTable* CTable::Factory(int type){ switch( type ) { //R0 case 2 : return new CBOARDT; break; case 1 : return new CBRDLIB; break; } return NULL; }   

看完这篇,您有何感觉呢?

文章评论

共有位Admini5网友发表了评论 查看完整内容

24小时热门信息