Support for SQLRowCount() (odbc-sql-row-count)
This commit is contained in:
parent
f0fdf618fe
commit
7b409e8371
|
@ -1402,6 +1402,42 @@ s48_value odbc_sql_execute_direct(s48_value stmt_handle,
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
s48_value odbc_sql_row_count(s48_value stmt_handle)
|
||||||
|
{
|
||||||
|
SQLHSTMT sh;
|
||||||
|
SQLRETURN retval;
|
||||||
|
SQLINTEGER rowcount;
|
||||||
|
|
||||||
|
sh = (SQLHSTMT) s48_extract_integer(stmt_handle);
|
||||||
|
|
||||||
|
ODBC_DEBUG_PRINTF("odbc_sql_row_count\n");
|
||||||
|
|
||||||
|
retval = SQLRowCount(sh, &rowcount);
|
||||||
|
|
||||||
|
switch (retval)
|
||||||
|
{
|
||||||
|
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
|
||||||
|
{
|
||||||
|
return s48_enter_integer(rowcount);
|
||||||
|
}
|
||||||
|
case SQL_ERROR:
|
||||||
|
{
|
||||||
|
ODBC_RAISE_EXCEPTION("SQLRowCount returned SQL_ERROR");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SQL_INVALID_HANDLE:
|
||||||
|
{
|
||||||
|
ODBC_RAISE_EXCEPTION("SQLRowCount got invalid handle");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
ODBC_RAISE_EXCEPTION("SQLRowCount returned unknown error code");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s48_value odbc_sql_get_data(s48_value stmt_handle,
|
s48_value odbc_sql_get_data(s48_value stmt_handle,
|
||||||
s48_value column_number,
|
s48_value column_number,
|
||||||
s48_value target_type)
|
s48_value target_type)
|
||||||
|
@ -2182,6 +2218,7 @@ void s48_init_odbc(void)
|
||||||
S48_EXPORT_FUNCTION(odbc_sql_execute_direct);
|
S48_EXPORT_FUNCTION(odbc_sql_execute_direct);
|
||||||
|
|
||||||
/* PART 7 */
|
/* PART 7 */
|
||||||
|
S48_EXPORT_FUNCTION(odbc_sql_row_count);
|
||||||
S48_EXPORT_FUNCTION(odbc_sql_get_data);
|
S48_EXPORT_FUNCTION(odbc_sql_get_data);
|
||||||
S48_EXPORT_FUNCTION(odbc_sql_fetch);
|
S48_EXPORT_FUNCTION(odbc_sql_fetch);
|
||||||
S48_EXPORT_FUNCTION(odbc_sql_num_result_cols);
|
S48_EXPORT_FUNCTION(odbc_sql_num_result_cols);
|
||||||
|
|
|
@ -231,9 +231,11 @@ s48_value odbc_sql_execute_direct(s48_value stmt_handle, s48_value stmt);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
s48_value odbc_sql_row_count(s48_value stmt_handle);
|
||||||
|
|
||||||
s48_value odbc_sql_get_data(s48_value stmt_handle,
|
s48_value odbc_sql_get_data(s48_value stmt_handle,
|
||||||
s48_value column_number,
|
s48_value column_number,
|
||||||
s48_value target_type);
|
s48_value target_type);
|
||||||
|
|
||||||
void check_sql_get_data_result(SQLRETURN retval, SQLHSTMT stmt_handle);
|
void check_sql_get_data_result(SQLRETURN retval, SQLHSTMT stmt_handle);
|
||||||
|
|
||||||
|
@ -273,7 +275,7 @@ s48_value odbc_sql_cancel(s48_value stmt_handle);
|
||||||
|
|
||||||
/* Commits or rolls back a transaction */
|
/* Commits or rolls back a transaction */
|
||||||
s48_value odbc_sql_endtran(s48_value handle_type, s48_value handle,
|
s48_value odbc_sql_endtran(s48_value handle_type, s48_value handle,
|
||||||
s48_value completion_type);
|
s48_value completion_type);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
|
|
@ -622,6 +622,14 @@
|
||||||
|
|
||||||
;;; PART 7
|
;;; PART 7
|
||||||
|
|
||||||
|
(define (odbc-sql-row-count stmt-handle)
|
||||||
|
(check-arg statement-handle? stmt-handle odbc-sql-row-count)
|
||||||
|
(odbc-sql-row-count-internal (statement-handle-handle stmt-handle)))
|
||||||
|
|
||||||
|
(import-lambda-definition odbc-sql-row-count-internal
|
||||||
|
(stmt-handle)
|
||||||
|
"odbc_sql_row_count")
|
||||||
|
|
||||||
(define (odbc-sql-get-data stmt-handle column-number target-type)
|
(define (odbc-sql-get-data stmt-handle column-number target-type)
|
||||||
(check-arg statement-handle? stmt-handle odbc-sql-get-data)
|
(check-arg statement-handle? stmt-handle odbc-sql-get-data)
|
||||||
(odbc-sql-get-data-internal (statement-handle-handle stmt-handle)
|
(odbc-sql-get-data-internal (statement-handle-handle stmt-handle)
|
||||||
|
|
Loading…
Reference in New Issue