Updated SQLite Library?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Updated SQLite Library?

Post by jassing »

The sqlite library included with PB doesn't fully support "Delete" command; however it looks like it may be sqlite "default" (the command line doesnt support it either)

Reference http://sqlite.org/compile.html#enable_u ... lete_limit
specifically wanting to do this:

Code: Select all

delete from mytable order by fieldA limit 10;
which is legal sqlite syntax: http://sqlite.org/syntaxdiagrams.html#d ... mt-limited
Short of recompiling from source and callng the dll directly, updating the pb lib would be appreciated...
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Updated SQLite Library?

Post by Fred »

the lib has been updated in 4.61 beta 1
User avatar
bobobo
Enthusiast
Enthusiast
Posts: 206
Joined: Mon Jun 09, 2003 8:30 am

Re: Updated SQLite Library?

Post by bobobo »

SQLITEDoku wrote:If SQLite is compiled with the SQLITE_ENABLE_UPDATE_DELETE_LIMIT compile-time option, then the syntax of the DELETE statement is extended by the addition of optional ORDER BY and LIMIT clauses
other SQLite's here (dll,exe,..) does like the PB-Lib does.
사십 둘 .
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Updated SQLite Library?

Post by jassing »

Fred wrote:the lib has been updated in 4.61 beta 1
and it includes the optional feature?
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Updated SQLite Library?

Post by Fred »

Why is it disabled by default ?
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Updated SQLite Library?

Post by USCode »

jassing wrote:

Code: Select all

delete from mytable order by fieldA limit 10;
Jassing,
I don't find this syntax in my SQL92 book but I see from your links that SQLite supports it ...
What exactly does this syntax do? Deletes the rows in the given order? Can you give a scenario where an ORDER BY in a DELETE is useful?
Thanks!
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Updated SQLite Library?

Post by jassing »

Fred wrote:Why is it disabled by default ?
yes.
USCode wrote:
jassing wrote:

Code: Select all

delete from mytable order by fieldA limit 10;
Jassing,
I don't find this syntax in my SQL92 book but I see from your links that SQLite supports it ...
What exactly does this syntax do? Deletes the rows in the given order? Can you give a scenario where an ORDER BY in a DELETE is useful?
I posted links to the sqlite documentation ...

I'm using it to delete the oldest ("top") x records to keep the database size from growing endlessly.
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Updated SQLite Library?

Post by USCode »

USCode wrote:Jassing,
I don't find this syntax in my SQL92 book but I see from your links that SQLite supports it ...
jassing wrote:I posted links to the sqlite documentation ...
Yes, I acknowledged that in my post.
jassing wrote:I'm using it to delete the oldest ("top") x records to keep the database size from growing endlessly.
Ah, interesting - that could be very useful, too bad it isn't supported by more DB engines. By using it you're limiting yourself to SQLite but if that's all you need it is handy!
Thanks
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Updated SQLite Library?

Post by jassing »

USCode wrote:
USCode wrote:
jassing wrote:I'm using it to delete the oldest ("top") x records to keep the database size from growing endlessly.
Ah, interesting - that could be very useful, too bad it isn't supported by more DB engines. By using it you're limiting yourself to SQLite but if that's all you need it is handy!
it's hard to use any database engine and not "get stuck with it" - any porting to a different engine can be done and queries adjusted...

Since this is an easy one to implement (set a flag and build the library) ... I've not seen any real performance or size hits from it, I'm not sure why it's not on by default...
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Updated SQLite Library?

Post by USCode »

Fred wrote:Why is it disabled by default ?
Maybe because it's non-standard SQL?
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Updated SQLite Library?

Post by jassing »

USCode wrote:
Fred wrote:Why is it disabled by default ?
Maybe because it's non-standard SQL?
The great thing about standards is there are so many to choose from...
Who cares, it's a very useful feature, doesn't force anyone to use it; and doesn't break existing queries...
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Updated SQLite Library?

Post by Fred »

Actually it's not "that easy" because we use the almagation file for better perf, and the flag isn't activable with it. So we would have to use the real sources and such, and i don't thuink it worth it for a non standard feature (the perf will be lower for everything else).
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Updated SQLite Library?

Post by USCode »

jassing wrote:The great thing about standards is there are so many to choose from...
Who cares, it's a very useful feature, doesn't force anyone to use it; and doesn't break existing queries...
Maybe you should be bringing this up with the SQLite team and ask them to make this the default behavior.
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Updated SQLite Library?

Post by jassing »

I was just asking if that could be part of the sqlite library in PB... sorry if my request was improper.
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Updated SQLite Library?

Post by USCode »

jassing wrote:I was just asking if that could be part of the sqlite library in PB... sorry if my request was improper.
No need to say sorry. It doesn't hurt to ask, all Fred can do is say "No". :wink:
Post Reply