Forums/Other/SQL Yoga

Answered

[bug] is "limit" working for SQLite?

andre
asked this on October 21, 2009 16:33

Hello Folks,

here when I do a:

sqlquery_set theQueryA, "limit", "10"

I get an error when I try to retrieve the array. This is consistent and reproducible. Database is a simple SQLite with nothing fancy, no relationship, nothing.

Cheers

andre

 

Comments

User photo
Trevor DeVore
Blue Mango Learning Systems

I will need more info to troubleshoot. My unit tests for SQLite create a query that looks like this for "limit":

[code]SELECT lessons.id, lessons.title, lessons.attr_category, lessons.attr_difficulty, lessons.last_modified FROM lessons ORDER BY title LIMIT 1[/code]

What does the query looking like that is being generate? What happens if you try to run that query in a SQLite database manager app?

October 21, 2009 16:42
User photo
andre

Trevor,

Just tried here a query like:

select * from items where items.thumbnail like '%http%' order by items.magazine limit "15"

it worked fine on SQLiteManager. I've also used it with RevDB to build WeCode Planet. Now when I try it like this:

put sqlquery_createObject("items") into theQueryA

put "items.thumbnail contains :1" into theConditions

sqlquery_setConditionsFromUserSearchString theQueryA, "http", theConditions

sqlquery_set theQueryA, "order by", "items.magazine DESC"

sqlquery_set theQueryA, "limit", 10

sqlquery_retrieveAsArray theQueryA, tArchivesA

set the dgdata of grp "media archives" of cd "media" of stack "program" to tArchivesA

I get an error, I think the error cascades thru revolution and in the end it appears in the msg box like:

Error description: Object: object does not have this property

Which is odd.

Cheers

andre

October 23, 2009 10:27
User photo
Trevor DeVore
Blue Mango Learning Systems

Revolution error reporting is not always as helpful as it should be. You should review the "Notes on Error Reporting" chapter in the manual. There are some tips on circumventing the standard error reporting in order to get more info:

http://revolution.screenstepslive.com/spaces/revolution/manuals/sqlyoga/chapters/2311

Based on the error I wonder if you are using the latest version of SQL Yoga? "limit" was added in build 7. If you can get the "hint" associated with the error that will help track it down though.

Also, you may be interested in a new plugin I just posted. It uses the "log field" property of Database objects to show you the SQL being generated by SQL Yoga. Just open the plugin when you want to see a log and close it when you are done.

http://www.bluemangolearning.com/revolution/2009/10/sql-yoga-log-plugin/

October 23, 2009 11:06
User photo
andre

Thanks for the help trevor, I've installed the latest sql yoga and the plugin.

I can report that limit is working fine in the latest build!

October 29, 2009 18:50