[sqlite] Clarification about Triggers

2011-08-30 Thread stefanos sofroniou
Hello everyone. I have successfully created a trigger for experimentation and I would like your help for implementing the concept behind of it. My table pollaplasiasmos (which stands for multiplication in Greek, even though I used English characters to write it [Gree-glish]), takes 3 values:

Re: [sqlite] Clarification about Triggers

2011-08-30 Thread Black, Michael (IS)
There may be a more elegant way but this works: create table temp_01(rownum integer primary key,val float); create table temp_02(rownum integer primary key,val float); create table total(rownum integer primary key,val float); create trigger after insert on temp_01 begin insert into total

[sqlite] writing data in wrong table

2011-08-30 Thread Thorsten Kersting
i wouldn believe it if i hadnt seen it my statements are the following (it is fortran code, and the function executeStatement is c++ where i call sqlite3_exec) statement = "create table parameters(name varchar(128), zkern integer, eanz integer, nmax integer, k integer, m integer, bfeld

Re: [sqlite] writing data in wrong table

2011-08-30 Thread Simon Slavin
On 30 Aug 2011, at 1:31pm, Thorsten Kersting wrote: > is it possible that this mistake is coming from the nfs? Try your program operating on a local file instead of one on a volume mounted using NFS. Simon. ___ sqlite-users mailing list

Re: [sqlite] writing data in wrong table

2011-08-30 Thread Thorsten Kersting
this is not possible. i have to run the programm on the bw-grid cluster, else it is not fast enough. if i try the program on my work-pc it works fine. only the mass parallel-starting brings the mistake. On 08/30/2011 02:34 PM, Simon Slavin wrote: On 30 Aug 2011, at 1:31pm, Thorsten Kersting

Re: [sqlite] writing data in wrong table

2011-08-30 Thread Black, Michael (IS)
NFS is not a good idea as you have discovered. http://www.sqlite.org/faq.html#q5 Here's what I'd do for starters. Have your grid processes write their SQL statements (or data) to a flat file...one file for each grid member. Then have a process that reads all those files using pipes like this,

[sqlite] Comments in files intended for .read

2011-08-30 Thread Simon Slavin
I'm writing an app which generates text files intended for reading by the shell tool's '.read' command. We're using SQL text files because I'm writing a design which needs to be completely open, understandable, and easily hackable by third parties. I want to include comments in my SQL files.

Re: [sqlite] Comments in files intended for .read

2011-08-30 Thread Richard Hipp
On Tue, Aug 30, 2011 at 9:25 AM, Simon Slavin wrote: > I'm writing an app which generates text files intended for reading by the > shell tool's '.read' command. We're using SQL text files because I'm > writing a design which needs to be completely open, understandable, and

Re: [sqlite] Comments in files intended for .read

2011-08-30 Thread Simon Slavin
On 30 Aug 2011, at 2:47pm, Richard Hipp wrote: > On Tue, Aug 30, 2011 at 9:25 AM, Simon Slavin wrote: > >> Any problems with multi-line >> quoted text strings containing comments ? Anything else anyone wants to >> warn me about ? I don't actually need to use the '/*'

[sqlite] Bug in using overloaded functions for virtual tables?

2011-08-30 Thread Richard Hipp
On Tue, Aug 30, 2011 at 10:01 AM, wrote: > The attached message matched the sqlite-users mailing list's content > filtering rules and was prevented from being forwarded on to the list > membership. > -- Forwarded message -- > From: fbu...@web.de >

[sqlite] error:library routine out of sequence

2011-08-30 Thread NOCaut
when i Offen use this code i see error "library routine out of sequence".I understand that swears on a second appeal to the already open as BD.No then make additional requests to fetch? wchar_t * IconDB::SQLGetConfigValue(char *Key) { CString s; wchar_t * result; char tmp[255];

[sqlite] Max page count not being remembered across close/open in SQLite 3.7.6.3

2011-08-30 Thread Nick
Hi When performing some testing I noticed that SQLite was not enforcing the max_page_count pragma. Using the test case below is appears SQLite is not remembering the max_page_count across closing and opening a database file. Instead of the expected 12800 from PRAGMA max_page_count; I got

Re: [sqlite] Clarification about Triggers

2011-08-30 Thread Black, Michael (IS)
I found that if you used the default rowid it always gave -1 for the value. That's why I put in it's own key. I don't understand why this doesn't work...perhaps somebody can point out the error here...new.rowid contains -1. I would think that rowid ought to be available after the insert. This

Re: [sqlite] Max page count not being remembered across close/open in SQLite 3.7.6.3

2011-08-30 Thread Simon Slavin
On 30 Aug 2011, at 4:46pm, Nick wrote: > Using the test case below is appears SQLite is not remembering the > max_page_count across closing and opening a database file. Most PRAGMAs, including others which modify engine behaviour like recursive_triggers, are not stored in the database but

Re: [sqlite] Max page count not being remembered across close/open in SQLite 3.7.6.3

2011-08-30 Thread Nick
On 30 Aug 2011, at 16:53, Simon Slavin wrote: > > Most PRAGMAs, including others which modify engine behaviour like > recursive_triggers, are not stored in the database but have to be restated > every time you open the database file. > Ok, thanks, If that is the case for this PRAGMA I did

Re: [sqlite] Max page count not being remembered across close/open in SQLite 3.7.6.3

2011-08-30 Thread Simon Slavin
On 30 Aug 2011, at 5:03pm, Nick wrote: > On 30 Aug 2011, at 16:53, Simon Slavin wrote: > >> Most PRAGMAs, including others which modify engine behaviour like >> recursive_triggers, are not stored in the database but have to be restated >> every time you open the database file. > > Ok,

Re: [sqlite] Max page count not being remembered across close/open in SQLite 3.7.6.3

2011-08-30 Thread Jean-Christophe Deschamps
> Most PRAGMAs, including others which modify engine behaviour like recursive_triggers, are not stored in the database but have to be restated every time you open the database file. > Ok, thanks, If that is the case for this PRAGMA I did not realise. Similar to the page_count PRAGMA I would

Re: [sqlite] Max page count not being remembered across close/open in SQLite 3.7.6.3

2011-08-30 Thread Jean-Christophe Deschamps
BTW this pragma should be applicable to a list of tables or * for all tables. I realize I didn't state I was talking about recursive_triggers pragma. Sorry for not having made this clear in the previous post. -- j...@antichoc.net

Re: [sqlite] Max page count not being remembered across close/open in SQLite 3.7.6.3

2011-08-30 Thread Stephan Beal
On Tue, Aug 30, 2011 at 6:15 PM, Jean-Christophe Deschamps wrote: > I also hope this can get changed someday, as this particular pragma can > have a devastating effect when the schema expects it to be set and you're > using a third-party manager (not your well coded

Re: [sqlite] Max page count not being remembered across close/open in SQLite 3.7.6.3

2011-08-30 Thread Jean-Christophe Deschamps
That is exactly the problem: such limits are app-specific logic, and that 3rd-party db manager cannot know about app-specific logic. No, that is a metadata which belongs to the DB. Forcing this pragma to always apply would in fact hinder some cases, e.g. creating a backup copy of a table

Re: [sqlite] error:library routine out of sequence

2011-08-30 Thread NOCaut
This line most finalizate q.finalize(); << or not? IO use in the COM object when i open folder I do it somethink with Database STDMETHODIMP CMyOverlayIcon2::IsMemberOf(LPCWSTR pwszPath, DWORD dwAttrib) { // use only select query (!wcscmp(db.SQLGetConfigValue("Active") ... } -- View

Re: [sqlite] Bug in using overloaded functions for virtual tables?

2011-08-30 Thread fbuser
Von: "Richard Hipp" Gesendet: 30.08.2011 16:30:28 An: sqlite-users@sqlite.org Betreff: [sqlite] Bug in using overloaded functions for virtual tables? >On Tue, Aug 30, 2011 at 10:01 AM, wrote: > >> The attached message matched the sqlite-users

Re: [sqlite] error:library routine out of sequence

2011-08-30 Thread Stephan Beal
On Tue, Aug 30, 2011 at 6:41 PM, NOCaut wrote: > > This line most finalizate > q.finalize(); << > > or not? > it doesn't if the query throws unless the query class also calls finalize() in its dtor. -- - stephan beal http://wanderinghorse.net/home/stephan/

Re: [sqlite] Clarification about Triggers

2011-08-30 Thread Igor Tandetnik
stefanos sofroniou wrote: > Now what I want to do is to take two tables, (let's call them temp_01 and > temp_02) that would both have columns id and val, and I > want with a trigger to add temp_01.val with temp_02.val and put their result > in a new table named

Re: [sqlite] error:library routine out of sequence

2011-08-30 Thread George Brink
Yes, q.finalize() should close the previous query. But that is not the point here. All query objects are build upon the same resource (database connection). This resource cannot be shared between two queries. They have to be created and killed sequentially. CppSQLite3Query q1=

Re: [sqlite] INTEGER PRIMARY KEY and SQLITE_ENABLE_STAT2

2011-08-30 Thread GB
GB schrieb am 25.08.2011 18:27: Simon Slavin schrieb am 25.08.2011 02:00: Had you thought of creating an explicit index on the rowid column, then running ANALYZE again ? Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] error:library routine out of sequence

2011-08-30 Thread NOCaut
Ok I understand. And what i most do it? -- View this message in context: http://old.nabble.com/error%3Alibrary-routine-out-of-sequence-tp32365078p32367279.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list

Re: [sqlite] Clarification about Triggers

2011-08-30 Thread stefanos sofroniou
old.rowid was an error of mine during typing; my apologies. Even though I have kind of managed to comprehend the logic behind of it, and made it partially work, I have decided to stick with a view which does what I want it to do. The only problem I have now is how can to update an individual

[sqlite] Create custom function Sqlite Java to use in clause where

2011-08-30 Thread Erico Leite
Can I create a custom function to use in clause where? Ex. select * from tbl where tbl.x myfunction '031'; this function will go return all register with start '0' or '03' or '031'. Thanks, sorry my bad english. -- Érico Luis Barrientos Leite Graduado em Ciência da Computação Universidade

Re: [sqlite] writing data in wrong table

2011-08-30 Thread Igor Tandetnik
Thorsten Kersting wrote: > statement = "insert into parameters values('"//trim(adjustl(name))//"', > "//trim(adjustl(czkern))//", "//trim(adjustl(cnofel))//", > "//trim(adjustl(cmb))//", "//trim(adjustl(ck))//", > "//trim(adjustl(cnmax))//",

Re: [sqlite] Create custom function Sqlite Java to use in clause where

2011-08-30 Thread Igor Tandetnik
Erico Leite wrote: > Can I create a custom function to use in clause where? > > Ex. > select * from tbl where tbl.x myfunction '031'; No. You'll have to settle for myfunction(tbl.x, '031') > this function will go return all register with start '0' or '03' or '031'.

[sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Pete Helgren
I have a need to create a database if it doesn't already exist. The obvious solution is to just use: sqlite3 newdatabase.db Except that it not only creates the db but also opens that db for commands. I am running this from a script so I want to just want to run the command from a script so

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Simon Slavin
On 31 Aug 2011, at 2:36am, Pete Helgren wrote: > I have a need to create a database if it doesn't already exist. The obvious > solution is to just use: > > sqlite3 newdatabase.db > > Except that it not only creates the db but also opens that db for commands. Make yourself an empty database

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Pete Helgren
Thanks. I'll add a little more info This script is used to set up the initial DB in a programmable device that will then record data to the database and the database should never be replaced. So I just figured there would be a simple way to issue the sqlite commands in script. Even

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Igor Tandetnik
Pete Helgren wrote: > I have a need to create a database if it doesn't already exist. The > obvious solution is to just use: > > sqlite3 newdatabase.db > > Except that it not only creates the db but also opens that db for > commands. I am running this from a script so I want

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Simon Slavin
On 31 Aug 2011, at 2:53am, Pete Helgren wrote: > Thanks. I'll add a little more info > > This script is used to set up the initial DB in a programmable device that > will then record data to the database and the database should never be > replaced. So I just figured there would be a

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Simon Slavin
Forgot to mention: copying an existing database file also lets you set up the file the way you want without having to issue separate commands. For instance, you could create blank tables. Or set a specific page size. Or include some sort of DRM or security check in the 'blank' file. Simon.

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Jay A. Kreibich
On Tue, Aug 30, 2011 at 09:54:21PM -0400, Igor Tandetnik scratched on the wall: > Pete Helgren wrote: > > I have a need to create a database if it doesn't already exist. The > > obvious solution is to just use: > > > > sqlite3 newdatabase.db > > > > Except that it not only

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Pete Helgren
The only issue I had was finding an example of how I could do all of what you describe below in bash script. For example, if I put this in a script: sqlite3 newdatabase.db and save that as createdb.sh and execute it then the script never completes because SQLite is at the sqlite> prompt,

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Pete Helgren
I may end up going this direction, at the moment I am not having much luck with the conditional copy in Busybox. Your suggestion: cp -n newdatabase.db /data/newdatabase.db Isn't supported in the version of Busybox that I am running. Also the script example I tried: if [ -f

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Jay A. Kreibich
On Tue, Aug 30, 2011 at 08:29:06PM -0600, Pete Helgren scratched on the wall: > The only issue I had was finding an example of how I could do all of > what you describe below in bash script. For example, if I put this > in a script: > > sqlite3 newdatabase.db > > and save that as createdb.sh

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Simon Slavin
On 31 Aug 2011, at 3:53am, Pete Helgren wrote: > I may end up going this direction, at the moment I am not having much luck > with the conditional copy in Busybox. Your suggestion: > > cp -n newdatabase.db /data/newdatabase.db > > Isn't supported in the version of Busybox that I am running.

[sqlite] How to configure any parameter to set max number of records to be added in SQLite DB

2011-08-30 Thread Tarun
Hi All, Is there any configurable parameter which allows us to set maximum number of records that is allowed to be inserted. Once this limit is reached, insert SQL query should fail inserting records telling max records have been inserted in DB table. Please let me know. Waiting for response.

Re: [sqlite] How to configure any parameter to set max number of records to be added in SQLite DB

2011-08-30 Thread Igor Tandetnik
Tarun wrote: > Is there any configurable parameter which allows us to set maximum > number of records that is allowed to be inserted. Once this limit is > reached, insert SQL query should fail inserting records telling max > records have been inserted in DB table. No

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Ivan Shmakov
> Pete Helgren writes: > I may end up going this direction, at the moment I am not having much > luck with the conditional copy in Busybox. Your suggestion: > cp -n newdatabase.db /data/newdatabase.db > Isn't supported in the version of Busybox that I am running. Also > the script

Re: [sqlite] How to configure any parameter to set max number of records to be added in SQLite DB

2011-08-30 Thread Simon Slavin
On 31 Aug 2011, at 4:55am, Tarun wrote: > Is there any configurable parameter which allows us to set maximum > number of records that is allowed to be inserted. Once this limit is > reached, insert SQL query should fail inserting records telling max > records have been inserted in DB table.