Subject | Re: [firebird-support] Re: GPRE/API Different with FB 1.5? |
---|---|
Author | Thad Humphries |
Post date | 2004-03-01T21:49:28Z |
I haven't tried 1.5 yet but I have ported a lot of embedded SQL to Firebird.
What happens if you allocate only enough fields required by your query?
What happens if you allocate only enough fields required by your query?
On Monday 01 March 2004 15:56, Eric Boyajian wrote:
> Hmm... I guess I'm looking for independent confirmation from
> anyone. So I'm including a complete C++ program that works with FB
> 1.0 and does not work with FB 1.5. Again, the problem is with the
> PREPARE statement.
>
> At this point, I assert that the isc_embed_dsql_prepare(...) function
> has been broken from FB 1.0 to FB 1.5. Can someone show me what I am
> doing wrong? Should I submit this a bug? Perhaps I'm the only one
> who uses embedded SQL and GPRE anymore.
>
>
> Eric
>
>
> Sample Program ================================
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
>
> char db_name[128];
>
> // For FB 1.0 use employee.gdb, and link with gds32_ms.lib.
> // for FB 1.5 use employee.fdb, and link with fbclient_ms.lib.
>
> DATABASE DB = COMPILETIME "C:\Program
> Files\Firebird\examples\employee.fdb"
> RUNTIME db_name;
>
> EXEC SQL
> INCLUDE SQLCA;
>
> int main(int argc, char** argv)
> {
> char sqlString[256];
> XSQLDA* sqlda;
>
> // Set database name.
> strcpy(db_name, "C:\\Program
> Files\\Firebird\\examples\\employee.fdb");
>
> // Open database and start tansaction.
> EXEC SQL
> CONNECT DB USER 'SYSDBA' PASSWORD 'masterkey';
>
> gds_trans = (isc_tr_handle) 0;
> EXEC SQL
> SET TRANSACTION NAME gds_trans;
>
> // Set up SQLDA for SELECTs, allow up to 150 fields to be selected.
> sqlda = (XSQLDA*) malloc(XSQLDA_LENGTH(150));
> sqlda->version = SQLDA_VERSION1;
> sqlda->sqln = 150;
>
> // Prepare a query.
> strcpy(sqlString, "SELECT * FROM COUNTRY");
> EXEC SQL
> PREPARE TRANSACTION gds_trans Q1 INTO sqlda FROM :sqlString;
>
> EXEC SQL
> COMMIT TRANSACTION gds_trans RELEASE;
>
> return 0;
> }
> End of sample program ===================================
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
--
Thad Humphries "...no religious test shall ever be required
Web Development Manager as a qualification to any office or public
Phone: 540/675-3015, x225 trust under the United States." -Article VI