I am an engineering student working on a project in which sql anywhere will works as a back-end database. I have faced a problem to insert binary data into tables using
FUNC_INFO( extern, void, esqlentry, dbpp_execute_imm, (SQLCA ,char ,unsigned short int ))
I also try to run FUNC_INFO( extern, void, esqlentry, dbpp_prepare, (SQLCA ,char ,char ,short int ,char ,struct sqlda ,unsigned int )), but fails because there is no documentation found on net about these functions.
Please guide me, I am waiting for a reply.
The dbpp_* entry points are for use by ESQL programs and calls to them are generated by the ESQL preprocessor: sqlpp. Users are not supposed to write code to call these functions directly. See http://dcx.sybase.com/index.html#1201/en/dbprogramming/pg-esql.html for information on using ESQL.
BTW, are you required to use ESQL for your project? Possibly you could use ODBC, .NET, or perhaps even a scripting language such as python or perl?
It is unsupported and undocumented to call dbpp_prepare directly. You must use embedded SQL (EXEC SQL...) and use the sqlpp pre-processor.
To insert binary data into a table using Embedded SQL, you may want to do something like the following (assuming the data to be inserted is in source_data, and the table you want to insert into is my_table with one column):
EXEC SQL BEGIN DECLARE SECTION;
EXEC SQL END DECLARE SECTION;
memcpy( binary_host_var.array, source_data, source_data_len );
binary_host_var.stored_len = source_data_len;
db_string_connect( &sqlca, "uid=dba;pwd=sql" );
EXEC SQL INSERT INTO my_table values( :binary_host_var );
EXEC SQL COMMIT;
db_string_disconnect( &sqlca );
answered 21 Jun '11, 08:56
For me your Func_Info looks like a c++ preprocessor makro so check your header files for the implementation, maybe from there you can identify what and how it should be done.
answered 16 Jun '11, 07:45