Skip to content

Commit a5e81aa

Browse files
committed
Add fb_get_sql_info() wrapper
1 parent e8d2470 commit a5e81aa

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

pdo_firebird_utils.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,26 @@ extern "C" void fb_decode_timestamp_tz(const ISC_TIMESTAMP_TZ* timestampTz,
8181
timeZoneBufferLength, timeZoneBuffer);
8282
}
8383

84+
extern "C" int fb_get_sql_info(ISC_STATUS* st, isc_stmt_handle* stmt,
85+
unsigned itemsLength, const unsigned char* items,
86+
unsigned bufferLength, unsigned char* buffer)
87+
{
88+
Firebird::IMaster* master = Firebird::fb_get_master_interface();
89+
Firebird::ThrowStatusWrapper status(master->getStatus());
90+
Firebird::IStatement* statement = NULL;
91+
92+
if (fb_get_statement_interface(st, &statement, stmt)){
93+
// if (sv[0] == 1 && sv[1] > 0)
94+
return st[1];
95+
}
96+
97+
// TODO: check status;
98+
statement->getInfo(&status, itemsLength, items, bufferLength, buffer);
99+
100+
statement->release();
101+
statement = NULL;
102+
103+
return 0;
104+
}
105+
84106
#endif

pdo_firebird_utils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ void fb_decode_timestamp_tz(const ISC_TIMESTAMP_TZ* timestampTz,
3939
unsigned* hours, unsigned* minutes, unsigned* seconds, unsigned* fractions,
4040
unsigned timeZoneBufferLength, char* timeZoneBuffer);
4141

42+
int fb_get_sql_info(ISC_STATUS* st, isc_stmt_handle* stmt,
43+
unsigned itemsLength, const unsigned char* items,
44+
unsigned bufferLength, unsigned char* buffer);
45+
4246
#endif
4347

4448
#ifdef __cplusplus

0 commit comments

Comments
 (0)