Environment: Firebird 2.5.4-64bit, on Windows 8.1.
I am trying to write a C ++ client using the C API (using VS2013). I get this error when preparing a SELECT statement in a table containing a DATE column (error when calling the isc_dsql_prepare function)
Dynamic SQL error -SQL error code = -804 -Data type unknown -Client SQL dialect 1 does not support datatype reference DATE
From the isql tool, I confirm that the database uses SQL dialect 3: SQL> show sql dialect; In the dialect of the SQL client, the value is set: 3, and the dialogs of the SQL database: 3
On the client side, I install the SQL dialect as 3 (at least I don't have a connection error):
uint32_t sqlDialect = 3;
const char* charset = "UTF8";
char dpbBuffer[256], *dpb, *p;
dpb = dpbBuffer;
*dpb++ = isc_dpb_version1;
*dpb++ = isc_dpb_user_name;
*dpb++ = user.size();
strcpy(dpb, user.c_str());
dpb += user.size();
*dpb++ = isc_dpb_password;
*dpb++ = pwd.size();
strcpy(dpb, pwd.c_str());
dpb += pwd.size();
*dpb++ = isc_dpb_lc_ctype;
*dpb++ = 4;
strcpy(dpb, charset);
dpb += 4;
*dpb++ = isc_dpb_sql_dialect;
memcpy(dpb, &sqlDialect, 4);
dpb += 4;
short dpbLength = dpb - dpbBuffer;
if (isc_attach_database(status, 0, url.c_str(), &_db, dpbLength, dpbBuffer))
{
isc_print_status(status);
}
TIMESTAMP, DATE TIMESTAMP, , - .
:
, .
-, , :
std::string sql = "SELECT * FROM truc";
out_sqlda = (XSQLDA *)malloc(XSQLDA_LENGTH(NbColumn));
out_sqlda->version = SQLDA_VERSION1;
out_sqlda->sqln = NbColumn;
isc_stmt_handle stmt;
isc_dsql_allocate_statement(status, &_db, &stmt);
isc_dsql_prepare(status, &(TransactHandle), &stmt, 0, sql.c_str(), 1, out_sqlda);
API- Interbase, :
isc_dsql_prepare(
status_vector,
&trans,
&stmt,
0,
str,
SQLDA_VERSION1,
out_sqlda
);
6- SQLDA, SQL!!! 3 .
.Net, .