Sybase SQL Anywhere 5.0 and Delphi problems
This is the first time I've posted anything to a newsgroup. Please bear with
me if its not all OK. I've attempted to send this information to Borland via
their bug-reporting Web page, but it doesn't work. I have also reported some
of these problems to Sybase (who have been kind enough to respond, well done to
I am using Sybase SQL Anywhere 5.0 (at the moment stand-alone engine) via ODBC.
Is anyone else using SQL Anywhere with delphi ???
There are four problems, all relating to TStoredProc and stored procedures, plus
one other :-
1) When accessing a stored procedure that has the following syntax -
create procedure GET_ITEMS ()
result (firstItem integer, secondItem integer)
select ITEM_1, ITEM_2
I get an 'Error creating cursor handle' exception when calling the Open method
of the associated TStoredProc component. This previously used to work fine
with Watcom SQL 4.0 (which is the predecessor the SQL Anywhere 5.0)
2) Same set up as before, but with a stored procedure that either has a
parameter list with char or varchar as the first parameter, or a bit type
parameter anywhere in the list, e.g
create procedure (in firstString char(32), in anInteger integer) or
create procedure (in something integer, in aBit bit, in somethingelse char(16))
then when using the parameters editor while designing the TStoredProc
component I get a GPF in the IDAPI ODBC driver ---> IDODBC01.DLL.
This makes it impossible to set up the parameter list and the types of
3) When using a TStoredProc with a procedure with output parameters,
e.g. create procedure outputTest (in inputValue integer, out outputValue integer)
the output value is never (ever) returned, neither with WatcomSQL 4.0 nor
with Sybase SQL Anywhere 5.0, e.g.
x := ParamByName ('outputValue');
x is always zero.
4) When using a stored procedure that is defined as a function, eg.
create function TEST ()
I find that when using the parameters editor, it says there is a parameter
called TEST, and when I set it's type as result, and data type as integer, when
the ExecProc method runs, I get a "General SQL error. [Microsoft][ODBC DLL]
invalid parameter type" exception. Changing the parameter type to output gives
a "General SQL error. [Sybase][ODBC Driver]" exception.
The upshot of all this is that I can only use stored procedures that have input
parameters only, not very satisfactory.
5) I have two separate databases, but with a number of identical tables in each.
I have two TTable components, one associated with a table in the one database,
and one associated with the identical table in the second database. I now set
up a TBatchMove component to move data across from the source database table to
the destination database table. (mode = batAppend). It all works fine for tables
with now foreign keys, but when there is a foreign key referencing another table,
the TBatchMove raises an exception 'key violation'. It does this consistently
with only the third and fourth records which it fills in the destination database
table with garbage (which is why the key violation occurs), but all the other
records are transferred across OK. The garbage records always have the same
data in them.
Does anyone have any suggestions, answers (Steve Koterski at Borland) ????