Re: [sqlite] sqlite with FORTRAN
I added to the wiki (http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers) an entry for Fortran. It links to a page on my web site, http://danial.org/sqlite/fortran/, that has an example of a Fortran program that calls C wrapper functions which in turn call functions in the SQLite library. The demo creates a database, inserts values into a table, then does a query. It builds with g77 and gcc. -- Al On 7/8/05, Cornel Gazdaru <[EMAIL PROTECTED]> wrote: > Hi > I am trying to figure out a wrapper to access sqlite from FORTRAN (g77 > and gcc) > I try using "cfrotran.h" but it seems I have problems passing arguments. > Not sure I get the sqlite3 handle correctly > Has anybody tried that before? > Thanks > Cornel > >
Re: [sqlite] Calculation between rows?
> I suppose I could copy the data table into a temporary > table ... documenataion quarantees AUTOINCREMENT fields > to be "monotonically increasing" ... "Monotonically increasing" does not mean that for every key k there will be a key (k-1). In fact, if you ever delete a row in an autoincrement table, you're guaranteed to have a "hole" in your keys. You don't really need a manufactured key. Since your arithmetic depends on the timestamp being unique, you can use the timestamp as your primary key; but you should define the key to enforce existence and uniqueness: create table bytes (ts int primary key, bytes int); insert into bytes (ts, bytes) values (1121484797, 11234); insert into bytes (ts, bytes) values (1121484923, 14583); insert into bytes (ts, bytes) values (1121485008, 19267); insert into bytes (ts, bytes) values (1121484801, 12789); insert into bytes (ts, bytes) values (1121485051, 23005); insert into bytes (ts, bytes) values (1121485832, 28436); select datetime(ts, 'unixepoch'), bytes from bytes order by ts; || \/ datetime(ts, 'unixepoch') bytes - -- 2005-07-16 03:33:1711234 2005-07-16 03:33:2112789 2005-07-16 03:35:2314583 2005-07-16 03:36:4819267 2005-07-16 03:37:3123005 2005-07-16 03:50:3228436 select datetime(ts, 'unixepoch'), bytes from bytes where datetime(ts, 'unixepoch') between '2005-07-16 03:35:01' and '2005-07-16 03:40:00' order by ts; || \/ datetime(ts, 'unixepoch') bytes - -- 2005-07-16 03:35:2314583 2005-07-16 03:36:4819267 2005-07-16 03:37:3123005 select datetime(t2.ts, 'unixepoch') 'time', (0.0+t2.bytes-t1.bytes)/(t2.ts-t1.ts) 'byte rate' from bytes t1, bytes t2 where t1.ts = (select max(t3.ts) from bytes t3 where t3.ts < t2.ts) and datetime(t2.ts, 'unixepoch') between '2005-07-16 03:35:01' and '2005-07-16 03:40:00' order by t2.ts ; || \/ time byte rate --- 2005-07-16 03:35:23 14.7049180327869 2005-07-16 03:36:48 55.1058823529412 2005-07-16 03:37:31 86.9302325581395 But SQL is not designed to do sequential processing of data. You'll probably get better performance and more readable code if you retrieve your data set with SQL select bytes, ts from bytes where datetime(ts, 'unixepoch') between '2005-07-16 03:35:01' and '2005-07-16 03:40:00' order by ts; and use your host language to do the arithmetic. Regards
Re: [sqlite] Update command Help....
Thanks for everyones help, I'm actually building the query dynamically based on what the user inputs, must be my string handling functionality in Borland that causing probs Thanks again. --- Jay Sprenkle <[EMAIL PROTECTED]> wrote: > > Put mulitple record into your table and see what > > occurs. > > D:\temp\convention>sqlite3 test.db > SQLite version 3.0.8 > Enter ".help" for instructions > sqlite> create table t (a, b); > sqlite> insert into t (a, b) values ('foo', 'bar'); > sqlite> insert into t (a, b) values ('test', '2'); > sqlite> select * from t; > foo|bar > test|2 > sqlite> update t set a = 'foo;qux', b = 'barr' where > a = 'foo'; > sqlite> select * from t; > foo;qux|barr > test|2 > sqlite> > > works fine here. > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [sqlite] Update command Help....
> Put mulitple record into your table and see what > occurs. D:\temp\convention>sqlite3 test.db SQLite version 3.0.8 Enter ".help" for instructions sqlite> create table t (a, b); sqlite> insert into t (a, b) values ('foo', 'bar'); sqlite> insert into t (a, b) values ('test', '2'); sqlite> select * from t; foo|bar test|2 sqlite> update t set a = 'foo;qux', b = 'barr' where a = 'foo'; sqlite> select * from t; foo;qux|barr test|2 sqlite> works fine here.
Re: [sqlite] Update command Help....
Put mulitple record into your table and see what occurs. --- Puneet Kishor <[EMAIL PROTECTED]> wrote: > Nicholas Choate wrote: > > Tried that, same result. Any other ideas? > > here is what I get > > D:\user\punkish>sqlite3 test.db > SQLite version 3.2.1 > Enter ".help" for instructions > sqlite> create table t (a, b); > sqlite> insert into t (a, b) values ('foo', 'bar'); > sqlite> select * from t; > foo|bar > sqlite> update t set a = 'foo;qux', b = 'barr' where > a = 'foo'; > sqlite> select * from t; > foo;qux|barr > sqlite> > > as you can see, it works just fine. Maybe you are > not using the latest > version of SQLite. Maybe you are doing something > else that is funky. > > > > > > Newly revised code: > > Update sys_list set pass = 'abcdf;456' where > > sys_id = 'testboxa' and user_id = 'testuserid'; > > > > --- Puneet Kishor <[EMAIL PROTECTED]> wrote: > > > > > >>On Jul 18, 2005, at 10:57 AM, Nicholas Choate > wrote: > >> > >> > >>>Sorry forgot the SQL on the previous email. > >>> > >>>Update sys_list set pass = "abcdf;456" where > >> > >>sys_id = "testboxa" and > >> > >>>user_id = "testuserid"; > >> > >>afaik, the SQL way is to use single quotes to > >>delimit text. With double > >>quotes it is likely interpolating the ';' inside > as > >>an end of statement > >>marker. > >> > >>try > >> > >>UPDATE sys_list > >>SET pass = 'abcdf;456' > >>WHERE sys_id = 'testboxa' AND > >> user_id = 'testuserid'; > >> > >> > >>>Note, the update command works great, as long as > a > >> > >>semicolon is not in > >> > >>>the text being updated. > >>> > >>>Jay Sprenkle <[EMAIL PROTECTED]> wrote: > >>>You should post your sql > >>> > >>>On 7/18/05, Nicholas Choate wrote: > >>> > I have noticed a quirk with the Update command > >> > >>and was just wondering > >> > if there was a way to fix it. I am attempting to > >> > >>update two fields in > >> > my database and I've noticed that if there is a > >> > >>";" in the text field > >> > for one of the fields I'm updating, it updates > >> > >>every record with the > >> > same information. Is there a way to escape the > >> > >>semicolon? Are there > >> > any other characters that woudl cause this > >> > >>behavior? > >> > >>>__ > >>>Do You Yahoo!? > >>>Tired of spam? Yahoo! Mail has the best spam > >> > >>protection around > >> > >>>http://mail.yahoo.com > >> > >>-- > >>Puneet Kishor > >> > >> > > > > > > > > __ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection around > > http://mail.yahoo.com > > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [sqlite] Update command Help....
Nicholas Choate wrote: Put mulitple record into your table and see what occurs. sure thing. We were at sqlite> select * from t; foo;qux|barr after that I did the following... sqlite> insert into t (a, b) values ('qux', 'baz'); sqlite> select * from t; foo;qux|barr qux|baz sqlite> update t set a = 'foo;bar', b = 'barr' where b = 'barr'; sqlite> select * from t; foo;bar|barr qux|baz sqlite> still works just fine. --- Puneet Kishor <[EMAIL PROTECTED]> wrote: Nicholas Choate wrote: Tried that, same result. Any other ideas? here is what I get D:\user\punkish>sqlite3 test.db SQLite version 3.2.1 Enter ".help" for instructions sqlite> create table t (a, b); sqlite> insert into t (a, b) values ('foo', 'bar'); sqlite> select * from t; foo|bar sqlite> update t set a = 'foo;qux', b = 'barr' where a = 'foo'; sqlite> select * from t; foo;qux|barr sqlite> as you can see, it works just fine. Maybe you are not using the latest version of SQLite. Maybe you are doing something else that is funky. Newly revised code: Update sys_list set pass = 'abcdf;456' where sys_id = 'testboxa' and user_id = 'testuserid'; --- Puneet Kishor <[EMAIL PROTECTED]> wrote: On Jul 18, 2005, at 10:57 AM, Nicholas Choate wrote: Sorry forgot the SQL on the previous email. Update sys_list set pass = "abcdf;456" where sys_id = "testboxa" and user_id = "testuserid"; afaik, the SQL way is to use single quotes to delimit text. With double quotes it is likely interpolating the ';' inside as an end of statement marker. try UPDATE sys_list SET pass = 'abcdf;456' WHERE sys_id = 'testboxa' AND user_id = 'testuserid'; Note, the update command works great, as long as a semicolon is not in the text being updated. Jay Sprenkle <[EMAIL PROTECTED]> wrote: You should post your sql On 7/18/05, Nicholas Choate wrote: I have noticed a quirk with the Update command and was just wondering if there was a way to fix it. I am attempting to update two fields in my database and I've noticed that if there is a ";" in the text field for one of the fields I'm updating, it updates every record with the same information. Is there a way to escape the semicolon? Are there any other characters that woudl cause this behavior? protection around http://mail.yahoo.com -- Puneet Kishor
RE: [sqlite] Newbie Help Please
> -Original Message- > From: Dennis Cote [mailto:[EMAIL PROTECTED] > Sent: Monday, July 18, 2005 11:55 AM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Newbie Help Please > > Wood, Lee wrote: > > >I tried to do the quick-start example and I could not get it > to work. It is not explicit enough for some like me. First > off, the quickstart doesn't specify that you need to include > the source (just the external interface header). But since it > does not come with a *.lib I tried to include the source > files and I get a bunch of unresolved external dependencies > (can't find some function definitions). I even removed the > tcl*.c files and still got the errors. I'm compiling in > Visual C++ 7.1. > > > >Also, I tried to build with the *.dll but the *.dll file > doesn't come with a header for it or static *.lib to link > against. If I use the *.dll do I have to fn* every function I > wish to use? > > > > > > > Lee, > > You need to use the LIB command line utility that comes with > VC++ to generate an sqlite3.lib file which will let you use > the sqlite3.dll library. You need to feed the sqlite3.def > file into the LIB utility and it will generate an sqlite3.lib > which you can link with your project. > The following command is used in the Makefile. > > lib /machine:i386 /def:sqlite3.def > > HTH > Dennis Cote > This might help... I created a Wiki page with a VS.NET 2003 Solution to compile SQLite. http://www.sqlite.org/cvstrac/wiki?p=VsNetSolution
Re: [sqlite] Update command Help....
Nicholas Choate wrote: Tried that, same result. Any other ideas? here is what I get D:\user\punkish>sqlite3 test.db SQLite version 3.2.1 Enter ".help" for instructions sqlite> create table t (a, b); sqlite> insert into t (a, b) values ('foo', 'bar'); sqlite> select * from t; foo|bar sqlite> update t set a = 'foo;qux', b = 'barr' where a = 'foo'; sqlite> select * from t; foo;qux|barr sqlite> as you can see, it works just fine. Maybe you are not using the latest version of SQLite. Maybe you are doing something else that is funky. Newly revised code: Update sys_list set pass = 'abcdf;456' where sys_id = 'testboxa' and user_id = 'testuserid'; --- Puneet Kishor <[EMAIL PROTECTED]> wrote: On Jul 18, 2005, at 10:57 AM, Nicholas Choate wrote: Sorry forgot the SQL on the previous email. Update sys_list set pass = "abcdf;456" where sys_id = "testboxa" and user_id = "testuserid"; afaik, the SQL way is to use single quotes to delimit text. With double quotes it is likely interpolating the ';' inside as an end of statement marker. try UPDATE sys_list SET pass = 'abcdf;456' WHERE sys_id = 'testboxa' AND user_id = 'testuserid'; Note, the update command works great, as long as a semicolon is not in the text being updated. Jay Sprenkle <[EMAIL PROTECTED]> wrote: You should post your sql On 7/18/05, Nicholas Choate wrote: I have noticed a quirk with the Update command and was just wondering if there was a way to fix it. I am attempting to update two fields in my database and I've noticed that if there is a ";" in the text field for one of the fields I'm updating, it updates every record with the same information. Is there a way to escape the semicolon? Are there any other characters that woudl cause this behavior? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- Puneet Kishor __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [sqlite] Update command Help....
Tried that, same result. Any other ideas? Newly revised code: Update sys_list set pass = 'abcdf;456' where sys_id = 'testboxa' and user_id = 'testuserid'; --- Puneet Kishor <[EMAIL PROTECTED]> wrote: > > On Jul 18, 2005, at 10:57 AM, Nicholas Choate wrote: > > > Sorry forgot the SQL on the previous email. > > > > Update sys_list set pass = "abcdf;456" where > sys_id = "testboxa" and > > user_id = "testuserid"; > > afaik, the SQL way is to use single quotes to > delimit text. With double > quotes it is likely interpolating the ';' inside as > an end of statement > marker. > > try > > UPDATE sys_list > SET pass = 'abcdf;456' > WHERE sys_id = 'testboxa' AND >user_id = 'testuserid'; > > > > > Note, the update command works great, as long as a > semicolon is not in > > the text being updated. > > > > Jay Sprenkle <[EMAIL PROTECTED]> wrote: > > You should post your sql > > > > On 7/18/05, Nicholas Choate wrote: > >> I have noticed a quirk with the Update command > and was just wondering > >> if there was a way to fix it. I am attempting to > update two fields in > >> my database and I've noticed that if there is a > ";" in the text field > >> for one of the fields I'm updating, it updates > every record with the > >> same information. Is there a way to escape the > semicolon? Are there > >> any other characters that woudl cause this > behavior? > > > > __ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection around > > http://mail.yahoo.com > -- > Puneet Kishor > > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [sqlite] Newbie Help Please
Wood, Lee wrote: I tried to do the quick-start example and I could not get it to work. It is not explicit enough for some like me. First off, the quickstart doesn't specify that you need to include the source (just the external interface header). But since it does not come with a *.lib I tried to include the source files and I get a bunch of unresolved external dependencies (can't find some function definitions). I even removed the tcl*.c files and still got the errors. I'm compiling in Visual C++ 7.1. Also, I tried to build with the *.dll but the *.dll file doesn't come with a header for it or static *.lib to link against. If I use the *.dll do I have to fn* every function I wish to use? Lee, You need to use the LIB command line utility that comes with VC++ to generate an sqlite3.lib file which will let you use the sqlite3.dll library. You need to feed the sqlite3.def file into the LIB utility and it will generate an sqlite3.lib which you can link with your project. The following command is used in the Makefile. lib /machine:i386 /def:sqlite3.def HTH Dennis Cote
Re: [sqlite] Update command Help....
I'll try that, thanks for the suggestion. Puneet Kishor <[EMAIL PROTECTED]> wrote: On Jul 18, 2005, at 10:57 AM, Nicholas Choate wrote: > Sorry forgot the SQL on the previous email. > > Update sys_list set pass = "abcdf;456" where sys_id = "testboxa" and > user_id = "testuserid"; afaik, the SQL way is to use single quotes to delimit text. With double quotes it is likely interpolating the ';' inside as an end of statement marker. try UPDATE sys_list SET pass = 'abcdf;456' WHERE sys_id = 'testboxa' AND user_id = 'testuserid'; > > Note, the update command works great, as long as a semicolon is not in > the text being updated. > > Jay Sprenkle wrote: > You should post your sql > > On 7/18/05, Nicholas Choate wrote: >> I have noticed a quirk with the Update command and was just wondering >> if there was a way to fix it. I am attempting to update two fields in >> my database and I've noticed that if there is a ";" in the text field >> for one of the fields I'm updating, it updates every record with the >> same information. Is there a way to escape the semicolon? Are there >> any other characters that woudl cause this behavior? > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com -- Puneet Kishor __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [sqlite] Update command Help....
On Jul 18, 2005, at 10:57 AM, Nicholas Choate wrote: Sorry forgot the SQL on the previous email. Update sys_list set pass = "abcdf;456" where sys_id = "testboxa" and user_id = "testuserid"; afaik, the SQL way is to use single quotes to delimit text. With double quotes it is likely interpolating the ';' inside as an end of statement marker. try UPDATE sys_list SET pass = 'abcdf;456' WHERE sys_id = 'testboxa' AND user_id = 'testuserid'; Note, the update command works great, as long as a semicolon is not in the text being updated. Jay Sprenkle <[EMAIL PROTECTED]> wrote: You should post your sql On 7/18/05, Nicholas Choate wrote: I have noticed a quirk with the Update command and was just wondering if there was a way to fix it. I am attempting to update two fields in my database and I've noticed that if there is a ";" in the text field for one of the fields I'm updating, it updates every record with the same information. Is there a way to escape the semicolon? Are there any other characters that woudl cause this behavior? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- Puneet Kishor
Re: [sqlite] Update command Help....
Sorry forgot the SQL on the previous email. Update sys_list set pass = "abcdf;456" where sys_id = "testboxa" and user_id = "testuserid"; Note, the update command works great, as long as a semicolon is not in the text being updated. Jay Sprenkle <[EMAIL PROTECTED]> wrote: You should post your sql On 7/18/05, Nicholas Choate wrote: > I have noticed a quirk with the Update command and was just wondering if > there was a way to fix it. I am attempting to update two fields in my > database and I've noticed that if there is a ";" in the text field for one of > the fields I'm updating, it updates every record with the same information. > Is there a way to escape the semicolon? Are there any other characters that > woudl cause this behavior? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [sqlite] Update command Help....
Jay Sprenkle <[EMAIL PROTECTED]> wrote:You should post your sql On 7/18/05, Nicholas Choate wrote: > I have noticed a quirk with the Update command and was just wondering if > there was a way to fix it. I am attempting to update two fields in my > database and I've noticed that if there is a ";" in the text field for one of > the fields I'm updating, it updates every record with the same information. > Is there a way to escape the semicolon? Are there any other characters that > woudl cause this behavior? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [sqlite] Update command Help....
You should post your sql On 7/18/05, Nicholas Choate <[EMAIL PROTECTED]> wrote: > I have noticed a quirk with the Update command and was just wondering if > there was a way to fix it. I am attempting to update two fields in my > database and I've noticed that if there is a ";" in the text field for one of > the fields I'm updating, it updates every record with the same information. > Is there a way to escape the semicolon? Are there any other characters that > woudl cause this behavior?
[sqlite] Update command Help....
I have noticed a quirk with the Update command and was just wondering if there was a way to fix it. I am attempting to update two fields in my database and I've noticed that if there is a ";" in the text field for one of the fields I'm updating, it updates every record with the same information. Is there a way to escape the semicolon? Are there any other characters that woudl cause this behavior? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [sqlite] Libray routine called out of sequence
I have had this message in the past when I can executed an SQL query before my previous query had Completed. Ben Roushan Ali wrote: Hi all, I got an error message "library routine called out of sequence" during sqlite_step . Can anybody tell me what this error message does mean ? Regards, Roushan
[sqlite] Libray routine called out of sequence
Hi all, I got an error message "library routine called out of sequence" during sqlite_step . Can anybody tell me what this error message does mean ? Regards, Roushan