r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[SQLite] C library embeddable DB .

Will
29-Mar-2008
[693x4]
macport/sqlite3 version 3.5.4 worked but was 2 times slower than 
with 3.4.0
Thanks BrianH, i'll stick with 3.4.0
btw, are you all considering moving to treatbase?
maybe someone could check if 3.5.7 works with other platforms, if 
not, the sqlite.r maintainer can maybe spot an easy fix looking at 
http://www.sqlite.org/changes.html
Robert
30-Mar-2008
[697x3]
I have 3.5.7 running on Windows together with Rebol. Works perfectly.
I got the DLL into 215KB :-)
Tretbase? I think it's pur Rebol based, right? No I won't. I don't 
think Rebol is the right tool for a database engine.
btiffin
30-Mar-2008
[700]
Robert;  I'll fight you on that.  :)  Depends on the scale.  RebDB 
is beautiful for dbs under the 10K ish limit;  TRETBASE is destined 
to be a very handy REBOL scripting database engine, and Paul has 
been hammering on some larger datasets, (not something I'd plan on, 
but it's being developed that way).  So unless you are working in 
the 100K+ record arena, or need multiple user concurrency, I do think 
REBOL is the right tool for a database engine.
Robert
31-Mar-2008
[701]
;-) Are RebDB and TRETBASE ACID conform?
btiffin
31-Mar-2008
[702]
I didn't expect to win the fight, but I wasn't really expecting to 
get pinned on the first move.  :)  But I'll struggle a little more. 
 In the long run I think the simplicity of the pure REBOL solutions 
(and a little careful manual (or scripted) management) will have 
fewer headaches than a larger full scale  ACID database (again in 
the small dataset arena).


My opinion may vary over time and over projects...but not today. 
  And sorry about clogging the SQLite chat.  rebols could well build 
up a fair amount of expertise with this engine given that  load/library 
is now open to all.
Robert
31-Mar-2008
[703x3]
Ok, and please don't get me wrong. SQLite is nice because it's small 
and simple to attach to Rebol, thanks to the work of Ashley. So even 
for 10K records you can use it because the costs are low.
But, it stays a SQL database not directly optimized for Rebol usage.
So, getting a database system that has much better / native Rebol 
support makes a lot of sense. Hopefully such a system will once be 
implemented on the C level for good performance etc.
Ashley
7-Apr-2008
[706]
Will, did you try modifying the following lines in the driver:

	*lib: load/library ... ; to call the correct version

 *prepare: make routine! ... ; to use "sqlite3_prepare_v2" instead 
 of "sqlite3_prepare"
Will
7-Apr-2008
[707x2]
Thank you Ashley, have changed to v2 but get:
connect/log/create d 
** User Error: SQLite out of memory
** Near: make error! reform ["SQLite" error]
Ashley
7-Apr-2008
[709]
Are you able to connect to an existing db file?
Louis
8-Sep-2008
[710]
rebview cl-sqlite.r


Any idea why I'm getting this (using Ubuntu and Ashley's sqlite.r): 
Script Error: Library error: libsqlite3.so: cannot open shared object 
file: No such file or directory
** Near: *lib: load/library switch/default fourth system/version
>>
Chris
8-Sep-2008
[711]
Do you perhaps need the sqlite library in your working folder?
Louis
8-Sep-2008
[712x3]
This solved the problem: "sudo apt-get install libsqlite3-dev"
Chris, you are right. Thanks!
How can I do an "if not exists? on a sqlite table?
Chris
8-Sep-2008
[715]
All the tables are stored in the 'sqlite_master' table (including 
the 'Create' command)
Chris
9-Sep-2008
[716]
select name from sqlite_master where type = 'table' and name = ?
Louis
9-Sep-2008
[717]
Thanks, Chris. I have this working now.
sqlab
19-Sep-2008
[718x2]
What is the recommendet way to deal with a lock and to get rid of 
dat-journal?

I do not like to stop all processes and to manually remove the file.
Also to increase the retries has its limitations.
So, how do you handle the problem?
Ok, got it.

I increased the retries and use a shorter wait with a random duration 
If there is still a lock,  I use an sqlite/*step sqlite/sid
james_nak
9-Oct-2008
[720]
I found something odd with an app I'm writing. If I insert or update 
a field (varchar) with a string that has any spaces in it. , it throws 
a rebol error if I try to select it. 

For example, I have a string "OK BOb" stored and when I sql {select 
* from vocab}
** Script Error: OK has no value
** Where: rejoin
** Near: OK BOb 
It doesn't matter what the first word is.

I can't believe I'm the only one so I must be doing something wrong.
Pekr
9-Oct-2008
[721x2]
how do you connect to DB? There are two modes - normal, and /direct 
....
try to open it with /direct refinement ...
james_nak
9-Oct-2008
[723x3]
I just use "connect  %dbname.db

OK, I'll try that.
How did you know?
SteveT
9-Oct-2008
[726]
Hi all, is the SQLite driver for REBOL different to the standard 
in that it has locking working? Does this mean it can be used for 
small multi-user apps or is it that people DO but SHOULDN'T like 
with Access?

Thanks
james_nak
9-Oct-2008
[727x3]
I see.../direct "Do not mold/load REBOL values"
Says: # Lock detection
The driver detects locks and initiates retries on your behalf.

@ http://www.dobeash.com/sqlite.html

Though I have not tried it in multi-user env.
Thanks Pekr for the good advice.
SteveT
9-Oct-2008
[730]
thanks,  I have the mySQL driver working but I was just mewsing at 
not having to have a WAMP deployment.
james_nak
9-Oct-2008
[731]
Yes, far (outside of my ignorance above) it works quite well.
Ashley
10-Oct-2008
[732]
SteveT: read http://www.sqlite.org/lockingv3.htmlfor more information 
on locking, especially the section titled, "6.0 How To Corrupt Your 
Database Files".
SteveT
11-Oct-2008
[733]
Thanks Ashley
sqlab
12-Oct-2008
[734]
I made a few tests with sqlite and concurrent processes writing and 
manual reading.

I can not recommend it, if you cannot accept data loss under these 
circumstances. Sooner or later it will get  in an inconsistent state.
SteveT
12-Oct-2008
[735]
Thanks for the info
Ashley
12-Oct-2008
[736x2]
Were the problems you experienced REBOL or SQLite related? See http://www.rebol.net/cgi-bin/rambo.r?id=4063&
problem does not occur if a periodic recycle is performed

 should read "problem occurs less frequently if a periodic recycle 
 is performed"
sqlab
13-Oct-2008
[738]
I experienced the problems Rebol and Sqlite related.

Rebol crashed soon trying to read after recovering from a lock, as 
the written data were no more consistent.
GiuseppeC
15-Oct-2008
[739x2]
Hello, I need to implement a database with over 500 rows and I think 
SQLLite is the riight solution. Speed is much important as I need 
to perform about 20 queries each second. Is it loaded in memory ? 
Is there a way to load the database in memory ?
(*over 500K rows)
Maarten
15-Oct-2008
[741x2]
What's the size of each row? Given the size/price of memory, REBOL 
may be fast enough by itself. If you use sort, parse and create a 
little list comprehension dialect...
500k rows, every 2 bytes per row makes your DB grow by 1 MB. Now 
if your average size is 2KB/row, you'll use 1Gb of memory (this REBOL 
independent). Doable