Close all databases - CRASH

Mark Schonewille m.schonewille at economy-x-talk.com
Mon Oct 14 08:32:34 CDT 2013


Hi Ruslan,

No, not OK. I'm asking how do to it in liveCode, not C++ or something 
like that. I really have no idea why you're saying I'm using a tomato. I 
look in the right places for the documentation, but the documentation 
gives me useless answers.

So, if vDatabase_SqlQuery() returns a query result reference, than how 
do I deal with that in LiveCode? There _IS_ no documentation for that!

There is no such thing as db.something() in LiveCode.

There is no such thing as cursorRef = queryResult.get_Cursor() in 
LiveCode. That isn't how LiveCode works.

I'd be very happy if you could point me to complete documentation for 
V4Rev, which also explains how to use the various commands and functions 
available in the API.

--
Best regards,

Mark Schonewille

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

Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other 
colour spaces. http://www.color-converter.com

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

Fill out this survey please
http://livecodebeginner.economy-x-talk.com/survey/

On 10/14/2013 15:23, Ruslan Zasukhin wrote:
> On 10/14/13 3:27 PM, "Mark Schonewille" <m.schonewille at economy-x-talk.com>
> wrote:
>
>> Hi Ruslan,
>>
>> This is my script:
>>
>> function queryTest
>>      // put VDatabase_SqlSelect(lDatabase,"SHOW DATABASES") into myCursor
>>      put vDatabase_SqlQuery(lDatabase,"SHOW DATABASES") into myCursor
>                          ^^^^^^^^
>
> Wrong.
>
> vDatabase_SqlQuery returns not cursorRef but QueryResultRef !!
>
>
>>      put VCursor_RecordCount(myCursor) into recNum
>
> You use Apple instead of Tomato
> Of course you get problem
>
>
>>      put VCursor_GetRecords(myCursor,1,recNum,tab,cr) into myData
>>      put VCursor_Destructor(myCursor) into myCursor
>>      return myData
>> end queryTest
>
>
>
>> lDatabase is a locally defined variable that contains a valid
>> databaseID.  VDatabase_SqlSelect() works but vDatabase_SqlQuery()
>> doesn't. It crashes at VCursor_GetRecords().
>
> Of course it not works
>
>
>> Please, explain how to use QueryResult in LiveCode. Documentation for
>> LiveCode doesn't exist at
>> http://www.valentina-db.com/docs/dokuwiki/v5/doku.php?id=valentina:products:ad
>> k:api:vqueryresult_class:vqueryresult_class
>> This page just says something like "yup, there are properties, but we
>> won't tell you what properties are and how to use them".
>
> Look.
>
> Originally, in Valentina DB was only TWO methods:
>
> I write syntax in general OOP way:
>
>      db.SqlSelect()  -- to execute SELECT command,
>                      and other commands, which returns you CURSOR.
>
>      db.SqlExecute() -- returns ULONG, usually number of affected rows
>              intended for INSERT, DELETE, UPDATE and all other commands.
>
>
> Later we have meet commands, which need more than these two commands could
> offer.  Also sometimes it can be eay to have single function, which can
> execute all commands.
>
> Okay?
>
>
> Now image, that you must be able send to
>      vDatabase_SqlQuery()
>
>
> All SQL commands. And SELECT, and INSERT ..
> But what about result?
> Result differ for commands, we know this already. Right?
>
>
> Solution was provide QueryResult -- helper small class, which can keep
>   a) cursor
>   B) ULONG
>   c) something else if needed, for example String, which can be XML.
>
>
> If you get to hands QueryResult, then what you need do?
> Ofcourse you need ask it:
>              QueryResult ->  What is inside of you?
>
>
> And when you will know what is inside, e.g. Cursor,
> You will have code
>                     cursorRef = queryResult.get_Cursor()
>
>
>
> ================
> I will check docs and pages you point now.
>
> But again -- do not user QueryResult()
>
> Use SqlSelect() ...
>
> For your task with SHOW DATABASES this the the best choice.
>
>
>


More information about the Valentina mailing list