Subject | SP's and Embedded SQL |
---|---|
Author | Peter Faulks |
Post date | 2003-07-05T12:59:19Z |
G'day all,
A coupla questions about stored procedures, named transactions and
embedded SQL
1). The following embedded SQL statement:
EXEC SQL
EXECUTE PROCEDURE proc :Hvar1, :Hvar2 RETURNING_VALUES :Hvar3;
generates:
isc_transact_request (isc_status, &gds_database, &gds_trans,
sizeof (isc_3), isc_3, (short) 20, (char *) &isc_4, (short) 4, (char
*) &isc_11);
which doesn't compile in C++
Borland C++ 5.3 for Win32 Copyright (c) 1993, 1998 Borland International
test1.cpp:
Error test1.cpp 152: Cannot convert 'const char *' to 'char *' in function
main(
)
Error test1.cpp 152: Type mismatch in parameter 5 in call to '__stdcall
isc_tran
sact_request(long *,void * *,void * *,unsigned short,char *,unsigned
short,char
*,unsigned short,char *)' in function main()
*** 2 errors in Compile ***
It seems the 5th parameter is missing a (char *) cast. Is this a bug in
gpre or have I done something wrong?
2). How do I name a transaction?
eg: EXEC SQL
UPDATE TRANSACTION namedTransaction aTable
SET acol = :Hvar WHERE id = :Hid;
will nominate a transaction for an update.
gpre barfs at the following statement:
EXEC SQL EXECUTE TRANSACTION namedTransaction PROCEDURE proc;
Is there another way to do it?
Regards
A coupla questions about stored procedures, named transactions and
embedded SQL
1). The following embedded SQL statement:
EXEC SQL
EXECUTE PROCEDURE proc :Hvar1, :Hvar2 RETURNING_VALUES :Hvar3;
generates:
isc_transact_request (isc_status, &gds_database, &gds_trans,
sizeof (isc_3), isc_3, (short) 20, (char *) &isc_4, (short) 4, (char
*) &isc_11);
which doesn't compile in C++
Borland C++ 5.3 for Win32 Copyright (c) 1993, 1998 Borland International
test1.cpp:
Error test1.cpp 152: Cannot convert 'const char *' to 'char *' in function
main(
)
Error test1.cpp 152: Type mismatch in parameter 5 in call to '__stdcall
isc_tran
sact_request(long *,void * *,void * *,unsigned short,char *,unsigned
short,char
*,unsigned short,char *)' in function main()
*** 2 errors in Compile ***
It seems the 5th parameter is missing a (char *) cast. Is this a bug in
gpre or have I done something wrong?
2). How do I name a transaction?
eg: EXEC SQL
UPDATE TRANSACTION namedTransaction aTable
SET acol = :Hvar WHERE id = :Hid;
will nominate a transaction for an update.
gpre barfs at the following statement:
EXEC SQL EXECUTE TRANSACTION namedTransaction PROCEDURE proc;
Is there another way to do it?
Regards