Re: [sqlite] Proposed change to sqlite3_trace()

2008-01-14 Thread Florian Weimer
Legacy applications should continue to work. You might get a compiler warning about a type mismatch on the 2nd parameter to sqlite3_trace(). But calling a 2-parameter function with 3 parameters is suppose to be harmless in C. It's not allowed by the standard, so it will almost certainly

[sqlite] Re: help with sql query / command SUM

2008-01-14 Thread Igor Tandetnik
Jorge Pereira [EMAIL PROTECTED] wrote: I execute this query below, following result. sqlite SELECT si.CD_CURR_SALE_ITEM,si.QT_SALE_ITEM,p.CD_IDEN_PROD,p.NM_PRODFROM Current_sale_item si, Product p WHERE si.CD_PROD = p.CD_PROD; CD_CURR_SALE_ITEM|QT_SALE_ITEM|CD_IDEN_PROD|NM_PROD

Re: [sqlite] Re: Re: How do I do this

2008-01-14 Thread Vishal Mailinglist
Hi sno | id | amount 1| 1 | 200 2| 1 | 300 3 | 2 | 100 4 | 2 | 100 5 | 1 | 500 how could I subtract the sno 1 id 1 and sno 2 id 1 amount . select (select amount from tableName where sno=1 and id=1) - (select amount from tableName where sno=2 and

Re: [sqlite] Next Version of SQLite

2008-01-14 Thread drh
Joe Wilson [EMAIL PROTECTED] wrote: --- D. Richard Hipp [EMAIL PROTECTED] wrote: Sorry for the confusion. No problem. For what it's worth, I am also curious as to the final form of the VM opcode transformation. The number of opcodes generated by the various SQL statements seems to be

Re: [sqlite] Next Version of SQLite

2008-01-14 Thread drh
Bill KING [EMAIL PROTECTED] wrote: A colleague brought up a very good point. At least for the first few revisions, is the old engine/code still going to be available until the new engine code base settles down? You can always pull the old code frm CVS and run it against the newer code. We

Re: [sqlite] Re: Re: How do I do this

2008-01-14 Thread Mohd Radzi Ibrahim
This is my 2 cents. Maybe there's better way to do this: select id, amount, (select amount from tablename where id=t.id and sno t.sno limit 1) as oldAmount from tablename t br Radzi. On 14-Jan-2008, at 8:14 PM, Vishal Mailinglist wrote: Hi sno | id | amount 1|

[sqlite] Re: Re: Re: How do I do this

2008-01-14 Thread Igor Tandetnik
Mohd Radzi Ibrahim [EMAIL PROTECTED] wrote: This is my 2 cents. Maybe there's better way to do this: select id, amount, (select amount from tablename where id=t.id and sno t.sno limit 1) as oldAmount from tablename t In the subselect, you probably want order by sno desc Igor Tandetnik

[sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Lauri Nurmi
Hello, SQLite seems to be accepting SELECT queries that use aggregate functions without a GROUP BY. This is a little dangerous, because queries that should not work at all are returning sensible-looking results. Example: Let's have a simple table T with the following structure and

Re: [sqlite] wxgrid fed with sqlite

2008-01-14 Thread Clay Dowling
I've fed editable wxGrids with several different data sources. The principle would be the same with SQLite as with any other. You get the most control by using the two-layer approach of deriving from wxGridTableBase. When editing moves to another row you write your updates/new record. Clay

Re: [sqlite] How to compile SQLite with SQLITE_ENABLE_COLUMN_METADATA option under Ubuntu Linux

2008-01-14 Thread Jay Sprenkle
I found some answer to my previous questions and wrote a short tutorial at http://source.online.free.fr/Linux_HowToCompileSQLite.html a .o file is a collection of compiled code called an 'object' file. A library file is very similar but includes a directory so some of the file can be included

[sqlite] Convert a string to Timestamp using SQLite

2008-01-14 Thread manohar s
Hi all, I have a string of type 080110 17:32:34 where.08 refers year in yy format and 01 refers to month(mm) jan and 10 refers date(dd). I want to insert this into SQLite as any standard timestamp format such as -mm-dd HH:MM:SS or unixepoch etc.. Is it possible to do this? Please Help Thanks

RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Samuel R. Neff
I've run into this issue myself and had more trouble than necessary tracking down problems related to it. Personally I would consider it a bug, but it's been discussed hear as accepted behavior. Sam --- We're Hiring! Seeking a passionate developer to

[sqlite] Re: Convert a string to Timestamp using SQLite

2008-01-14 Thread Igor Tandetnik
manohar s [EMAIL PROTECTED] wrote: I have a string of type 080110 17:32:34 where.08 refers year in yy format and 01 refers to month(mm) jan and 10 refers date(dd). I want to insert this into SQLite as any standard timestamp format such as -mm-dd HH:MM:SS or unixepoch etc.. Is it possible to

Re: [sqlite] Re: Convert a string to Timestamp using SQLite

2008-01-14 Thread Michael Hooker
Can't you just perform a few simple string manipulations in your application to turn 080110 into 2008-01-10? Exactly what I was about to suggest. I do it the other way around. One of my table columns has to contain dates, some of which are incomplete, for example March 2001 [the table

RE: [sqlite] Next Version of SQLite

2008-01-14 Thread Fred Williams
-Original Message- From: Nicolas Williams [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 10:29 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Next Version of SQLite On Sun, Jan 13, 2008 at 08:46:03PM -0600, Rick Langschultz wrote: I was wondering what would

Re: [sqlite] Next Version of SQLite

2008-01-14 Thread Nicolas Williams
On Sun, Jan 13, 2008 at 08:46:03PM -0600, Rick Langschultz wrote: I was wondering what would constitute the creation of SQLite 4.0? IMO major implementation details changes are not necessarily a good rationale for bumping the major version number, not from a user's p.o.v. The authors might think

Re: [sqlite] Next Version of SQLite

2008-01-14 Thread Nicolas Williams
On Mon, Jan 14, 2008 at 10:55:42AM -0600, Fred Williams wrote: Which means that if the major version number changes, then it'll be for marketing purposes. Well seeing how SQLite is FREE, it does its own marketing with one word, so to speak. Therefore I doubt marketing will

Re: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Joe Wilson
This issue is debated from time to time on the list: http://www.mail-archive.com/sqlite-users@sqlite.org/msg17769.html The only other database that I'm aware of that supports selecting non-aggregates that are not listed in GROUP BY is MySQL: -- valid in sqlite and mysql, invalid in postgres

[sqlite] WHERE SomeColumn IN (@SQLiteParameter) ???

2008-01-14 Thread idkfa
@SQLiteParameter = 'a','b','c' WHERE SomeColumn IN (@SQLiteParameter) Is there a way to accomplish this type of query? In SQL Server I remember writing a function that translated a list of strings to a table in memory that would satisfy the IN clause. R -- View this message in context:

[sqlite] Re: WHERE SomeColumn IN (@SQLiteParameter) ???

2008-01-14 Thread Igor Tandetnik
idkfa [EMAIL PROTECTED] wrote: @SQLiteParameter = 'a','b','c' WHERE SomeColumn IN (@SQLiteParameter) Is there a way to accomplish this type of query? WHERE @SQLiteParameter LIKE ('%''' || SomeColumn || '''%') Not very fast though (in particular, it can't use an index on SomeColumn if there

[sqlite] Question on SQL arbitrary arrays

2008-01-14 Thread Mike McGonagle
Hello all, This isn't s question specific to SQLite, so I hope that you don't mind... but, I am trying to store an ordered lists of numbers of arbitrary length in a table. I am not really sure what the best method of doing this, but the way that I have come up with is to create a table with the

Re: [sqlite] SQL error: database disk image is malformed

2008-01-14 Thread Kees Nuyt
Hi Jose, On Sun, 13 Jan 2008 23:47:04 -0500, jose isaias cabrera [EMAIL PROTECTED] wrote: Kees Nuyt trying to help me said... On Fri, 11 Jan 2008 15:32:28 -0500, jose isaias cabrera [EMAIL PROTECTED] wrote: Greetings. I have a problem. I have this shared DB amongst 4 co-workers where I

Re: [sqlite] Question on SQL arbitrary arrays

2008-01-14 Thread Ken
Depending upon your needs an alternative would be to store the numbers list as a blob. Then the list can be retrieved as a single select. Just an idea. Ken Mike McGonagle [EMAIL PROTECTED] wrote: Hello all, This isn't s question specific to SQLite, so I hope that you don't mind... but, I am

Re: [sqlite] SQL error: database disk image is malformed

2008-01-14 Thread jose isaias cabrera
Kees Nuyt helped with... Hi Jose, On Sun, 13 Jan 2008 23:47:04 -0500, jose isaias cabrera [EMAIL PROTECTED] wrote: Kees Nuyt trying to help me said... On Fri, 11 Jan 2008 15:32:28 -0500, jose isaias cabrera [EMAIL PROTECTED] wrote: Greetings. I have a problem. I have this shared DB

[sqlite] number of rows in a table

2008-01-14 Thread Bob Rossi
Hi, I'm a newb when it comes to database design, so please forgive me if this question is obvious. With sqlite (or any database 'mysql') if you have a table, can you insert thousands, millions, billions,... of rows? I know this all depends on the details, but I'm just trying to get an idea.

Re: [sqlite] WHERE SomeColumn IN (@SQLiteParameter) ???

2008-01-14 Thread idkfa
That definitely worked as you described, thank you. However, performance is key for us. We'll need to fire off a query like that at a steady 15hz heartbeat (a WHERE NOT IN actually). Could you suggest a faster equivalent to accomplish such a task? What about dumping the string list into a

[sqlite] Re: WHERE SomeColumn IN (@SQLiteParameter) ???

2008-01-14 Thread Igor Tandetnik
idkfa [EMAIL PROTECTED] wrote: What about dumping the string list into a #TempTable and then firing off a SELECT WHERE NOT IN (SELECT value FROM #TempTable)? By all means, go right ahead. Igor Tandetnik - To

[sqlite] Re: number of rows in a table

2008-01-14 Thread Igor Tandetnik
Bob Rossi [EMAIL PROTECTED] wrote: With sqlite (or any database 'mysql') if you have a table, can you insert thousands, millions, billions,... of rows? Yes, though billions is pushing it for an embedded database like SQLite. Also, say you index one of the columns, and there are millions of

Re: [sqlite] Next Version of SQLite

2008-01-14 Thread Bill KING
[EMAIL PROTECTED] wrote: Bill KING [EMAIL PROTECTED] wrote: A colleague brought up a very good point. At least for the first few revisions, is the old engine/code still going to be available until the new engine code base settles down? You can always pull the old code frm CVS and

Re: [sqlite] Re: number of rows in a table

2008-01-14 Thread Bob Rossi
On Mon, Jan 14, 2008 at 03:54:36PM -0500, Igor Tandetnik wrote: Bob Rossi [EMAIL PROTECTED] wrote: Also, say you index one of the columns, and there are millions of rows in the database, but each unique index has 100 items. If you search for a particular index, what is the Big O notation

[sqlite] Re: Re: number of rows in a table

2008-01-14 Thread Igor Tandetnik
Bob Rossi [EMAIL PROTECTED] wrote: On Mon, Jan 14, 2008 at 03:54:36PM -0500, Igor Tandetnik wrote: Bob Rossi [EMAIL PROTECTED] wrote: Also, say you index one of the columns, and there are millions of rows in the database, but each unique index has 100 items. If you search for a particular

Re: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Darren Duncan
At 3:14 PM +0200 1/14/08, Lauri Nurmi wrote: SQLite seems to be accepting SELECT queries that use aggregate functions without a GROUP BY. This is a little dangerous, because queries that should not work at all are returning sensible-looking results. snip sqlite SELECT MAX(a), b FROM T;

RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Griggs, Donald
Hi Duncan, Regarding: A DBMS accepting such queries isn't just a little dangerous, its flat out wrong. I would ask what rationale there is for this query not failing. -- Darren Duncan I'm not asserting that you have to agree with the rationale, but did you see and read the discussion that Joe

RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Darren Duncan
At 10:17 PM -0500 1/14/08, Griggs, Donald wrote: Hi Duncan, Regarding: A DBMS accepting such queries isn't just a little dangerous, its flat out wrong. I would ask what rationale there is for this query not failing. -- Darren Duncan I'm not asserting that you have to agree with the

Re: [sqlite] Question on SQL arbitrary arrays

2008-01-14 Thread mark pirogovsky
Some relational (PostgreSQL for example) databases allow you to store arbitrary array as a field in on row. So your retrieval would be much easier. Also depending on your performance requirements you can store your numbers in CSV format in the single text filed. The search for the group

RE: [sqlite] Aggregates in SELECT without GROUP BY

2008-01-14 Thread Joe Wilson
--- Darren Duncan [EMAIL PROTECTED] wrote: At 10:17 PM -0500 1/14/08, Griggs, Donald wrote: Regarding: A DBMS accepting such queries isn't just a little dangerous, its flat out wrong. I would ask what rationale there is for this query not failing. -- Darren Duncan I'm not asserting that