World: r3wp
[SQLite] C library embeddable DB .
older newer | first last |
amacleod 4-Dec-2008 [793x2] | Sorry I mean: nor this: SQL reduce [{UPDATE fdbooks SET bk=?, chap=?, sec_num=?, ftext=?, key_words=?, up_date=? WHERE ref_number=?} blk/2 blk/3 blk/4 blk/5 blk/6 (to-date blk/7) blk/1] |
I found part of the problem... If I'm updating multiple records it fails to update but if update one record it updates. I'm using a transaction here. do I need to place each var in ()? | |
Pekr 4-Dec-2008 [795] | which version of sqlite dll are you using? there was one bug with update, which I reported one year ago, which even corrupted data. They fixed it thought in next version. So hopefully this is not your case ... |
amacleod 4-Dec-2008 [796x3] | Found it! I had my 'begin' of my transaction inside the loop. dope! |
Thanks Pekr. | |
That's what happens when you work in hte middle of the night. | |
GiuseppeC 14-Dec-2008 [799x3] | Hello, I am experimenting with SQLite and I have a question: How do I store a web page retrieved with READ onto a SQLite field ? |
Forget it, just found the solution. My fear was all about string handling but everything seems going well. | |
It seems to work even with block of lines | |
Ashley 14-Dec-2008 [802] | Yep, by default the driver molds and loads REBOL values. Use /direct if you don't want this behaviour. |
amacleod 17-Dec-2008 [803x3] | how do you search for a string within a column. Is that what they refer to as full text search? (fts) |
does sqlite.r support these fts tables? | |
Let me first make sure i need fts... I want to find a sub-string within a larger string: for example: find the the rows that contain word "table" in a column called f_text one row of which might contain "When inserting into an fts table, if no docid is provided," This would be a hit since table is contained in the string. | |
sqlab 18-Dec-2008 [806] | like is your friend |
amacleod 18-Dec-2008 [807] | syntax? |
Robert 18-Dec-2008 [808] | See SQLite homepage. It's something like this: LIKE '%...%' |
Chris 18-Dec-2008 [809] | Begins with is LIKE '...%' Anywhere is LIKE '%...%' End is LIKE '%...' Rebol filenames: LIKE '%.r' |
sqlab 18-Dec-2008 [810] | select * from table where f_text like '%table%' but the wildcards may vary according the database |
[unknown: 5] 18-Dec-2008 [811] | Amacleod - http://www.w3schools.com/sql/sql_like.asp |
amacleod 18-Dec-2008 [812] | Thanks, I try it out in the morning. I googled but could not find it. I've had trouble finding a good source of docs for sqlite before. w3schools looks good. Thanks again all! |
GiuseppeC 19-Dec-2008 [813x2] | Amacleod: if you search for ANSI 92 you should be able to find for the complete specification. |
This also brings me a question: what about SQLite and UNICODE ? | |
amacleod 21-Dec-2008 [815x4] | I got the 'like' command working with a text string but I can not fiqure out how to use variables... something like: rslts: sql reduce [{SELECT * FROM books WHERE ftext LIKE '%?%' } var] |
This works: rslts: sql reduce [{SELECT * FROM books WHERE ftext LIKE '%string%' } ] | |
SQL reduce [{INSERT INTO table VALUES (?, ?, ?)} fname lname phone] | |
Ignore that last message...Sorry | |
Graham 22-Dec-2008 [819] | you have to create your dialected string first |
sqlab 22-Dec-2008 [820] | A concatenation like like '%' || ? || '%' shoud work |
PeterWood 22-Dec-2008 [821] | I got this unexpected behaviour: >> do %~/Code/Library/Rebol/sqlite.r Script: "SQLite driver" (26-Nov-2008) >> connect %~/Code/SQLite3/mydata.db ** User Error: SQLite out of memory ** Near: make error! reform ["SQLite" error] >> change-dir %~/Code/SQLite3 == %/Users/peter/Code/SQLite3 / >> connect %mydata.db == 3400768 |
amacleod 22-Dec-2008 [822x7] | sqlab, reslts: sql reduce [{select * from fdbooks where ftext like '%'||?||'%'} srch] == [] where srch: "ladders" no error but not finding what should be there.: reslts: sql reduce [{select * from fdbooks where ftext like '%ladders%'}] == [[2 "FFP-LADDERS" "1-PORTABLE LADDERS" "2." " SIZES AND TYPES OF PORTABLE LADDERS IN USE^/" "" 4-Dec-2008/15:29:1 9] [4 "FFP-LADD... |
I got it! it works when srch: 'ladders | |
as word? | |
Not string? | |
What if I want multi-word string? as in; reslts: sql reduce [{select * from fdbooks where ftext like '%aluminum ladders%'}] == [[9 "FFP-LADDERS" "1-PORTABLE LADDERS" "3." " CONSTRUCTION OF PORTABLE ALUMINUM LADDERS^/" "" 4-Dec-2008/15:29:19 ] [10 "FFP-LADD... | |
and while we are here... what about multiple words in string... ladders and "aluminum" as apposed to "aluminum ladders" | |
And how could I figure this out myself. Is this syntax a part of the sqlite.r interface or sqlite itself? | |
Graham 22-Dec-2008 [829] | You need a primer in sql ... |
amacleod 22-Dec-2008 [830x2] | I can find the sql commands but I do not know how to rebolize them. Where can I find that I need to do this: '%'||?||'%' ? |
I do not see anything like that in any docs I can find. | |
Graham 22-Dec-2008 [832x4] | You construct your sql statement and test it. |
Then you substitute your variables ... that's it. | |
the sql statements are standard sql. You don't need to use the ? stuff .... ie. you can compose your statement before hand. | |
I don't know sqllite's syntax .. but this looks wrong to me reslts: sql reduce [{select * from fdbooks where ftext like '%aluminum ladders%'}] it should simply be reslts: sql {select * from fdbooks where ftext like '%aluminum ladders%'} | |
BrianH 22-Dec-2008 [836x2] | Those || are string concatenation, afaict. Use JOIN in REBOL for that. |
Or REJOIN. | |
Graham 22-Dec-2008 [838x4] | I've never tested whether the sql dialect can replace ? inside single quotes. |
Anyway, you don't need to use the sql dialect ... just create your sql statement and then execute it. | |
And once you learn sql, then you can look at the dialect .... which is a simple substitution thing. | |
Instead of LIKE, you can also use CONTAINS | |
BrianH 22-Dec-2008 [842] | SQLite has a CONTAINS extension? |
older newer | first last |