- 19
- 0
- 约1.21万字
- 约 7页
- 2016-08-23 发布于重庆
- 举报
吉大数据库应用技术在线作业一答案
吉大《数据库应用技术》在线作业一答案
试卷总分:100 测试时间:-- 试卷得分:100
单选题
一、单选题(共 25 道试题,共 100 分。) 得分:100V
1. Given the following table:
TestTable C1 ----------- 12345 And if the following CLI calls are made:
SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,henv); SQLSetEnvAttr( henv,
SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3,0); SQL
AllocHandle(SQL_HANDLE_DBC,henv,hdbc); SQLConnect( hdbc, (SQLCHAR *)db,
SQL_NTS, (SQLCHAR *)userid, SQL_NTS, (SQLCHAR *)password, SQL_NTS );
SQLSetConnectAttr( hdbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0);
SQLAllocHandle(SQL_HANDLE_STMT,hdbc,hstmt); SQLPrepare(hstmt,(unsigned
char*)select *from Test order by C1,SQL_NTS);
SQLBindCol(hstmt,1,SQL_C_SHORT,data,0,NULL); SQLExecute(hstmt);
SQLFetch(hstmt); printf(Data:%i\n,data); SQLFetch(hstmt);
printf(Data:%i\n,data); SQLFetch(hstmt); printf(Data:%i\n,data);
SQLEndTran(SQL_HANDLE_ENV,henv,SQL_COMMIT); SQLFetch(hstmt);
printf(Data:%i\n,data); Which of the following will be returned by the
program?
A. Data: 1 Data: 2 Data: 3 Data: 3
B. Data: 1 Data: 2 Data: 3 Data: 4
C. Data: 1 Data: 2 Data: 3 Data: 1
D. Data: 1 Data: 2 Data: 3 Data: 5
满分:4 分 得分:4
2. Given the code: EXEC SQL DECLARE cursor1 CURSOR FOR SELECT
name,age,b_date FROM person; EXEC SQL OPEN cursor1; Under which of the
following situations will the above cursor be implicitly closed?
A. When a CLOSE statement is issued
B. When a COMMIT statement is issued
C. When there are no rows in the result set
D. When all rows are FETCHed from the result set
满分:4 分 得分:4
3. Given the application code: EXEC SQL DECLARE cur CURSOR WITH HOLD FOR
SELECT c1 FROM t1 EXEC SQL OPEN cur EXEC SQL FETCH cur INTO :hv /*
Statement 1 */ EXEC SQL COMMIT /* Statement 2 */ EXEC SQL FETCH cur INTO
:hv /* State
原创力文档

文档评论(0)