Search, match and sort sqlite db

There are a few things in your last chunk of code which will not work. There are also a few things I don’t understand with your code, however before I comment on that let’s get to the bottom of why your namesTable isn’t working the way you want.

(This will take a few postings back-and-forth, but eventually it’ll work)

Given the code you posted in post #16 above, your namesTable *should* have a ‘count’ table even when the SQL returns no rows. If you get a json object like {"names":[]}, then something is going on.

if you add a print(json.encode(namesTable)) just before your savetable(), does the output in the terminal from print() still give the same result without a ‘count’?
[import]uid: 70847 topic_id: 35342 reply_id: 142331[/import]

It works now, don’t know why but it does.

I render all my results into a scrollview and create a newText( ) for each result returned from my query. However, I get this error after about 5 queries.

Corona Simulator[24939:707] Runtime error  
 ?:0: attempt to call method 'setTextColor' (a nil value)  
stack traceback:  
 [C]: in function 'setTextColor'  
 ?: in function <?:3>  
 ?: in function <?:229>  

The app doesn’t crash but I really bugs me that I can’t find why and where it happens. I use storyboard and it doesn’t matter if I purge or remove the screen or manually remove the objects.

Normally if you get errors they’re followed by a line in the code but this doesn’t say anything. I set textColor on my text objects but I commented them out to check if the error would go away but it doesn’t. I’ve tried purging, removing, auto purge…

So next I thought maybe I have too many locals so I created tables to hold text and vector shapes but that didn’t solve it…

So then I check my buttons, I have three. Comment out the text part and now it’s just an image. Still that error…

So now I have an app with no setTextColor reference what so ever. I commented out the results rendered in my scrollview, so now that is empty.

I’m using Corona 971.

Is there a text bug, simulator bug, widget button bug…?

[import]uid: 65840 topic_id: 35342 reply_id: 142721[/import]

I remember seeing another post about this issue, and when I searched for it I saw that you were the OP :slight_smile:

I’d say that’s a Widget bug. If I’m not completely mistaken the error above points to line 3 and line 229 of an internal Corona module. I’m assuming it’s the widget module.
I think it’d be a good idea to write a bug report and include the error above, also stating that you’re using the Scrollview widget.

FWIW I’ve reported other bugs in the widget module, and the guys responded that they’re re-writing the widget module to fix many issues. Hopefully the new module will be released soon…

As I see it there isn’t much we can do to fix it (unless somebody else has some suggestions).
I’d say that if the error isn’t crashing your app, and it’s behaving as it should despite the error, you *could* go ahead and ignore it if your app needs to be released. It’s your call.
I still think it’s important to report this issue just in case you’ve found some edge-case that nobody else has reported.
[import]uid: 70847 topic_id: 35342 reply_id: 142728[/import]

It works now, don’t know why but it does.

I render all my results into a scrollview and create a newText( ) for each result returned from my query. However, I get this error after about 5 queries.

Corona Simulator[24939:707] Runtime error  
 ?:0: attempt to call method 'setTextColor' (a nil value)  
stack traceback:  
 [C]: in function 'setTextColor'  
 ?: in function <?:3>  
 ?: in function <?:229>  

The app doesn’t crash but I really bugs me that I can’t find why and where it happens. I use storyboard and it doesn’t matter if I purge or remove the screen or manually remove the objects.

Normally if you get errors they’re followed by a line in the code but this doesn’t say anything. I set textColor on my text objects but I commented them out to check if the error would go away but it doesn’t. I’ve tried purging, removing, auto purge…

So next I thought maybe I have too many locals so I created tables to hold text and vector shapes but that didn’t solve it…

So then I check my buttons, I have three. Comment out the text part and now it’s just an image. Still that error…

So now I have an app with no setTextColor reference what so ever. I commented out the results rendered in my scrollview, so now that is empty.

I’m using Corona 971.

Is there a text bug, simulator bug, widget button bug…?

[import]uid: 65840 topic_id: 35342 reply_id: 142721[/import]

I remember seeing another post about this issue, and when I searched for it I saw that you were the OP :slight_smile:

I’d say that’s a Widget bug. If I’m not completely mistaken the error above points to line 3 and line 229 of an internal Corona module. I’m assuming it’s the widget module.
I think it’d be a good idea to write a bug report and include the error above, also stating that you’re using the Scrollview widget.

FWIW I’ve reported other bugs in the widget module, and the guys responded that they’re re-writing the widget module to fix many issues. Hopefully the new module will be released soon…

As I see it there isn’t much we can do to fix it (unless somebody else has some suggestions).
I’d say that if the error isn’t crashing your app, and it’s behaving as it should despite the error, you *could* go ahead and ignore it if your app needs to be released. It’s your call.
I still think it’s important to report this issue just in case you’ve found some edge-case that nobody else has reported.
[import]uid: 70847 topic_id: 35342 reply_id: 142728[/import]

It works now, don’t know why but it does.

I render all my results into a scrollview and create a newText( ) for each result returned from my query. However, I get this error after about 5 queries.

Corona Simulator[24939:707] Runtime error  
 ?:0: attempt to call method 'setTextColor' (a nil value)  
stack traceback:  
 [C]: in function 'setTextColor'  
 ?: in function <?:3>  
 ?: in function <?:229>  

The app doesn’t crash but I really bugs me that I can’t find why and where it happens. I use storyboard and it doesn’t matter if I purge or remove the screen or manually remove the objects.

Normally if you get errors they’re followed by a line in the code but this doesn’t say anything. I set textColor on my text objects but I commented them out to check if the error would go away but it doesn’t. I’ve tried purging, removing, auto purge…

So next I thought maybe I have too many locals so I created tables to hold text and vector shapes but that didn’t solve it…

So then I check my buttons, I have three. Comment out the text part and now it’s just an image. Still that error…

So now I have an app with no setTextColor reference what so ever. I commented out the results rendered in my scrollview, so now that is empty.

I’m using Corona 971.

Is there a text bug, simulator bug, widget button bug…?

[import]uid: 65840 topic_id: 35342 reply_id: 142721[/import]

I remember seeing another post about this issue, and when I searched for it I saw that you were the OP :slight_smile:

I’d say that’s a Widget bug. If I’m not completely mistaken the error above points to line 3 and line 229 of an internal Corona module. I’m assuming it’s the widget module.
I think it’d be a good idea to write a bug report and include the error above, also stating that you’re using the Scrollview widget.

FWIW I’ve reported other bugs in the widget module, and the guys responded that they’re re-writing the widget module to fix many issues. Hopefully the new module will be released soon…

As I see it there isn’t much we can do to fix it (unless somebody else has some suggestions).
I’d say that if the error isn’t crashing your app, and it’s behaving as it should despite the error, you *could* go ahead and ignore it if your app needs to be released. It’s your call.
I still think it’s important to report this issue just in case you’ve found some edge-case that nobody else has reported.
[import]uid: 70847 topic_id: 35342 reply_id: 142728[/import]

When dealing with “non English” chars with string.upper/lower, it’s known to not work very well unless using an utf8 library, however I found that I can use “upper( myWord )” might do the trick in my sqlite DB that is all lower case words. The problem is I can’t get my query to work…

This works but I would like to let sqlite handle my upper/lower instead so I don’t have to depend on other modules.

[lua]

local sql = “SELECT * FROM WORDS WHERE length(word) > 4 AND word = '”… utf8replace(word, toLower) …"’ "

[/lua]

So I tried to use sqlite lower/upper() but it doesn’t work…anyone have any ideas?

[lua]

local sql = “SELECT * FROM WORDS WHERE upper(word) AND length(word) > 1 AND word =’”… word …"’ "

[/lua]

Thanks.

When dealing with “non English” chars with string.upper/lower, it’s known to not work very well unless using an utf8 library, however I found that I can use “upper( myWord )” might do the trick in my sqlite DB that is all lower case words. The problem is I can’t get my query to work…

This works but I would like to let sqlite handle my upper/lower instead so I don’t have to depend on other modules.

[lua]

local sql = “SELECT * FROM WORDS WHERE length(word) > 4 AND word = '”… utf8replace(word, toLower) …"’ "

[/lua]

So I tried to use sqlite lower/upper() but it doesn’t work…anyone have any ideas?

[lua]

local sql = “SELECT * FROM WORDS WHERE upper(word) AND length(word) > 1 AND word =’”… word …"’ "

[/lua]

Thanks.