[Gambas-user] Doing query of Stored procedure with no related data crashes gambas

Gianluigi gradobag at gradobag.it
Sat Feb 18 12:10:26 CET 2023


Il 18/02/23 06:45, Safiur Rahman ha scritto:
> I think this is the same as the one reported earlier
>
> https://lists.gambas-basic.org/pipermail/user/2007-June/015553.html
>
> On 2/18/23, Safiur Rahman <isafiur at gmail.com> wrote:
>> Hi
>>
>> I query a stored procedure every 30 second by specifying an argument
>> in mysql/mariadb eg.
>>
>> res = $qrScanCon.Exec("CALL spGetTransByTraceId('" & sIndex & "')")
>>
>> a) When the data is present then reult is available. I can use the
>> result. No problem.
>>
>> b) When the data is not present then result is not returned. In this case
>>
>> When the query is executed in MySQL terminal the message produced is:
>>    Empty set (0.017 sec)
>>    Query OK, 0 rows affected (0.017 sec)
>>
>> But the gambas query above shows error and crashes
>> Query failed: Commands out of sync; you can't run this command now
>>
>> Even if I use "TRY" eg.
>> Try res = $qrScanCon.Exec("CALL spGetTransByTraceId('" & sIndex & "')")
>>    If res And If res.Available Then
>>
>> Gambas never returns the result even if the stored procedure gets data later
>> on
>>
>> I am using development version (gambas daily ppa)
>>

Hi Safiur,

I am unfamiliar with MySQL but I know that CALL is not part of SQL:
https://www.w3schools.com/sql/sql_ref_keywords.asp
Perhaps you should look for another way to query the database

Regards

Gianluigi



More information about the User mailing list