Send LONG values to the database using static SQL from an embedded SQL application.
Prérequis
There are no prerequisites for this task.
Declare a host variable of type DECL_LONGVARCHAR, DECL_LONGNVARCHAR, or DECL_LONGBINARY, as appropriate.
If you are sending NULL, set the indicator variable to a negative value.
Set the stored_len field of the host variable structure to the number of bytes of data in the array field.
Send the data by opening the cursor or executing the statement.
Exemple
The following code fragment illustrates the mechanics of sending a LONG VARCHAR using static embedded SQL. It is not intended to be a practical application.
#define DATA_LEN 12800 EXEC SQL BEGIN DECLARE SECTION; // SQLPP initializes longdata.array_len DECL_LONGVARCHAR(128000) longdata; EXEC SQL END DECLARE SECTION; void set_test_var() { // init longdata for sending data memset( longdata.array, 'a', DATA_LEN ); longdata.stored_len = DATA_LEN; printf( "Setting test_var to %d a's\n", DATA_LEN ); EXEC SQL SET test_var = :longdata; } |
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |