Re: [sqlite] client/server
Just another suggestion to the problem which I use my self. I use a single SQLite database for each client. Hosting the database collection on a bastion host as close to the client as I can get it. Therefore no client/server connection used. I then use a daemon which reads all the client SQLite databases in turn, and writes them to a central DBMS, as well as writing information back out to the client SQLite databases. (My central database in my case is MySQL because it's client/server and has a better locking model.) I also use the Linux /dev/shm directory to store these bastion databases. Which reads/writes about 200 times faster than a uncached disk. Although this is erases when the server reboots. This gives dramatic performance and low load on the central database :) Ben Andrea Giammarchi wrote: Eugene Wee wrote: Not at all (if I correctly understand what you're trying to say). For example, there exists a SQLite extension in PHP (which comes bundled by default in PHP5, but currently does not support SQLite3). pecl, PDO extensions allows PHP to use SQLITE Version 3.X too :-) http://it2.php.net/manual/it/ref.pdo.php#pdo.drivers andr3a
[sqlite] Lemon grammar question
With Bison, you can do something like this (not quite bison syntax): myrule: TYPE IDENT {DoSomethingRightAfterIdent($1,$2); } LP more_rules RP; {DoSomethingAfterEverything($1,$2,$5); } I.e. you have a chunk of C code that's called in the middle of the processing of the production. (In the above case right after TYPE IDENT) Can you do this with lemon? I know you can do something like this for other cases, myrule ::= TYPE(T) IDENT(I) temp LP more_rules(R) RP. { DoSomethingAfterEverything(T,I,R); } temp ::= DoSomethingRightAfterIdent(...how would I access TYPE/INDENT from here..); but it doesn't quite work for this case... Any ideas? /Ludvig
Re: [sqlite] Lemon grammar question
Ludvig Strigeus wrote: With Bison, you can do something like this (not quite bison syntax): myrule: TYPE IDENT {DoSomethingRightAfterIdent($1,$2); } LP more_rules RP; {DoSomethingAfterEverything($1,$2,$5); } I.e. you have a chunk of C code that's called in the middle of the processing of the production. (In the above case right after TYPE IDENT) Can you do this with lemon? I don't know if you can do it bison-style, but you can do this: 1) have a struct that wraps a TYPE(T) and IDENT(I). 2) myrule : prefix(P) LP more_rules(R) RP . { /* process rule */ } 3) prefix(P) : TYPE(T) IDENT(I) . { /* process ident; wrap T and I in the struct from (1); */ } 4) remember to set the default destructor of the prefix rule to destroy the struct from (1). I know you can do something like this for other cases, myrule ::= TYPE(T) IDENT(I) temp LP more_rules(R) RP. { DoSomethingAfterEverything(T,I,R); } temp ::= DoSomethingRightAfterIdent(...how would I access TYPE/INDENT from here..); but it doesn't quite work for this case... Any ideas? /Ludvig HTH Ulrik Petersen -- Ulrik Petersen, PhD student, MA, B.Sc. Aalborg University, Denmark
[sqlite] SQL question
I have 2 related table: CREATE TABLE Ingredients( ID INTEGER PRIMARY KEY, name TEXT, description BLOB, property_ID INTEGER ); CREATE TABLE Properties( ID INTEGER PRIMARY KEY, price double ); When I create a new Ingredient I would like to create a new property for this ingredient and setup its property_ID. because there is no stored procedure I was thinking to use a trigger like this one: CREATE TRIGGER create_ingredients_property AFTER INSERT ON Ingredients FOR EACH ROW BEGIN INSERT INTO Properties () VALUES (); UPDATE Ingredients SET property_ID=ROWID WHERE ID=OLD.ID; END; but it doesn't work I could do with some help for the SQL syntax :D
Re: [sqlite] SQL question
BTW, one more question / precision. in INSERT INTO Properties() I didn't pass the value for ID. because basically I want an auto-incremented value which I don't have to worry about. maybe that's not the way to use such value ?! - Original Message - From: Lloyd Dupont [EMAIL PROTECTED] To: sqlite-users@sqlite.org Sent: Wednesday, June 08, 2005 10:37 PM Subject: [sqlite] SQL question I have 2 related table: CREATE TABLE Ingredients( ID INTEGER PRIMARY KEY, name TEXT, description BLOB, property_ID INTEGER ); CREATE TABLE Properties( ID INTEGER PRIMARY KEY, price double ); When I create a new Ingredient I would like to create a new property for this ingredient and setup its property_ID. because there is no stored procedure I was thinking to use a trigger like this one: CREATE TRIGGER create_ingredients_property AFTER INSERT ON Ingredients FOR EACH ROW BEGIN INSERT INTO Properties () VALUES (); UPDATE Ingredients SET property_ID=ROWID WHERE ID=OLD.ID; END; but it doesn't work I could do with some help for the SQL syntax :D
[sqlite] Problem with installing
Hello, I'd like to use the SQLite Library now for the first time, for my programs which should run under Linux and Windows. But I've got problems with the lib (I'm not very familar with .dll files). I downloaded the Precompared Binary for Windows. In my progam I included the sqlite3.h and I copied the sqlite3.dll into my project directory. But when I compile it, I got error message about unresolved links, e.g. sqlite3_open() I'm working normally with lib files, which I include with #pragma comment(lib, file.lib); into my C++ program. Can anyone help me? Thanks in advance :)
Re: [sqlite] SQL question
Hi, i am not sure if i understand your problem correctly. Perhaps the following does it: CREATE TRIGGER create_ingredients_property AFTER INSERT ON Ingredients FOR EACH ROW BEGIN INSERT INTO Properties (price) VALUES (some price); UPDATE Ingredients SET property_ID (select max(id) from properties) WHERE ID=OLD.ID; END; Because the id is omitted in the Insert - Statement to 'properties', sqlite supplies one, which you can then update into ingredients. However, I'm not clear where the price is supposed to come from. Martin Lloyd Dupont schrieb: BTW, one more question / precision. in INSERT INTO Properties() I didn't pass the value for ID. because basically I want an auto-incremented value which I don't have to worry about. maybe that's not the way to use such value ?! - Original Message - From: Lloyd Dupont [EMAIL PROTECTED] To: sqlite-users@sqlite.org Sent: Wednesday, June 08, 2005 10:37 PM Subject: [sqlite] SQL question I have 2 related table: CREATE TABLE Ingredients( ID INTEGER PRIMARY KEY, name TEXT, description BLOB, property_ID INTEGER ); CREATE TABLE Properties( ID INTEGER PRIMARY KEY, price double ); When I create a new Ingredient I would like to create a new property for this ingredient and setup its property_ID. because there is no stored procedure I was thinking to use a trigger like this one: CREATE TRIGGER create_ingredients_property AFTER INSERT ON Ingredients FOR EACH ROW BEGIN INSERT INTO Properties () VALUES (); UPDATE Ingredients SET property_ID=ROWID WHERE ID=OLD.ID; END; but it doesn't work I could do with some help for the SQL syntax :D
[sqlite] UNICODE Support
Hello there, Does SQLite support UNICODE? Can I store some Arabic or Chinese text in database? If it does not support UNICODE, Is there any workaround for that? Regards, Ajay Sonawane
Re: [sqlite] UNICODE Support
Hi, See http://www.sqlite.org/pragma.html, search for 'PRAGMA encoding' /Martin Ajay schrieb: Hello there, Does SQLite support UNICODE? Can I store some Arabic or Chinese text in database? If it does not support UNICODE, Is there any workaround for that? Regards, Ajay Sonawane
Re: [sqlite] SQL question
thanks Martin it worked! although I replaced your (SELECT MAX(ID) FROM Properties) by ROWID. is it sound? like that: CREATE TRIGGER create_ingredient_property AFTER INSERT ON Ingredients BEGIN INSERT INTO Properties (price) VALUES (NULL); UPDATE Ingredients SET property_ID = ROWID WHERE ID=OLD.ID; END; -- price doesn't matter. I set it up much later.. (whenever the user want, in fact), but I want my property line created and correctly linked!
Re: [sqlite] Problem with installing
Hi, You probably neglected to link to the dll. What compiler are you using? GCC (i.e. g++)? Eugene Wee [EMAIL PROTECTED] wrote: Hello, I'd like to use the SQLite Library now for the first time, for my programs which should run under Linux and Windows. But I've got problems with the lib (I'm not very familar with .dll files). I downloaded the Precompared Binary for Windows. In my progam I included the sqlite3.h and I copied the sqlite3.dll into my project directory. But when I compile it, I got error message about unresolved links, e.g. sqlite3_open() I'm working normally with lib files, which I include with #pragma comment(lib, file.lib); into my C++ program. Can anyone help me? Thanks in advance :)
AW: [sqlite] Problem with installing
Hello :) Thanks for your answer. I'm unsing for my first tests under Windows the Visual C++ Compiler .NET (because this first testprogram should run previously only under windows). Thanks in advance :) Daniel -Ursprüngliche Nachricht- Von: Eugene Wee [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 8. Juni 2005 15:40 An: sqlite-users@sqlite.org Betreff: Re: [sqlite] Problem with installing Hi, You probably neglected to link to the dll. What compiler are you using? GCC (i.e. g++)? Eugene Wee [EMAIL PROTECTED] wrote: Hello, I'd like to use the SQLite Library now for the first time, for my programs which should run under Linux and Windows. But I've got problems with the lib (I'm not very familar with .dll files). I downloaded the Precompared Binary for Windows. In my progam I included the sqlite3.h and I copied the sqlite3.dll into my project directory. But when I compile it, I got error message about unresolved links, e.g. sqlite3_open() I'm working normally with lib files, which I include with #pragma comment(lib, file.lib); into my C++ program. Can anyone help me? Thanks in advance :)
Re: [sqlite] Problem with installing
I'm using MSVC and the command LIB /DEF:sqlite3.def created a sqlite3.lib for me. In my case the LIB program was not in my path so I had to find it. C:\Program Files\Microsoft Visual Studio\VC98\Bin For more info, look for the heading MSVC and SQLite DLL under the SQLite wiki topic HowToCompile. http://www.sqlite.org/cvstrac/wiki?p=HowToCompile Steve Bryant [EMAIL PROTECTED] 6/8/2005 8:53:48 AM Hello, I'd like to use the SQLite Library now for the first time, for my programs which should run under Linux and Windows. But I've got problems with the lib (I'm not very familar with .dll files). I downloaded the Precompared Binary for Windows. In my progam I included the sqlite3.h and I copied the sqlite3.dll into my project directory. But when I compile it, I got error message about unresolved links, e.g. sqlite3_open() I'm working normally with lib files, which I include with #pragma comment(lib, file.lib); into my C++ program. Can anyone help me? Thanks in advance :)
Re: [sqlite] SQL question
Hi Lloyd, i am not sure, but i checked the documentation and i don't think it ist sound. In your Update, the ROWID semms to refer to ingredients.rowid. However, you want to set properties.rowid. Can it be that it works, because Properties and Ingredients happen to have the same number of rows? Martin Lloyd Dupont schrieb: thanks Martin it worked! although I replaced your (SELECT MAX(ID) FROM Properties) by ROWID. is it sound? like that: CREATE TRIGGER create_ingredient_property AFTER INSERT ON Ingredients BEGIN INSERT INTO Properties (price) VALUES (NULL); UPDATE Ingredients SET property_ID = ROWID WHERE ID=OLD.ID; END; -- price doesn't matter. I set it up much later.. (whenever the user want, in fact), but I want my property line created and correctly linked!
RE: [sqlite] UNICODE Support
But what about the SQLite Function's parameters whose data type is LPSTR ? Let me know the details to support wide char ? Regards, Ajay Sonawane -Original Message- From: Martin Engelschalk [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 08, 2005 6:48 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] UNICODE Support Hi, See http://www.sqlite.org/pragma.html, search for 'PRAGMA encoding' /Martin Ajay schrieb: Hello there, Does SQLite support UNICODE? Can I store some Arabic or Chinese text in database? If it does not support UNICODE, Is there any workaround for that? Regards, Ajay Sonawane
Re: [sqlite] SQL question
Martin Engelschalk [EMAIL PROTECTED] writes: Hi Lloyd, i am not sure, but i checked the documentation and i don't think it ist sound. In your Update, the ROWID semms to refer to ingredients.rowid. However, you want to set properties.rowid. Can it be that it works, because Properties and Ingredients happen to have the same number of rows? Martin Lloyd Dupont schrieb: thanks Martin it worked! although I replaced your (SELECT MAX(ID) FROM Properties) by ROWID. is it sound? like that: CREATE TRIGGER create_ingredient_property AFTER INSERT ON Ingredients BEGIN INSERT INTO Properties (price) VALUES (NULL); UPDATE Ingredients SET property_ID = ROWID WHERE ID=OLD.ID; END; According to the documentation, you should be able to use the last_insert_rowid() function: CREATE TRIGGER create_ingredient_property AFTER INSERT ON Ingredients BEGIN INSERT INTO Properties (price) VALUES (NULL); UPDATE Ingredients SET property_ID = last_insert_rowid() WHERE ID=OLD.ID; END; Derrell
Re: [sqlite] SQL question
Thanks for that! last_insert_rowid() function: anyway, I hadn't tested the code. I mean the CREATE TRIGGER succeed. But I didn't check if the trigger itself works well. Now I did and have a problem... It don't work! I get: SQLite Error 1 - no such column: OLD.ID this is my setting: CREATE TABLE Ingredients( ID INTEGER PRIMARY KEY, name TEXT, description BLOB, property_ID INTEGER ); CREATE TABLE Properties( ID INTEGER PRIMARY KEY, price double, calories double ); CREATE TRIGGER create_ingredient_property AFTER INSERT ON Ingredients BEGIN INSERT INTO Properties (price) VALUES (NULL); UPDATE Ingredients SET property_ID = last_insert_rowid() WHERE ID=OLD.ID; END; -- it looks like OLD is now the newly inserted line in Properties and not the on in Ingredients ?!?! is it a bug or a feature? how to work around it?
Re: [sqlite] SQL question
Sorry, stupit mistak, I have to use NEW and not OLD in case of an INSERT trigger! Thanks all it works like a breeze! - Original Message - From: Lloyd Dupont [EMAIL PROTECTED] To: sqlite-users@sqlite.org Sent: Thursday, June 09, 2005 12:26 AM Subject: Re: [sqlite] SQL question Thanks for that! last_insert_rowid() function: anyway, I hadn't tested the code. I mean the CREATE TRIGGER succeed. But I didn't check if the trigger itself works well. Now I did and have a problem... It don't work! I get: SQLite Error 1 - no such column: OLD.ID this is my setting: CREATE TABLE Ingredients( ID INTEGER PRIMARY KEY, name TEXT, description BLOB, property_ID INTEGER ); CREATE TABLE Properties( ID INTEGER PRIMARY KEY, price double, calories double ); CREATE TRIGGER create_ingredient_property AFTER INSERT ON Ingredients BEGIN INSERT INTO Properties (price) VALUES (NULL); UPDATE Ingredients SET property_ID = last_insert_rowid() WHERE ID=OLD.ID; END; -- it looks like OLD is now the newly inserted line in Properties and not the on in Ingredients ?!?! is it a bug or a feature? how to work around it?
Re: [sqlite] Problem with installing
Instead of the pragma add the library (.lib) directly to the solution. On 6/8/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm working normally with lib files, which I include with #pragma comment(lib, file.lib); into my C++ program.
Re: [sqlite] Problem with installing
Hey Danny, I think with the advice you've gotten you should be able to run with it. However it you get stuck take a look at: http://www.guitipsandtricks.com/Under the 30 most recent you will see one entitled Embedded Database for Easy Storage. If you don't mind signing up, it walks you through using SQLite on VS .Net. FYI, the site is run by one of my classes in college so you don't need to worry about spam or other junk to the email. Its mainly tips that people in the class have made, but there are a few posted by people in industry. On 6/8/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, I'd like to use the SQLite Library now for the first time, for my programs which should run under Linux and Windows. But I've got problems with the lib (I'm not very familar with .dll files). I downloaded the Precompared Binary for Windows. In my progam I included the sqlite3.h and I copied the sqlite3.dll into my project directory. But when I compile it, I got error message about unresolved links, e.g. sqlite3_open() I'm working normally with lib files, which I include with #pragma comment(lib, file.lib); into my C++ program. Can anyone help me? Thanks in advance :) -- Kiel W. [EMAIL PROTECTED] -- time is swift
RE: [sqlite] UNICODE Support
You can convert your text using A2W() and W2A() functions (or others) before passing it to SQLite and after retrieving it back from SQLite. That's what we do (it's a Japanese application). Dennis -Original Message- From: Ajay [mailto:[EMAIL PROTECTED] Sent: Thursday, June 09, 2005 12:12 AM To: sqlite-users@sqlite.org Subject: RE: [sqlite] UNICODE Support But what about the SQLite Function's parameters whose data type is LPSTR ? Let me know the details to support wide char ? Regards, Ajay Sonawane -Original Message- From: Martin Engelschalk [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 08, 2005 6:48 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] UNICODE Support Hi, See http://www.sqlite.org/pragma.html, search for 'PRAGMA encoding' /Martin Ajay schrieb: Hello there, Does SQLite support UNICODE? Can I store some Arabic or Chinese text in database? If it does not support UNICODE, Is there any workaround for that? Regards, Ajay Sonawane