Re: [sqlite] SQL statement to get min/max values

2008-08-14 Thread Greg Morphis
I've got 3.6.0 and it works fine here On Thu, Aug 14, 2008 at 9:09 PM, Dennis Volodomanov <[EMAIL PROTECTED]> wrote: >> I'm using 3.3.5, I'll get the latest and see if works there or not in > a >> few minutes. > > Ok, it works in 3.6.1 - sorry for the troubles... I'll just upgrade the > program

Re: [sqlite] SQL statement to get min/max values

2008-08-14 Thread Dennis Volodomanov
> Could it be that since you're not defining a type for Data it assumes > string? > Try creating the table with > id integer, externalid integer, data number (or numeric) That Data column could contain anything (int, double, string), it'll be up to the application's logic to only get Data for

Re: [sqlite] SQL statement to get min/max values

2008-08-14 Thread Greg Morphis
Could it be that since you're not defining a type for Data it assumes string? Try creating the table with id integer, externalid integer, data number (or numeric) On Thu, Aug 14, 2008 at 7:00 PM, Dennis Volodomanov <[EMAIL PROTECTED]> wrote: > Hello all, > > I've tried a few SQL statements, but

Re: [sqlite] SQL statement to get min/max values

2008-08-14 Thread Dennis Volodomanov
> What version of SQLite are you using? I'm using the 3.5.7 version that > came > with OS X 10.5, and I get -2 as expected. I'm using 3.3.5, I'll get the latest and see if works there or not in a few minutes. > Also, what's with the superfluous subquery? Why not just say > > SELECT max(Data)

Re: [sqlite] SQL statement to get min/max values

2008-08-14 Thread Stephen Oberholtzer
On Thu, Aug 14, 2008 at 9:45 PM, Dennis Volodomanov < [EMAIL PROTECTED]> wrote: > > Seems to work ok for me. What values were you expecting? > > Yes, that works. Bad example on my part, sorry. > > What doesn't work is this: > > 1|2|-7 > 2|2|-5 > 3|2|-20 > 4|2|-5 > 5|2|-2 > > SELECT max(Data) FROM

Re: [sqlite] SQL statement to get min/max values

2008-08-14 Thread Dennis Volodomanov
> Seems to work ok for me. What values were you expecting? Yes, that works. Bad example on my part, sorry. What doesn't work is this: 1|2|-7 2|2|-5 3|2|-20 4|2|-5 5|2|-2 SELECT max(Data) FROM (SELECT Data FROM test_table WHERE ExternalID=2); This returns a -5, while I'm expecting a -2. Thank

Re: [sqlite] SQL statement to get min/max values

2008-08-14 Thread Nuno Lucas
On Fri, Aug 15, 2008 at 1:00 AM, Dennis Volodomanov <[EMAIL PROTECTED]> wrote: > Suppose I have a table like this: > > CREATE TABLE test_table (ID INTEGER PRIMARY KEY, ExternalID, Data); > > And some contents: > > 1| 2| -7 > 2| 2| 5 > 3| 1| 0 > 4| 2| -20 > 5| 2| -5 > 6| 2| 1 > 7| 1| 10 > > Now,

[sqlite] SQL statement to get min/max values

2008-08-14 Thread Dennis Volodomanov
Hello all, I've tried a few SQL statements, but can't seem to get it to work properly, so I'd like to ask your help. Suppose I have a table like this: CREATE TABLE test_table (ID INTEGER PRIMARY KEY, ExternalID, Data); And some contents: 1| 2| -7 2| 2| 5 3| 1| 0 4| 2| -20 5| 2| -5 6| 2| 1 7|

Re: [sqlite] Currency Issues

2008-08-14 Thread Brad Stiles
> jonwood wrote: > I've done very little programming related to currency (dollars, > etc.) and I'm wondering if I need to worry about rounding errors. > Since SQLite doesn't appear to have a currency type, I had planned > on using REAL instead. But I have a lot of reports to print out and > I

Re: [sqlite] Loading a existing database 100% into memory

2008-08-14 Thread Brown, Daniel
Sorry I should have said, I'm using these calls in C++ on windows. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, August 14, 2008 1:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Loading a existing

Re: [sqlite] Currency Issues

2008-08-14 Thread Dennis Cote
jonwood wrote: > I've done very little programming related to currency (dollars, etc.) and I'm > wondering if I need to worry about rounding errors. Since SQLite doesn't > appear to have a currency type, I had planned on using REAL instead. But I > have a lot of reports to print out and I could

Re: [sqlite] Loading a existing database 100% into memory

2008-08-14 Thread cmartin
On Thu, 14 Aug 2008, D. Richard Hipp wrote: > On Aug 14, 2008, at 4:18 PM, Brown, Daniel wrote: > >> Hello Stefan, >> >> I'm trying to use the code snippet you suggested but when I try to >> query >> the master table of the attached database I get and error with the >> following message: >>

Re: [sqlite] Loading a existing database 100% into memory

2008-08-14 Thread D. Richard Hipp
On Aug 14, 2008, at 4:18 PM, Brown, Daniel wrote: > Hello Stefan, > > I'm trying to use the code snippet you suggested but when I try to > query > the master table of the attached database I get and error with the > following message: > "SQL error: no such table: 'test.sqlite_master'; >

[sqlite] Generic speed testing

2008-08-14 Thread Noah Hart
After looking at the code for speed test #1-4, I've decided that a command line version that does not use TCL would be better. Wanting to keep things simple, I'm looking only at inserts, selections and deletes. I'm not sure if this will even be a valid comparison, so your feedback and initial

Re: [sqlite] Loading a existing database 100% into memory

2008-08-14 Thread Brown, Daniel
Hello Stefan, I'm trying to use the code snippet you suggested but when I try to query the master table of the attached database I get and error with the following message: "SQL error: no such table: 'test.sqlite_master'; I am running the following queries: 1. "ATTACH DATABASE

[sqlite] Currency Issues

2008-08-14 Thread jonwood
I've done very little programming related to currency (dollars, etc.) and I'm wondering if I need to worry about rounding errors. Since SQLite doesn't appear to have a currency type, I had planned on using REAL instead. But I have a lot of reports to print out and I could see rounding errors with

Re: [sqlite] prevent column from being written to disk

2008-08-14 Thread Dennis Cote
Jeff Picciotti wrote: > I know it would be simple to separate the column out and create a > :memory db, but that would require numerous changes to our system > (easily doable, just not at the moment) So I was just checking the > community to see if anyone has any ideas or thoughts on this! >

[sqlite] prevent column from being written to disk

2008-08-14 Thread Jeff Picciotti
Hello, new to the list and to SQLite. A little background... writing C library for an embedded system (ARM) which started in mysql but now we want something much lighter. Anyway, things are going pretty well. We had an existing library and application we ported to use SQLite which was

Re: [sqlite] is there a pragma to disable triggers?

2008-08-14 Thread Darren Duncan
Kodok Márton wrote: > Hello, > I am working on a syncing project and I do have a lot of triggers to > read/write foreign keys. > And while I do the sync of one table the triggers are causing a strange > effect (as the other table is not yet synced). > Is there a pragma to disable

Re: [sqlite] is there a pragma to disable triggers?

2008-08-14 Thread Dennis Cote
Kodok Márton wrote: > now this raises questions: > > eg: > CREATE TABLE clients ... > CREATE VIEW getclients AS select * from clients. > > now if I update the 'getlist' view that will with a instead of trigger > update the clients table > > that will raise the triggers for the client

Re: [sqlite] is there a pragma to disable triggers?

2008-08-14 Thread Kodok Márton
now this raises questions: eg: CREATE TABLE clients ... CREATE VIEW getclients AS select * from clients. now if I update the 'getlist' view that will with a instead of trigger update the clients table that will raise the triggers for the client table, I am right? - Original

Re: [sqlite] is there a pragma to disable triggers?

2008-08-14 Thread Kees Nuyt
On Mon, 11 Aug 2008 13:16:45 +0300, you wrote: >Hello, > >I am working on a syncing project and I do have a lot of triggers to >read/write foreign keys. >And while I do the sync of one table the triggers are causing a strange effect >(as the other table is not yet synced). >Is there a pragma to

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Peter Holmes
flakpit wrote: > Peter, sorry to be a nuisance but, can you update the same way? I've not > idea how that statement would look with this way of doing things Yep: sqlite3_prepare_v2(db,"UPDATE ans SET col1=?, col2=?;",-1,,NULL); sqlite3_bind_text(stmt,1,"Peter's",-1,SQLITE_STATIC);

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Peter Holmes
flakpit wrote: > > Peter Holmes-4 wrote: >> Yep. Works great! For example: >> >> sqlite3_prepare_v2(db,"INSERT INTO ans VALUES (?,?);",-1,stmt,NULL); >> sqlite3_bind_text(stmt,0,"Peter's",-1,SQLITE_STATIC); >> sqlite3_bind_text(stmt,1,"Reply",-1,SQLITE_STATIC); >> sqlite3_step(stmt); >>

Re: [sqlite] Linking databases

2008-08-14 Thread Bruce Martin
Yes, databases. The databases are generated by another process but I need to search all of them for matches. Bruce Martin The Martin Solution [EMAIL PROTECTED] http://www.martinsolution.com http://externals.martinsolution.com On Aug 14, 2008, at 11:51 AM, P Kishor wrote: > On 8/14/08, Bruce

Re: [sqlite] Linking databases

2008-08-14 Thread P Kishor
On 8/14/08, Bruce Martin <[EMAIL PROTECTED]> wrote: > Is there a way to link and do a select on multiple databases? > For example I have 3 databases maybe containing a list of file names. > > DB1 > Apple.txt > Grape.html > Cherry.txt > Peach.txt > > DB2 > Dell.txt > HP.txt > Gateway.txt

Re: [sqlite] is there a pragma to disable triggers?

2008-08-14 Thread Griggs, Donald
Regarding: I can't use command line utility as I do this on a smartphone device. and I am using sqlite by c# the Ado .Net library which is very new to me and I can for now only execute insert,delete,update and basic commandtext queries. -- Well, you might have to resort to a more complex

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread flakpit
Dennis Cote wrote: > > See, http://www.sqlite.org/c3ref/prepare.html for details on prepare and > previous link for detail on bind_text. > Dennis Cote > Thank you for the links Dennis, this will help me a lot. -- View this message in context:

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Dennis Cote
flakpit wrote: > > Peter, sorry to be a nuisance but, can you update the same way? Yes, of course. > I've not > idea how that statement would look with this way of doing things > SQLite has copious and well written documentation. You would be well served by reading it rather than trying to

Re: [sqlite] is there a pragma to disable triggers?

2008-08-14 Thread Griggs, Donald
Regarding: Is there a pragma to disable triggers on the sqlite database? Hello Marton, There's no such pragma to my knowledge. See http://www.sqlite.org/pragma.html Perhaps you can use the command line utility "sqlite3" to ".dump" the schema of your database, isolate just the CREATE TRIGGER

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread flakpit
Enrique Ramirez-3 wrote: > > Depends on where you're looking at your block of text. Are you using a > GUI SQLite Manager of sorts, or maybe peeking at the variable's > contents from a dev IDE? > I checked the contents of the db to ensure that all my text was in it and it was. Then I peek the

Re: [sqlite] is there a pragma to disable triggers?

2008-08-14 Thread P Kishor
On 8/14/08, Dennis Cote <[EMAIL PROTECTED]> wrote: > Kodok Márton wrote: > > > > I am working on a syncing project and I do have a lot of triggers to > read/write foreign keys. > > And while I do the sync of one table the triggers are causing a strange > effect (as the other table is not

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread flakpit
Peter Holmes-4 wrote: > > Yep. Works great! For example: > > sqlite3_prepare_v2(db,"INSERT INTO ans VALUES (?,?);",-1,stmt,NULL); > sqlite3_bind_text(stmt,0,"Peter's",-1,SQLITE_STATIC); > sqlite3_bind_text(stmt,1,"Reply",-1,SQLITE_STATIC); > sqlite3_step(stmt); > sqlite3_reset(stmt); > so

Re: [sqlite] is there a pragma to disable triggers?

2008-08-14 Thread Dennis Cote
Kodok Márton wrote: > > I am working on a syncing project and I do have a lot of triggers to > read/write foreign keys. > And while I do the sync of one table the triggers are causing a strange > effect (as the other table is not yet synced). > Is there a pragma to disable triggers on the

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread flakpit
SQLite doesn't truncate anything. Either you truncated at the time you > put the data into the database in the first place, or you are truncating > now when looking at the string. It definately wasn't truncated when I put it in, I checked. So as you say, something is truncating it as it is

Re: [sqlite] is there a pragma to disable triggers?

2008-08-14 Thread Kodok Márton
Hello, I am working on a syncing project and I do have a lot of triggers to read/write foreign keys. And while I do the sync of one table the triggers are causing a strange effect (as the other table is not yet synced). Is there a pragma to disable triggers on the sqlite database?

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Enrique Ramirez
"flakpit" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> I've been using the column_text type to get back a block of text and it's >> being truncated at the first CR/LF pair in the text block and I can't help >> thinking that I could have avoided this somehow by entering it with a

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Peter Holmes
DOH! sqlite3_prepare_v2(db,"INSERT INTO ans VALUES (?,?);",-1,,NULL); sqlite3_bind_text(stmt,1,"Peter's",-1,SQLITE_STATIC); sqlite3_bind_text(stmt,2,"Reply",-1,SQLITE_STATIC); sqlite3_step(stmt); sqlite3_reset(stmt); I'll shut up now... ___

Re: [sqlite] Linking databases

2008-08-14 Thread Bruce Martin
Thanks that's exactly what I was looking for. Bruce Martin The Martin Solution [EMAIL PROTECTED] http://www.martinsolution.com http://externals.martinsolution.com On Aug 14, 2008, at 9:04 AM, Alexandre Courbot wrote: >> Is there a way to link and do a select on multiple databases? > > You

Re: [sqlite] Linking databases

2008-08-14 Thread Alexandre Courbot
> Is there a way to link and do a select on multiple databases? You probably want to use the "attach" command: http://www.sqlite.org/lang_attach.html Then you can join all your tables as if they were declared in the same database, without any performance penalty. Alex.

[sqlite] Linking databases

2008-08-14 Thread Bruce Martin
Is there a way to link and do a select on multiple databases? For example I have 3 databases maybe containing a list of file names. DB1 Apple.txt Grape.html Cherry.txt Peach.txt DB2 Dell.txt HP.txt Gateway.txt Apple.txt DB3 Apple Pie.txt Cherry Pie.txt Grape Jelly.txt Now I want to select

[sqlite] Table functions emulation

2008-08-14 Thread Alexey Pechnikov
Hello! I did write some wrapper for create table testrange(rowid); select intrange2table (1,10,1,'testrange'); select * from testrange; 1 2 3 4 5 6 7 8 9 10 select intrange2table (100,1000,100,'testrange'); select * from testrange; 1 2 3 4 5 6 7 8 9 10 100

Re: [sqlite] System function with Sqlite

2008-08-14 Thread Chris Wedgwood
On Thu, Aug 14, 2008 at 04:37:48PM +1200, Chris Brown wrote: > After SQLite: [... odd output ...] > pipe:[120]fd1 ?g?T 1?? 2 04:54:50 CST 2008 > 6 > pipe:[120]fd1 ?g?T 1?? 2 04:54:50 CST 2008 [BTW; Your email is encoded in a very odd way and looks quite strange to me (others might have

Re: [sqlite] System function with Sqlite

2008-08-14 Thread Chris Wedgwood
On Thu, Aug 14, 2008 at 10:59:57AM +1200, Chris Brown wrote: > Then this after sqlite3_close but before the second call to system: > > . > .. > 0 > 1 > 2 > 3 > 5 > 6 that seems wrong, for those which are symlinks (ie. 0->6) can you also readlink and print that out too please? it seems like some

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Peter Holmes
Make that: sqlite3_prepare_v2(db,"INSERT INTO ans VALUES (?,?);",-1,,NULL); ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Peter Holmes
Yep. Works great! For example: sqlite3_prepare_v2(db,"INSERT INTO ans VALUES (?,?);",-1,stmt,NULL); sqlite3_bind_text(stmt,0,"Peter's",-1,SQLITE_STATIC); sqlite3_bind_text(stmt,1,"Reply",-1,SQLITE_STATIC); sqlite3_step(stmt); sqlite3_reset(stmt); flakpit wrote: > I've been escaping single

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Igor Tandetnik
"flakpit" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've been escaping single quote characters in all my text fields and > using the sqlite_execute function to put the data into the table. But > is it possible to use the prepare/bind commands to enter data so that > I don't

[sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread flakpit
I've been escaping single quote characters in all my text fields and using the sqlite_execute function to put the data into the table. But is it possible to use the prepare/bind commands to enter data so that I don't have to do this? I've been using the column_text type to get back a block of