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

World: r3wp

[SQLite] C library embeddable DB .

Robert
27-Feb-2009
[909x2]
I don't know anything about the plug-in approach at the moment, so 
I can't say.
Overall I don't care to much, which way we go. It must be simple 
and straight forward to use. And we must have a way on the Rebol 
side to privode the C side of life. Like pointers and structs etc. 
without tricks.
amacleod
28-Feb-2009
[911]
Robert, 'recycle' worked like a charm!
Thanks a lot.

I had the same problem when reading from the DB so I used 'recycle 
again in hte query loop....

This had the added benifit of of sealing amemory leak with the images 
too.

Memory would increase evrytime a new image was displayed but now 
it tops out at an acceptable level..
Graham
28-Feb-2009
[912]
Is this GC problem being worked on for 2.7.7 ??
BrianH
28-Feb-2009
[913]
Right now 2.7.7 is not being worked on at all. That sonds like a 
good thing to fix when we do start working on 2.7.7.
[unknown: 5]
28-Feb-2009
[914x2]
I like  2.7.6 is the last of the 2.x series.  Brian may release a 
library containing updated mezzanines and patches.
like = think
BrianH
1-Mar-2009
[916x2]
We find new bugs in R2 natives all of the time - Carl just found 
one in the last week. There will likely be bugfix releases, but no 
incompatible changes will be made to R2 anymore, afaict. All of the 
new functions in R3 and incompatible improvements to existing functions 
will likely be made in a separate script that you can load or encap. 
That script will be maintained outside of the R2 update cycle. I 
think that will be the plan, at least.
There may be some changes to behavior that was so broken that it 
couldn't possibly have been relied on by existing code, like the 
change in return value of ALTER in 2.7.6. I would be surprised if 
the INSERT/dup/part bug Carl found this week isn't fixed in the next 
R2 release, for instance, whenever that release happens.
Graham
1-Mar-2009
[918]
I think it will be a long time before R3 is usable in the real world 
... so my understanding is that there will still be 2.7 releases.
BrianH
1-Mar-2009
[919]
I agree. None are planned at the moment, but it is likely that there 
will be more in the future.
Janko
11-Mar-2009
[920]
I can't seem to find info if dobedash's sqlite.r should work with 
sqlite3.dll or sqlite.dll, does anyone have any idea?
Pekr
11-Mar-2009
[921]
IIRC it supports version 3 of the driver. Dunno the name of .dll. 
But - just rename sqlite3.dll to sqlite.dll and run few tests, no? 
:-)
Janko
11-Mar-2009
[922x2]
It worked for me but now I started to get "Not a database or encripted" 
error and I couldn't figure out why.. I discovered that the sqliteadmin 
app was making v2 files now and that was the problem.
a view into db file as hex quickly resolved which version is which, 
it is written at the start, and so I saw what is going on, thanks 
Petr
Janko
17-Mar-2009
[924x2]
.
Did anyone try using sqlite.r from Dobeash in free rebol code 2.7.6 
on linux. (debian). I get "feature not available in this REBOL" but 
it works on windows.
Oldes
17-Mar-2009
[926x2]
I think the library calls are not enabled in linux version of Core.. 
ask Carl.
Or you can use Rebpro from Rebol's SDK
Janko
17-Mar-2009
[928x2]
Oldes: yes, it looks that way by the error given
I am an new/old user so I am still on free versions of rebol.. I 
gues now is time to buy the SDK
Oldes
17-Mar-2009
[930x4]
I think you don't need the license
just download it and try it
http://www.rebol.net/builds/#section-1
At least what I was trying, there was the license message on boot, 
but I could use the /library
Janko
17-Mar-2009
[934x3]
hu, I never saw that download page :)
wow.. first rebol download > 1MB :)
aha.. I am getting somewhere .. it alows it now but I get some error 
with .so .. maybe this is the reason cheyenne can't open it either 

>> do %sqlite.r
Script: "SQLite driver" (26-Nov-2008)
REBOL - Security Check:

Script requests permission to open a port for read/write on: libsqlite3.so
Yes, allow all, no, or quit? (Y/A/N/Q) Y
** Access Error: Cannot open sqlite3_prepare_v2

** Near: *prepare: make routine! [db [integer!] dbq [string!] len 
[integer!] stmt [struct! [[integer!]]] dummy [struct! [[integer..
Oldes
17-Mar-2009
[937x2]
you have to start it with the -s switch and good is to use the -q 
switch as well.
http://www.rebol.com/docs/words/wusage.html
Janko
17-Mar-2009
[939x5]
-s probably means without asking for permissions... I tried now rebpro 
-s -q but I got the same .so error .. maybe I didn't prepare the 
.so files well ..I am just looking into docs

>> do %sqlite.r
** Access Error: Cannot open sqlite3_prepare_v2

** Near: *prepare: make routine! [db [integer!] dbq [string!] len 
[integer!] stmt [struct! [[integer!]]] dummy [struct! [[integer...
when I installed sqlite with apt-get install sqlite3 I got 2 files 
into /usr/lib/ directory   ./usr/lib/libsqlite3.so.0.8.6  and   ./usr/lib/libsqlite3.so.0 
... if I run rebol it doesn't find sqlite so I copied one of them 
(I tried with both, they are of same size btw) to directory where 
rebol / rebpro and sqlite.r is and renamed it to    libsqlite3.so 
  and then it seems to find it ... now this is just common sense 
as I am not that experienced with this on linux
ah... I looked at history of this chat and saw that there is debian 
package libsqlite3-dev ... I installed this and now I have libsqlite3.so 
.. it seems rebpro finds it without copying it to local directory 
now but it still gibes the same " Cannot open sqlite3_prepare_v2" 
error
ha.. I changed sqlite_prepare_v2 to sqlite_prepare in sqlite.r and 
now rebpro and cheyenne work!!
I hope this doesn't mean I something else won't work as it should
Dockimbel
17-Mar-2009
[944]
Have your application execute the following SQL statement and then 
look at the result : select sqlite_version(); 

AFAICT, sqlite3_prepare_v2 is available starting from SQLite 3.5.2.
Janko
17-Mar-2009
[945]
aha.. stupid me.. apt-get usually doesn't provide latest versions 
but a more "stable" ones ... yes it's  3.3.8
Dockimbel
17-Mar-2009
[946]
You don't need to use apt-get for sqlite, just download the latest 
library and put it in your app folder near sqlite.r : http://www.sqlite.org/sqlite-3.6.11.so.gz
(I guess you'll need to rename it to libsqlite3.so).
Janko
17-Mar-2009
[947]
thanks Doc!
amacleod
1-Apr-2009
[948]
I did not realize sqlite.r was set up to use mysql3.so (linux libs) 
Got my app running on linux witout a hitch...
Auto detects OS...great!
Janko
11-Apr-2009
[949]
this might be usefull to users of sqlite.. I yesterday encountered 
the "db is locked" error and it got me a little worried, but with 
this (simple) aproach it seems to solve that http://itsystementwicklung.de/pipermail/list-pysqlite/2009-April/000380.html
Janko
14-Apr-2009
[950x2]
.
I don't get this ... I started getting very long loading times with 
my webapp when I changed or inserted the and it was very fast before 
... now I saw that it's the sqlite making these delays.. this is 
not the problem of sqlite.r but the sqlite itself because I get the 
same behaviour with sqlite3 shell.


But I can't believe this , I am certain I am doing something wrong.. 
I remember sqlite can handle GB of data and is very fast, but in 
my case... I have 183 rows in a simple 5 column table (db file is 
10kb) .. if I do single update table X set y = ".." where Z = ".."; 
 it takes like 3 seconds. This updates just 1 row out of 183. Does 
anyone have any idea? I tried to do the "Vacuum" command but it's 
the same after it.
Pekr
14-Apr-2009
[952]
can you post whole query?
Janko
14-Apr-2009
[953x5]
I also added the indexes now and it is maybe a little faster but 
on single where but on both that I need it looks more or less the 
same (select by same condition is imeddiate)
Pekr.. I will
This is a very small VPS, but I have 300kb raw rebol data structures 
in ordinary files, and I edit and seek them without any indexes and 
it works immediatelly..  I only moved this part of data to sqlite 
because it handeles the file locking ( these are sort of mailboxes 
so that the app and bots can communicate over them )
CREATE TABLE [domains] (
[id] INTEGER  NOT NULL PRIMARY KEY,
[domain] VARCHAR  NOT NULL,
[user] VARCHAR  NOT NULL,
[processed] DATETIME  NULL,
[ok_count] INT NOT NULL DEFAULT 0,
[fail_count] INT NOT NULL DEFAULT 0,
[error] TEXT NULL
)

test query is as straighforward as it can be: 


update domains set user = "u3" where domain = "www.todelete.com" 
and user = "u3";
I tried now with transaction .. it has no point here becauase it's 
just one query at the time ... but results were as expected.. update 
did finish imediatelly , but commit took the 1-3s time also
Pekr
14-Apr-2009
[958]
try to index domain, and maybe even user fields, or it will go sequentially 
thru all of record lines ...