Crash

Mark Schonewille m.schonewille at economy-x-talk.com
Mon Aug 3 09:52:35 CDT 2015


Hi Ivan,

Thanks for your reply. If I replace vDatabase_SqlQuery() with 
vDatabase_SqlSelect() I get a record, so myCursor must be a cursor 
reference. If it weren't, it would be a bug in Valentina.

The point, however, is that if the cursor reference for some reason is 
not correct, LiveCode (i.e. the Valentina external) shouldn't crash but 
receive an error from Valentina and return this error instead of the 
cursor reference. This doesn't happen: myCursor contains the number 2 
and no error.

I think this is a bug and I guess we have to avoid using 
vDatabase_SqlQuery() until it gets fixed.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 8/3/2015 08:41, Ivan Smahin wrote:
> Hi Mark,
>
>> On Aug 3, 2015, at 2:38 AM, Mark Schonewille <m.schonewille at economy-x-talk.com> wrote:
>>
>> Hi,
>>
>> I have the following (slightly abbreviated) LiveCode script:
>>
>> put "SELECT * FROM table1" into mySQL
>> put vDatabase_SqlQuery(gID,mySQL) into myCursor
>> put vCursor_recordCount(myCursor) into myRecordCount
>> put vCursor_getRecord(myCursor,tab,cr) into myData
>>
>> The above script crashes LiveCode and myRecordCount contains the number 2 instead of the expected number of 35 records. It works fine if I replace vDatabase_sqlQuery() with vDatabase_sqlSelect().
>> Is this a bug? Do I do something wrong here? Is vDatabase_SqlQuery() deprecated?
>>
>
> But vDatabase_SqlQuery returns VQueryResult - not VCursor.
> Then, based on VQueryResult_Type you should get either cursor or "affected row count" value.
> So it must be something like this one:
>
> ...
> dim queryResult as VQueryResult
> put vDatabase_SqlQuery( gID, mySQL ) into queryResult
> -- if queryResult is cursor type
> put VQueryResult_Cursor( queryResult ) into myCursor
> ...
>


More information about the Valentina mailing list