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

World: r3wp

[SQLite] C library embeddable DB .

sqlab
4-Jan-2009
[877]
The new field OldID holds the former primary key.
You have to  join via the oldID instead of the primary key.

If you can not alter your select statement, maybe you can generate 
an adequate view.
Robert
4-Jan-2009
[878]
Ok, I thought there was a different trick. Well, I'm not using JOINS 
nor VIEWS a lot in my app. I preferr to get back Rebol blocks and 
traverse these and collect what I need. Much simpler than hacking 
long SQL statements.
Robert
20-Jan-2009
[879]
The newest version of SQLite adds support for nested transactions. 
I'm going to look at the SQLite driver to see how we can support 
this.
Pekr
20-Jan-2009
[880]
It would be nice to support collations too, but I was not successfull 
in wrapping that functionality ....
Robert
20-Jan-2009
[881x2]
Is this used to define user defined comparing functions?
Do you have a use-case for this? Never had this requirement.
Pekr
20-Jan-2009
[883]
use case? proper national sorting? IF you do some SELECT on field 
like last name, and you want some in-between results, e.g. A - D, 
then Czech alphabet has C with a hook upon it, and it is supposed 
to sort right after C, but without collation support it will sort 
after Z ....
Robert
20-Jan-2009
[884x3]
Ah, ok. How about sorting in Rebol? Does this help?
Putting this into SQLite would require, that we add those country 
specific sorting rules at the C level and provide a Rebol call, so 
select the correct sorting.
Do you have any references to an country specific sorting implementation? 
Than I can take a look how to add it.
Pekr
20-Jan-2009
[887]
There is some collation function which we need to wrap. I posted 
it here some time ago, but we were not succesfull in wrapping and 
utilising it. I also tried to look into IIRC Python sources, and 
it was not clear to me, how to specify it in REBOL level. IIRC it 
is callback type function ...
Robert
20-Jan-2009
[888x2]
SET-SORTING-MODE "CZ"
And than have those collations hard coded to a Rebol SQLite DLL.
Pekr
20-Jan-2009
[890x2]
REBOL SQLite DLL? I don't want other DLL ... We need better interfacing 
to do it in REBOL as a binary, with back-pointer from C level :-)
... one more point for future. Imagine obtaining correct order from 
SQL, then using REBOL level grid, and column sort facility. I think 
that we also will need to get such things adressed in R3 directly, 
or it will distort sort order ...
Robert
20-Jan-2009
[892]
But you can sort today in R2. Why do you need SQLite collations if 
you don't want to sort in SQLite?
Pekr
20-Jan-2009
[893]
I want to sort in SQLite. But then you receive your recordset to 
REBOL, you put it into grid for e.g., which has facility for sorting 
columns. Then you press particular column, and grid sorts your result 
recordset using rebol's built in 'sort function ... and the result 
is wrong ... (well, but this is minor issue, the importance is to 
get correct resultset from the query. I just tried to say, that R3 
has to address some localisation principles itself too ....)
Robert
21-Jan-2009
[894]
Ok, now I got it. ;-)
Oldes
21-Jan-2009
[895]
this is not sqlite retated, but:

do http://box.lebeda.ws/~hmm/rebol/projects/ucs2/latest/make-ducet.r
Pekr
21-Jan-2009
[896]
Oldes - thanks - that is an interim solution for R2 :-)
amacleod
27-Feb-2009
[897x3]
I'm getting errors when I try to insert a binary file into sqlite


I have no problem when I read/binary an image from disk and insert 
it but when I download it from a mysql db its saving as those crazy 
text characters.


I'm converting it back to binary with "to-binary" and when I probe 
it it looks right but it keeps converting back to the original mysql 
output...

Any ideas what might be going on?


I can view the outputed image  from mysql when I use to-binary so 
I know that its not currupted.
I see what might be the prob...
Some images are large...Too large? And may be getting truncated.

I was using binary..should I use blob?
Actually size of the image does not seem to be the prob as this works: 

SQL reduce [{insert into images values (?,?,?,?,?,?,?,?)} "img/1" 
"img/2" "img/3" "img/4" "img/5" pic "img/7" "img/8"]
where pic is a large 4000x3000 full color photo.
I get no error.

But if I loop 50 and insert the above data 50 times I get an error???
Robert
27-Feb-2009
[900]
IIRC there is a bug in Rebol's GC that can show up when using big 
datasets and corrupts data. Have you tried to play around with RECYCLE
amacleod
27-Feb-2009
[901x2]
no, How would that work when working with large database results?
I'm able to get a large set of results from mysql and use it (View 
the images in a layout) but when I try to insert this data into sqlite 
it seems to get currupted...
It sounds like a sqlite problem...
Robert
27-Feb-2009
[903]
I think it's on the way from Rebol to DLL.
amacleod
27-Feb-2009
[904]
So at what point would I use recycle?
After each insert? in my foreach loop?
Robert
27-Feb-2009
[905x2]
You have to try. The SQLite driver uses a heuristic every 100 rounds 
or so. Just play around to see if it makes a difference.
That's one cause why I want to get my hands on the external library 
interface in R3 ASAP.
amacleod
27-Feb-2009
[907]
Thanks Robert.
Pekr
27-Feb-2009
[908]
Robert - what is your preferable method for "DLL interface"? Is it 
a mixture of rebol dialect (as in R2) and plug-in aproach?
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
[926]
I think the library calls are not enabled in linux version of Core.. 
ask Carl.