Hello,

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.

Thanks

asked 16 Jun '11, 04:15

Amit%20Chauhan's gravatar image

Amit Chauhan
2333
accept rate: 0%

edited 15 Mar '13, 18:36

Mark%20Culp's gravatar image

Mark Culp
23.4k9132275

1

I have dynamically loaded dblib.dll and Using its functions to interact with database. But I do not know how to execute parametrized query using functions of dblib.dll. I have seen dbpp_prepare, (SQLCA *,char *,char *,short int *,char *,struct sqlda *,unsigned int )) but I don't know how to implement this function to prepare a statement because of missing argument list documentation. Can you guide me how to use functions of this dll to execute a parametrized query?

(21 Jun '11, 07:46) Amit Chauhan

I want all things are dynamically not static.

(29 Jun '11, 04:03) Amit Chauhan
Replies hidden

Amit, have you read any of the suggested documentation? - IMHO, it should really answer your questions.

(29 Jun '11, 04:27) Volker Barth

I saw all suggested documents already, please check link below: ftp://58.130.54.4/cmis/ediasoft100315/ediasoft/asa9/SQL%20Anywhere%209/h/sqlfuncs.h

Now I want to know about ant documentation or another help how can I use the functions of "sqlfuncs.h", I done all works except insertion of binary, long binary & long varchar data. Please help me.

(05 Jul '11, 00:39) Amit Chauhan

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?

permanent link

answered 16 Jun '11, 08:50

John%20Smirnios's gravatar image

John Smirnios
9.0k377114
accept rate: 39%

edited 16 Jun '11, 09:28

Hello john, Thanks for your reply................. Actually I need to use Embedded SQL because of my project requirement and I am using dblib.dll for this purpose. I need to insert data in Long Binary type field of SQL AnyWhere table . I need to use parametrized query for this and I have used functions of dblib.dll to insert data in table, but I have header file containing function declaration , so I am unable to implement the function to prepare statement using dblib.dll. Following is prototype of function:

FUNC_INFO( extern, void, esqlentry, dbpp_prepare, (SQLCA ,char ,char ,short int ,char ,struct sqlda ,unsigned int ))

I could not get any documentation describing the parameters of this function . How can I prepare a statement using functions of this dll and Execute it to insert binary data.

Please help me out as I am new to this Embedded SQL concept....

Waiting for positive response...............

Thanks Amit Chauhan

(20 Jun '11, 06:01) Amit Chauhan

When developing with Embedded SQL, you write C/C++ source usually as a .sqc file that has embedded 'EXEC SQL ...' statements to actually connect and interact with the database server. Then you preprocess your .sqc to a .c file using sqlpp (this changes the EXEC SQL ... statements to call the internal dbpp_... functions). Then you compile the .c file as usual. Please read the dcx documentation link that John posted.

(20 Jun '11, 08:41) Ian McHardy

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;

DECL_LONGBINARY(100000) binary_host_var;

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 );

permanent link

answered 21 Jun '11, 08:56

Ian%20McHardy's gravatar image

Ian McHardy
3.1k23353
accept rate: 39%

Comment Text Removed

What exactly do you mean with "everything at run time dynamically"?

I'm sure there are even more infos available but I would strongly recommend to have a look at the docs.

(27 Jun '11, 07:12) Volker Barth

I saw all suggested documents already, please check link below: ftp://58.130.54.4/cmis/ediasoft100315/ediasoft/asa9/SQL%20Anywhere%209/h/sqlfuncs.h

Now I want to know about ant documentation or another help how can I use the functions of "sqlfuncs.h", I done all works except insertion of binary, long binary & long varchar data. Please help me.

(06 Jul '11, 03:02) Amit Chauhan

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.

permanent link

answered 16 Jun '11, 07:45

Martin's gravatar image

Martin
8.6k118151237
accept rate: 14%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×29
×8

question asked: 16 Jun '11, 04:15

question was seen: 2,857 times

last updated: 15 Mar '13, 18:36