8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 02:03:03 +01:00

Made XSQLDA parameter const in isc_dsql_fetch and a family of isc_dsql_exec functions as suggested by Dmitry Kovalenko.

Minor related cleanup in utld.
This commit is contained in:
alexpeshkoff 2008-09-10 12:31:54 +00:00
parent 537e23c87c
commit 121af76de7
8 changed files with 58 additions and 63 deletions

View File

@ -359,13 +359,14 @@ ISC_STATUS UTLD_parse_sqlda(
USHORT* msg_type, USHORT* msg_type,
USHORT* msg_length, USHORT* msg_length,
USHORT dialect, USHORT dialect,
XSQLDA* xsqlda, const XSQLDA* xsqlda,
const USHORT clause) const USHORT clause)
{ {
USHORT n; USHORT n;
XSQLVAR *xvar, xsqlvar; XSQLVAR xsqlvar;
SQLDA* sqlda; const XSQLVAR* xvar = &xsqlvar;
SQLVAR* qvar; const SQLVAR* qvar;
const SQLDA* sqlda = NULL;
if (!xsqlda) if (!xsqlda)
n = 0; n = 0;
@ -378,10 +379,9 @@ ISC_STATUS UTLD_parse_sqlda(
} }
else else
{ {
sqlda = (SQLDA *) xsqlda; sqlda = reinterpret_cast<const SQLDA *>(xsqlda);
n = sqlda->sqld; n = sqlda->sqld;
xsqlda = NULL; xsqlda = NULL;
xvar = &xsqlvar;
} }
@ -427,11 +427,9 @@ ISC_STATUS UTLD_parse_sqlda(
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
if (xsqlda) if (xsqlda)
xvar++; ++xvar;
else { else
qvar++; sqlvar_to_xsqlvar(++qvar, &xsqlvar);
sqlvar_to_xsqlvar(qvar, xvar);
}
const USHORT dtype = xvar->sqltype & ~1; const USHORT dtype = xvar->sqltype & ~1;
switch (dtype) switch (dtype)
@ -519,12 +517,10 @@ ISC_STATUS UTLD_parse_sqlda(
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
if (xsqlda) if (xsqlda)
xvar++; ++xvar;
else else
{ sqlvar_to_xsqlvar(++qvar, &xsqlvar);
qvar++;
sqlvar_to_xsqlvar(qvar, xvar);
}
USHORT dtype = xvar->sqltype & ~1; USHORT dtype = xvar->sqltype & ~1;
USHORT len = xvar->sqllen; USHORT len = xvar->sqllen;
switch (dtype) switch (dtype)
@ -655,12 +651,10 @@ ISC_STATUS UTLD_parse_sqlda(
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
if (xsqlda) if (xsqlda)
xvar++; ++xvar;
else else
{ sqlvar_to_xsqlvar(++qvar, &xsqlvar);
qvar++;
sqlvar_to_xsqlvar(qvar, xvar);
}
USHORT dtype = xvar->sqltype & ~1; USHORT dtype = xvar->sqltype & ~1;
USHORT len = xvar->sqllen; USHORT len = xvar->sqllen;
switch (dtype) switch (dtype)

View File

@ -37,7 +37,7 @@ USHORT UTLD_char_length_to_byte_length(USHORT lengthInChars, USHORT maxBytesPer
ISC_STATUS UTLD_copy_status(const ISC_STATUS*, ISC_STATUS*); ISC_STATUS UTLD_copy_status(const ISC_STATUS*, ISC_STATUS*);
ISC_STATUS UTLD_parse_sql_info(ISC_STATUS*, USHORT, const SCHAR*, XSQLDA*, USHORT*); ISC_STATUS UTLD_parse_sql_info(ISC_STATUS*, USHORT, const SCHAR*, XSQLDA*, USHORT*);
ISC_STATUS UTLD_parse_sqlda(ISC_STATUS*, sqlda_sup* const, USHORT*, USHORT*, ISC_STATUS UTLD_parse_sqlda(ISC_STATUS*, sqlda_sup* const, USHORT*, USHORT*,
USHORT*, USHORT, XSQLDA*, const USHORT); USHORT*, USHORT, const XSQLDA*, const USHORT);
void UTLD_save_status_strings(ISC_STATUS*); void UTLD_save_status_strings(ISC_STATUS*);
SCHAR* UTLD_skip_sql_info(SCHAR*); SCHAR* UTLD_skip_sql_info(SCHAR*);

View File

@ -189,21 +189,21 @@ typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_exec_immed2(ISC_STATUS *,
unsigned short, unsigned short,
const char*, const char*,
unsigned short, unsigned short,
XSQLDA *, const XSQLDA *,
XSQLDA *); const XSQLDA *);
typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_execute(ISC_STATUS *, typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_execute(ISC_STATUS *,
isc_tr_handle *, isc_tr_handle *,
isc_stmt_handle *, isc_stmt_handle *,
unsigned short, unsigned short,
XSQLDA *); const XSQLDA *);
typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_execute2(ISC_STATUS *, typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_execute2(ISC_STATUS *,
isc_tr_handle *, isc_tr_handle *,
isc_stmt_handle *, isc_stmt_handle *,
unsigned short, unsigned short,
XSQLDA *, const XSQLDA *,
XSQLDA *); const XSQLDA *);
typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_execute_immediate(ISC_STATUS *, typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_execute_immediate(ISC_STATUS *,
isc_db_handle *, isc_db_handle *,
@ -211,12 +211,12 @@ typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_execute_immediate(ISC_STATUS *,
unsigned short, unsigned short,
const char*, const char*,
unsigned short, unsigned short,
XSQLDA *); const XSQLDA *);
typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_fetch(ISC_STATUS *, typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_fetch(ISC_STATUS *,
isc_stmt_handle *, isc_stmt_handle *,
unsigned short, unsigned short,
XSQLDA *); const XSQLDA *);
typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_finish(isc_db_handle *); typedef ISC_STATUS ISC_EXPORT prototype_isc_dsql_finish(isc_db_handle *);

View File

@ -925,15 +925,15 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_exec_immed2(ISC_STATUS *user_status,
unsigned short, unsigned short,
const char*, const char*,
unsigned short, unsigned short,
XSQLDA *, const XSQLDA *,
XSQLDA *) const XSQLDA *)
{ {
return notImplemented(user_status); return notImplemented(user_status);
} }
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute(ISC_STATUS *user_status, ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute(ISC_STATUS *user_status,
isc_tr_handle *tra_handle, isc_stmt_handle *stmt_handle, unsigned short dialect, isc_tr_handle *tra_handle, isc_stmt_handle *stmt_handle, unsigned short dialect,
XSQLDA *sqlda) const XSQLDA *sqlda)
{ {
if (!m_api.isc_dsql_execute) if (!m_api.isc_dsql_execute)
return notImplemented(user_status); return notImplemented(user_status);
@ -943,7 +943,7 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute(ISC_STATUS *user_status,
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute2(ISC_STATUS *user_status, ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute2(ISC_STATUS *user_status,
isc_tr_handle *tra_handle, isc_stmt_handle *stmt_handle, unsigned short dialect, isc_tr_handle *tra_handle, isc_stmt_handle *stmt_handle, unsigned short dialect,
XSQLDA *in_sqlda, XSQLDA *out_sqlda) const XSQLDA *in_sqlda, const XSQLDA *out_sqlda)
{ {
if (!m_api.isc_dsql_execute2) if (!m_api.isc_dsql_execute2)
return notImplemented(user_status); return notImplemented(user_status);
@ -958,13 +958,13 @@ ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_execute_immediate(ISC_STATUS *user_s
unsigned short, unsigned short,
const char*, const char*,
unsigned short, unsigned short,
XSQLDA *) const XSQLDA *)
{ {
return notImplemented(user_status); return notImplemented(user_status);
} }
ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_fetch(ISC_STATUS *user_status, ISC_STATUS ISC_EXPORT IscProvider::isc_dsql_fetch(ISC_STATUS *user_status,
isc_stmt_handle *stmt_handle, unsigned short da_version, XSQLDA *sqlda) isc_stmt_handle *stmt_handle, unsigned short da_version, const XSQLDA *sqlda)
{ {
if (!m_api.isc_dsql_fetch) if (!m_api.isc_dsql_fetch)
return notImplemented(user_status); return notImplemented(user_status);

View File

@ -233,21 +233,21 @@ public:
unsigned short, unsigned short,
const char*, const char*,
unsigned short, unsigned short,
XSQLDA *, const XSQLDA *,
XSQLDA *); const XSQLDA *);
virtual ISC_STATUS ISC_EXPORT isc_dsql_execute(ISC_STATUS *, virtual ISC_STATUS ISC_EXPORT isc_dsql_execute(ISC_STATUS *,
isc_tr_handle *, isc_tr_handle *,
isc_stmt_handle *, isc_stmt_handle *,
unsigned short, unsigned short,
XSQLDA *); const XSQLDA *);
virtual ISC_STATUS ISC_EXPORT isc_dsql_execute2(ISC_STATUS *, virtual ISC_STATUS ISC_EXPORT isc_dsql_execute2(ISC_STATUS *,
isc_tr_handle *, isc_tr_handle *,
isc_stmt_handle *, isc_stmt_handle *,
unsigned short, unsigned short,
XSQLDA *, const XSQLDA *,
XSQLDA *); const XSQLDA *);
virtual ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate(ISC_STATUS *, virtual ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate(ISC_STATUS *,
isc_db_handle *, isc_db_handle *,
@ -255,12 +255,12 @@ public:
unsigned short, unsigned short,
const char*, const char*,
unsigned short, unsigned short,
XSQLDA *); const XSQLDA *);
virtual ISC_STATUS ISC_EXPORT isc_dsql_fetch(ISC_STATUS *, virtual ISC_STATUS ISC_EXPORT isc_dsql_fetch(ISC_STATUS *,
isc_stmt_handle *, isc_stmt_handle *,
unsigned short, unsigned short,
XSQLDA *); const XSQLDA *);
virtual ISC_STATUS ISC_EXPORT isc_dsql_finish(isc_db_handle *); virtual ISC_STATUS ISC_EXPORT isc_dsql_finish(isc_db_handle *);

View File

@ -415,21 +415,21 @@ ISC_STATUS ISC_EXPORT isc_dsql_exec_immed2(ISC_STATUS*,
unsigned short, unsigned short,
const ISC_SCHAR*, const ISC_SCHAR*,
unsigned short, unsigned short,
XSQLDA*, const XSQLDA*,
XSQLDA*); const XSQLDA*);
ISC_STATUS ISC_EXPORT isc_dsql_execute(ISC_STATUS*, ISC_STATUS ISC_EXPORT isc_dsql_execute(ISC_STATUS*,
isc_tr_handle*, isc_tr_handle*,
isc_stmt_handle*, isc_stmt_handle*,
unsigned short, unsigned short,
XSQLDA*); const XSQLDA*);
ISC_STATUS ISC_EXPORT isc_dsql_execute2(ISC_STATUS*, ISC_STATUS ISC_EXPORT isc_dsql_execute2(ISC_STATUS*,
isc_tr_handle*, isc_tr_handle*,
isc_stmt_handle*, isc_stmt_handle*,
unsigned short, unsigned short,
XSQLDA*, const XSQLDA*,
XSQLDA*); const XSQLDA*);
ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate(ISC_STATUS*, ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate(ISC_STATUS*,
isc_db_handle*, isc_db_handle*,
@ -437,12 +437,12 @@ ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate(ISC_STATUS*,
unsigned short, unsigned short,
const ISC_SCHAR*, const ISC_SCHAR*,
unsigned short, unsigned short,
XSQLDA*); const XSQLDA*);
ISC_STATUS ISC_EXPORT isc_dsql_fetch(ISC_STATUS *, ISC_STATUS ISC_EXPORT isc_dsql_fetch(ISC_STATUS *,
isc_stmt_handle *, isc_stmt_handle *,
unsigned short, unsigned short,
XSQLDA *); const XSQLDA *);
ISC_STATUS ISC_EXPORT isc_dsql_finish(isc_db_handle *); ISC_STATUS ISC_EXPORT isc_dsql_finish(isc_db_handle *);

View File

@ -2373,7 +2373,7 @@ ISC_STATUS API_ROUTINE GDS_DSQL_EXECUTE(ISC_STATUS* user_status,
FB_API_HANDLE* tra_handle, FB_API_HANDLE* tra_handle,
FB_API_HANDLE* stmt_handle, FB_API_HANDLE* stmt_handle,
USHORT dialect, USHORT dialect,
XSQLDA* sqlda) const XSQLDA* sqlda)
{ {
/************************************** /**************************************
* *
@ -2395,8 +2395,8 @@ ISC_STATUS API_ROUTINE GDS_DSQL_EXECUTE2(ISC_STATUS* user_status,
FB_API_HANDLE* tra_handle, FB_API_HANDLE* tra_handle,
FB_API_HANDLE* stmt_handle, FB_API_HANDLE* stmt_handle,
USHORT dialect, USHORT dialect,
XSQLDA* in_sqlda, const XSQLDA* in_sqlda,
XSQLDA* out_sqlda) const XSQLDA* out_sqlda)
{ {
/************************************** /**************************************
* *
@ -2571,7 +2571,7 @@ ISC_STATUS API_ROUTINE GDS_DSQL_EXEC_IMMED(ISC_STATUS* user_status,
USHORT length, USHORT length,
const SCHAR* string, const SCHAR* string,
USHORT dialect, USHORT dialect,
XSQLDA* sqlda) const XSQLDA* sqlda)
{ {
/************************************** /**************************************
* *
@ -2594,7 +2594,8 @@ ISC_STATUS API_ROUTINE GDS_DSQL_EXECUTE_IMMED(ISC_STATUS* user_status,
FB_API_HANDLE* tra_handle, FB_API_HANDLE* tra_handle,
USHORT length, USHORT length,
const SCHAR* string, const SCHAR* string,
USHORT dialect, XSQLDA* sqlda) USHORT dialect,
const XSQLDA* sqlda)
{ {
/************************************** /**************************************
* *
@ -2619,8 +2620,8 @@ ISC_STATUS API_ROUTINE GDS_DSQL_EXEC_IMMED2(ISC_STATUS* user_status,
USHORT length, USHORT length,
const SCHAR* string, const SCHAR* string,
USHORT dialect, USHORT dialect,
XSQLDA* in_sqlda, const XSQLDA* in_sqlda,
XSQLDA* out_sqlda) const XSQLDA* out_sqlda)
{ {
/************************************** /**************************************
* *
@ -2943,7 +2944,7 @@ ISC_STATUS API_ROUTINE GDS_DSQL_EXEC_IMM3_M(ISC_STATUS* user_status,
ISC_STATUS API_ROUTINE GDS_DSQL_FETCH(ISC_STATUS* user_status, ISC_STATUS API_ROUTINE GDS_DSQL_FETCH(ISC_STATUS* user_status,
FB_API_HANDLE* stmt_handle, FB_API_HANDLE* stmt_handle,
USHORT dialect, USHORT dialect,
XSQLDA* sqlda) const XSQLDA* sqlda)
{ {
/************************************** /**************************************
* *

View File

@ -36,11 +36,11 @@ ISC_STATUS API_ROUTINE isc_dsql_describe(ISC_STATUS *, FB_API_HANDLE*, USHORT, X
ISC_STATUS API_ROUTINE isc_dsql_describe_bind(ISC_STATUS*, FB_API_HANDLE*, ISC_STATUS API_ROUTINE isc_dsql_describe_bind(ISC_STATUS*, FB_API_HANDLE*,
USHORT, XSQLDA*); USHORT, XSQLDA*);
ISC_STATUS API_ROUTINE isc_dsql_execute(ISC_STATUS*, FB_API_HANDLE*, FB_API_HANDLE*, ISC_STATUS API_ROUTINE isc_dsql_execute(ISC_STATUS*, FB_API_HANDLE*, FB_API_HANDLE*,
USHORT, XSQLDA*); USHORT, const XSQLDA*);
ISC_STATUS API_ROUTINE isc_dsql_execute_m(ISC_STATUS*, FB_API_HANDLE*, FB_API_HANDLE*, USHORT, ISC_STATUS API_ROUTINE isc_dsql_execute_m(ISC_STATUS*, FB_API_HANDLE*, FB_API_HANDLE*, USHORT,
const SCHAR*, USHORT, USHORT, SCHAR*); const SCHAR*, USHORT, USHORT, SCHAR*);
ISC_STATUS API_ROUTINE isc_dsql_execute2(ISC_STATUS*, FB_API_HANDLE*, FB_API_HANDLE*, USHORT, ISC_STATUS API_ROUTINE isc_dsql_execute2(ISC_STATUS*, FB_API_HANDLE*, FB_API_HANDLE*, USHORT,
XSQLDA*, XSQLDA*); const XSQLDA*, const XSQLDA*);
ISC_STATUS API_ROUTINE isc_dsql_execute2_m(ISC_STATUS*, FB_API_HANDLE*, ISC_STATUS API_ROUTINE isc_dsql_execute2_m(ISC_STATUS*, FB_API_HANDLE*,
FB_API_HANDLE*, USHORT, const SCHAR*, FB_API_HANDLE*, USHORT, const SCHAR*,
USHORT, USHORT, SCHAR*, USHORT, USHORT, USHORT, SCHAR*, USHORT,
@ -49,11 +49,11 @@ ISC_STATUS API_ROUTINE isc_dsql_execute2_m(ISC_STATUS*, FB_API_HANDLE*,
ISC_STATUS API_ROUTINE isc_dsql_execute_immediate(ISC_STATUS*, FB_API_HANDLE*, ISC_STATUS API_ROUTINE isc_dsql_execute_immediate(ISC_STATUS*, FB_API_HANDLE*,
FB_API_HANDLE*, USHORT, FB_API_HANDLE*, USHORT,
const SCHAR*, USHORT, const SCHAR*, USHORT,
XSQLDA*); const XSQLDA*);
ISC_STATUS API_ROUTINE isc_dsql_exec_immed2(ISC_STATUS*, FB_API_HANDLE*, ISC_STATUS API_ROUTINE isc_dsql_exec_immed2(ISC_STATUS*, FB_API_HANDLE*,
FB_API_HANDLE*, USHORT, FB_API_HANDLE*, USHORT,
const SCHAR*, USHORT, XSQLDA*, const SCHAR*, USHORT, const XSQLDA*,
XSQLDA*); const XSQLDA*);
ISC_STATUS API_ROUTINE isc_dsql_execute_immediate_m(ISC_STATUS*, ISC_STATUS API_ROUTINE isc_dsql_execute_immediate_m(ISC_STATUS*,
FB_API_HANDLE*, FB_API_HANDLE*,
FB_API_HANDLE*, USHORT, FB_API_HANDLE*, USHORT,
@ -73,7 +73,7 @@ ISC_STATUS API_ROUTINE isc_dsql_exec_immed3_m(ISC_STATUS*, FB_API_HANDLE*,
SCHAR*, USHORT, USHORT, SCHAR*, USHORT, USHORT,
const SCHAR*, USHORT, SCHAR*, const SCHAR*, USHORT, SCHAR*,
USHORT, USHORT, SCHAR*); USHORT, USHORT, SCHAR*);
ISC_STATUS API_ROUTINE isc_dsql_fetch(ISC_STATUS*, FB_API_HANDLE*, USHORT, XSQLDA*); ISC_STATUS API_ROUTINE isc_dsql_fetch(ISC_STATUS*, FB_API_HANDLE*, USHORT, const XSQLDA*);
#ifdef SCROLLABLE_CURSORS #ifdef SCROLLABLE_CURSORS
ISC_STATUS API_ROUTINE isc_dsql_fetch2(ISC_STATUS*, FB_API_HANDLE*, USHORT, ISC_STATUS API_ROUTINE isc_dsql_fetch2(ISC_STATUS*, FB_API_HANDLE*, USHORT,
XSQLDA*, USHORT, SLONG); XSQLDA*, USHORT, SLONG);