Re: [sqlite] SQL 2003 in sqlite

2013-11-13 Thread Petite Abeille
On Nov 13, 2013, at 4:38 PM, Simon Slavin wrote: > I still don't know what function that MERGE does that you can't do in SQLite. Are you asking what MERGE does? Or if it’s possible to somehow emulate that functionality in SQLite? If the later, then yes, surely one could patch various stateme

Re: [sqlite] SQL 2003 in sqlite

2013-11-12 Thread Petite Abeille
On Nov 12, 2013, at 9:49 AM, Simon Slavin wrote: >> The merge statement is really missing in sqlite… Yes, very much so. > SQLite does have this form of the INSERT statement: http://www.sqlite.org/lang_conflict.html Sadly, none of these ‘on conflit’ options are of any use for a merge, which,

Re: [sqlite] report bugs-update

2013-11-10 Thread Petite Abeille
On Nov 10, 2013, at 1:51 AM, BULUSLI wrote: > hello Sir,I don't Know this isn't a bug http://www.sqlite.org/compile.html#enable_update_delete_limit ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinf

Re: [sqlite] Handling Pictures

2013-11-06 Thread Petite Abeille
On Nov 6, 2013, at 8:00 PM, Richard Hipp wrote: > See http://www.sqlite.org/whentouse.html#appfileformat for further thoughts > on this. SQLite is commonly used as an application file format. In such > cases, it is entirely appropriate to store content files directly in the > database, rather

Re: [sqlite] Handling Pictures

2013-11-06 Thread Petite Abeille
On Nov 6, 2013, at 7:42 PM, Ulrich Goebel wrote: > Every hint is welcome! Don't store your files in the database. Store them on the file system, as the Almighty intended. Much simpler and flexible altogether. Perhaps of interest: http://www.sqlite.org/intern-v-extern-blob.html

Re: [sqlite] Text file import by column number

2013-10-27 Thread Petite Abeille
On Oct 26, 2013, at 2:08 AM, James K. Lowden wrote: > awk is your friend. 'cut' is even friendlier for simple tasks like those :) ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Trigger SQL and database schema

2013-10-15 Thread Petite Abeille
On Oct 16, 2013, at 7:20 AM, Darren Duncan wrote: > On 2013.10.14 11:58 PM, Sqlite Dog wrote: >> seems like SQLite is not checking trigger SQL for invalid column names >> until execution? > > What you describe sounds like the behavior of every SQL DBMS which has > triggers whose trigger behavi

Re: [sqlite] Easy way to change a column

2013-10-09 Thread Petite Abeille
On Oct 9, 2013, at 2:50 AM, Bao Niu wrote: > For SQLite is there an easy way to find out ALL other tables, queries and > triggers that will be affected when performing a change to a particular > column under the cursor? No. > That would make refactoring so much easier. Yes. Let us know if y

Re: [sqlite] COMMIT in SQLite

2013-10-08 Thread Petite Abeille
On Oct 8, 2013, at 8:10 PM, Stephan Beal wrote: > (link to the original post not included because the archives are only > visible to list members): Hmm? http://news.gmane.org/gmane.comp.version-control.fossil-scm.user ___ sqlite-users mailing list s

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 8:16 PM, Simon Slavin wrote: > The first version (INSERT OR FAIL, then UPDATE) won't lead to any SQLite > errors if one of the rows already exists. So you can do a whole lot of both > lines in one transaction and the transaction will still succeed. Is that so? If 'INSERT O

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 8:05 PM, Simon Slavin wrote: > Which is why you do an INSERT first, and allow it to fail, then do the UPDATE. Sure. A lot of error proce procedural code to do what one SQL statement could do much more naturally. ___ sqlite-users

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 8:09 PM, Marc L. Allen wrote: > Not complaining, mind you. MS SQL doesn't have it, and I've long learned to > deal with it. MS SQL Server sports a MERGE statement if I'm not mistaken: http://msdn.microsoft.com/en-us/library/bb510625.aspx __

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 8:06 PM, Marc L. Allen wrote: > Considered harmful? How so? I wouldn't mind a version of ON CONFLICT UPDATE > fieldlist. In its current form. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/m

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 7:54 PM, "Marc L. Allen" wrote: > Yep. What most people want is an INSERT OR UPDATE. Yep. Which is what one usually calls 'MERGE': http://en.wikipedia.org/wiki/Merge_(SQL) And sadly, SQLite doesn't provide anything like that at all. Oh, well… 'ON CONFLICT clause' cons

Re: [sqlite] SQLite3 3.7.17 => using column names with character '@'.

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 7:59 PM, Dan Kennedy wrote: > A double quoted string is treated as a column name if possible, or a > string literal otherwise. It's an SQL thing. Nah. The second part is a SQLite thing. Randomly converting identifiers into literals is more of a misfeature.

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 23, 2013, at 6:19 PM, Jean-Marie CUAZ wrote: > -> no exception is raised to host langage Tcl for 2 rows not inserted because > a UNIQUE constraint is not respected > -> partial execution : 2 rows are definitely deleted from the table ...(ouch > !) Yep. Looks like it does exactly what i

Re: [sqlite] SQLite clusters?

2013-09-17 Thread Petite Abeille
On Sep 17, 2013, at 10:19 PM, Paolo Bolzoni wrote: > Sorry for the out topic, but why you want to leave 0mq? We always found it > great... Isn't nanomsg the successor of ZeroMQ? I.e. same guy, same project, mark 4 or 5? ___ sqlite-users mailing list

Re: [sqlite] Select with dates

2013-09-16 Thread Petite Abeille
On Sep 16, 2013, at 10:48 AM, Niall O'Reilly wrote: > Consecutive closed intervals overlap. Depending on the > application, this may be a problem; it can be avoided by > using half-open ones. What about simply using not overlapping intervals and call it a day? __

Re: [sqlite] racing with date('now') (was: Select with dates)

2013-09-15 Thread Petite Abeille
On Sep 15, 2013, at 10:32 PM, "Keith Medcalf" wrote: > On the other hand, if one knows that the value of 'now' is not stable then > one can always bind a parameter with the appropriate value set from the host > language Or write it down somewhere once (i.e temp table), or evaluate it once (i

Re: [sqlite] Question about date & time

2013-09-15 Thread Petite Abeille
On Sep 15, 2013, at 8:31 PM, William Drago wrote: > Thanks for the reply. Seconds since the epoch does make a good timestamp. Is > that what is normally used to extract data between time periods? (Date & Time seems to be a popular topic at the moment) There is nothing prescriptive in using ep

Re: [sqlite] racing with date('now') (was: Select with dates)

2013-09-15 Thread Petite Abeille
On Sep 15, 2013, at 12:53 AM, Kees Nuyt wrote: > 3) If an SQL-statement generally contains more than one reference > to one or more s, then all such ref- > erences are effectively evaluated simultaneously. FWIW, Oracle concurs: "All of the datetime functions that return current system dat

Re: [sqlite] Select with dates

2013-09-14 Thread Petite Abeille
On Sep 14, 2013, at 4:24 AM, James K. Lowden wrote: >> Why not >>SELECT * FROM "entry" WHERE >> bankdate >= date('now','start of month') >> AND bankdate < date('now','start of month','+1 month') > > The half-open interval strikes again! :-) Yeah... not sure why people a

Re: [sqlite] Please help me optimize this LEFT JOIN query.

2013-09-05 Thread Petite Abeille
On Sep 5, 2013, at 9:45 PM, Yuzem wrote: > It is incredibly fast but it gives me the wrong result: Yeah… you forgot the 'where' clause in the subquery… you need to restrict it on the genre ___ sqlite-users mailing list sqlite-users@sqlite.org http

Re: [sqlite] Please help me optimize this LEFT JOIN query.

2013-09-05 Thread Petite Abeille
On Sep 5, 2013, at 11:27 PM, Yuzem wrote: > Any clue on why LEFT JOIN is so slow when used with genres but not with > larger tables? Sure. But your conclusion is a most likely a red herring. The crux of the matter is that inner and outer join have a wildly different semantic. And therefore ex

Re: [sqlite] Please help me optimize this LEFT JOIN query.

2013-09-05 Thread Petite Abeille
On Sep 5, 2013, at 10:28 PM, Yuzem wrote: > Ok, wonderful, now it is working correctly but how do I select multiple > columns from table movies? > Should I add another sub query? Nope. You have now changed the problem definition, so scalars will not be a good fit. Blindly copy & paste them wil

Re: [sqlite] Please help me optimize this LEFT JOIN query.

2013-09-05 Thread Petite Abeille
On Sep 5, 2013, at 8:56 PM, Yuzem wrote: > SELECT genres FROM genres LEFT JOIN movies ON genres.movies = movies.movies > GROUP BY genres ORDER BY genres; > time: 2.475s > > SELECT genres FROM genres JOIN movies ON genres.movies = movies.movies GROUP > BY genres ORDER BY genres; > time: 0.035s

Re: [sqlite] Please help me optimize this LEFT JOIN query.

2013-09-05 Thread Petite Abeille
On Sep 4, 2013, at 4:21 PM, Yuzem wrote: > I want to construct genres icons and each icon must display 4 movies. Assuming this is IMDB… what about a scalar subquery? For example, assuming a slightly different schema from yours: selectgenre.code as genre, ( select gr

Re: [sqlite] T-SQL to retrieve needed records

2013-08-31 Thread Petite Abeille
On Aug 31, 2013, at 6:42 PM, James K. Lowden wrote: > I changed the data (see below) because *meaning* of recordings.ends > should be an "exclusive end", what's knows as a half-open interval. > That makes the question of "does b follow a" one of equality. It is > likely not the case that exactl

Re: [sqlite] Number of Colum!!!

2013-08-13 Thread Petite Abeille
On Aug 13, 2013, at 4:11 PM, techi eth wrote: > Trigger Logic!!! > Default Constraint Behaviour!!! > sqlite3 error string size!!! > Number of Colum!!! > What's up with the triple exclamation marks since July 22nd? ___ sqlite-users mailing list sqli

Re: [sqlite] Slow Query on large database Help

2013-08-08 Thread Petite Abeille
On Aug 8, 2013, at 3:40 PM, Christopher W. Steenwyk wrote: > This database is generated once, and then queried and interrogated multiple > times. So I am most concerned with read speed and not with writing or > updating. Ohohoho… in that case… I have some snake oil to sell you, Dear Sir! If yo

Re: [sqlite] Slow Query on large database Help

2013-08-07 Thread Petite Abeille
On Aug 7, 2013, at 9:25 PM, Christopher W. Steenwyk wrote: > Ah, sorry about the attachments, you can find the files here: > https://www.dropbox.com/l/fpFfcjwwcyhXZgduswCggb Ah, also, your schema has a very, hmmm, Entity–attribute–value (EAV) smell to it (object, attribute, types, values, char

Re: [sqlite] Slow Query on large database Help

2013-08-07 Thread Petite Abeille
On Aug 7, 2013, at 9:25 PM, Christopher W. Steenwyk wrote: > Ah, sorry about the attachments, you can find the files here: > https://www.dropbox.com/l/fpFfcjwwcyhXZgduswCggb > > And yes, as the final part of the DB creation I do run ANALYZE. And I do > think the indexes are correct for the quer

Re: [sqlite] Slow Query on large database Help

2013-08-07 Thread Petite Abeille
On Aug 7, 2013, at 8:54 PM, "Christopher W. Steenwyk" wrote: > The attached query takes over 6 days to run. “Patience – A minor form of despair, disguised as a virtue.” Also… attachments are stripped out by the mailing list. You may want to try to inline them instead. ___

Re: [sqlite] Is REAL the best universal data type?

2013-07-24 Thread Petite Abeille
On Jul 23, 2013, at 9:32 PM, Max Vlasov wrote: > On Tue, Jul 23, 2013 at 10:09 PM, Petite Abeille > wrote: > >> >> On Jul 23, 2013, at 9:52 AM, Max Vlasov wrote: >> >>> Basically it's several tables implementing Object-Propery-Value metaphor >&

Re: [sqlite] Is REAL the best universal data type?

2013-07-23 Thread Petite Abeille
On Jul 23, 2013, at 9:52 AM, Max Vlasov wrote: > Basically it's several tables implementing Object-Propery-Value metaphor Hurray! The Entity–attribute–value (EAV) anti-pattern! "… an EAV based approach is an anti-pattern which can lead to longer development times, poor use of database resourc

Re: [sqlite] FTS4 search for terms inside a word

2013-07-22 Thread Petite Abeille
On Jul 22, 2013, at 3:29 PM, Marco Bambini wrote: > I have a virtual FTS4 table and I would like to search for some terms inside > a word, is that possible? Not with the default tokenizers, but perhaps you could write your own, say an ngram tokenizer or such. http://www.sqlite.org/fts3.html#

Re: [sqlite] Order By clause in aggregate functions?

2013-07-21 Thread Petite Abeille
On Jul 21, 2013, at 10:15 PM, ss griffon wrote: > I'm writing an extension to SQLite that adds some aggregate functions. > Some of them, require that the rows passed to the aggregate function > be sorted. It seems as if lots of data bases (MySQL, PostgreSQL) > support an ORDER BY clause in thei

Re: [sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-21 Thread Petite Abeille
On Jul 21, 2013, at 7:47 PM, Igor Tandetnik wrote: > This query is in fact perfectly legal. It's OK to refer to column aliases in > ORDER BY clause. Perhaps in SQLite, yes. select 1 as a order by 1; select 1 as a order by a; select x as a from ( select 1 as x ) order by a; But this is far

Re: [sqlite] Guidance with Python and nested cursors

2013-07-17 Thread Petite Abeille
On Jul 17, 2013, at 9:07 PM, Joseph L. Casale wrote: > I am using Python to query a table for all its rows, for each row, I query > related rows from a > second table, then perform some processing and insert in to a third table. > > What is the technically correct approach for this? >From th

Re: [sqlite] sqlite3: .import command handles quotation incorrectly

2013-06-25 Thread Petite Abeille
On Jun 25, 2013, at 11:19 AM, Nißl Reinhard wrote: > because it stays in quotation mode until it finds a further ", which is > incorrect. Quotation mode may only get activated when " appears at the > beginning of a column value. Meh… check the recent "escape quote for csv import" thread… As

Re: [sqlite] escape quote for csv import

2013-06-18 Thread Petite Abeille
On Jun 18, 2013, at 11:07 PM, Roland Hughes wrote: > and "tools.ietf.org" is exactly WHERE on the sqlite.org path? "Everything is amazing and nobody is happy" -- Louis CK ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080

Re: [sqlite] escape quote for csv import

2013-06-18 Thread Petite Abeille
On Jun 18, 2013, at 10:46 PM, Roland Hughes wrote: > It isn't documented anywhere, but, you have to BOTH quote the string AND > double up the quotes inside of it. Indeed: 7. If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by

Re: [sqlite] escape quote for csv import

2013-06-18 Thread Petite Abeille
On Jun 18, 2013, at 10:02 PM, Clemens Ladisch wrote: > (There is no official CSV standard, and there is no widely supported > escaping mechanism.) Perhaps. But that's not an excuse to ignore the de facto convention: Common Format and MIME Type for Comma-Separated Values (CSV) Files http://tool

Re: [sqlite] Feature request: add support for COMMENT statement

2013-06-17 Thread Petite Abeille
On Jun 17, 2013, at 6:14 PM, Roman Fleysher wrote: > Dear SQLiters, First thing first… don't hijack a thread… instead start a new one, with a new subject. > Can someone recommend an ORM? No. > What are the pros and cons of using them? http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+

Re: [sqlite] Updating a table from itself

2013-06-09 Thread Petite Abeille
On Jun 9, 2013, at 5:25 PM, E.Pasma wrote: >> Yes, unfortunately. I would love to see some form of UPDATE FROM make it >> into SQLite, but none such exists at the moment. >> -- >> Igor Tandetnik >> > Possibly INSERT OR REPLACE is useful when multiple columns need to be updated. Sadly, not qu

Re: [sqlite] Serialize an in-memory database

2013-06-05 Thread Petite Abeille
On Jun 5, 2013, at 10:02 PM, Philip Bennefall wrote: > That is exactly the sort of thing I am looking for. If anything, I think it'd > be great to have such a vfs in SqLite if only for > completeness/customizability, seeing as how there are so many different > allocators for example. It'd be

Re: [sqlite] Serialize an in-memory database

2013-06-05 Thread Petite Abeille
On Jun 5, 2013, at 9:44 PM, Philip Bennefall wrote: > I use Windows. This looks like it is purely for Unix variants? I suspect one call these 'RAM disk/drive' as well... http://en.wikipedia.org/wiki/List_of_RAM_drive_software > I need something that operates wherever SqLite does, so can't be

Re: [sqlite] Serialize an in-memory database

2013-06-05 Thread Petite Abeille
On Jun 5, 2013, at 9:38 PM, Philip Bennefall wrote: > I don't want it in a file, however. I want it in a memory block. So tmpfs > wouldn't do the trick from what I gather. … tmpfs *is* memory… just looks like a file system… http://en.wikipedia.org/wiki/Tmpfs ___

Re: [sqlite] Serialize an in-memory database

2013-06-05 Thread Petite Abeille
On Jun 5, 2013, at 9:25 PM, Philip Bennefall wrote: > Doesn't that still create a file, just a temporary one? I need the serialized > content in a char* or similar so I can memcpy it etc, and then feed it back > to SqLite at a later time. I guess I could make a toy vfs that uses a > malloc:ed

Re: [sqlite] Serialize an in-memory database

2013-06-05 Thread Petite Abeille
On Jun 5, 2013, at 9:10 PM, Philip Bennefall wrote: > Yes, I have seen the backup API. But I would like to avoid the disk file > entirely and just serialize to and from memory. Lateral thinking… write your db to tmpfs… ___ sqlite-users mailing list

Re: [sqlite] Max of 63 columns for a covering index to work?

2013-05-22 Thread Petite Abeille
On May 22, 2013, at 8:58 PM, David de Regt wrote: > Back to the trenches to rearchitect this… Perhaps an opportunity to introduce bitmap indexes to SQLite… which would render compound indexes a thing of the past for certain class of problems such as yours... http://en.wikipedia.org/wiki/Bitm

Re: [sqlite] Problem with index on multiple columns

2013-05-17 Thread Petite Abeille
On May 18, 2013, at 3:13 AM, Keith Medcalf wrote: > This applies *only* to the rowid (integer primary key). Other indexes (as in > CREATE INDEX) are always unique since the key always contains the rowid as > the final (unspoken) component. A "unique" index must be unique without > consideri

Re: [sqlite] Problem with index on multiple columns

2013-05-17 Thread Petite Abeille
On May 17, 2013, at 10:54 AM, Konstantinos Alogariastos wrote: > Does this mean that one cannot use a index on two columns when in the query > both columns are used with "IN"? You might want to read up on the query planner: http://www.sqlite.org/queryplanner.html#searching The short of it: o

Re: [sqlite] Possible bug in type conversion prior to comparison

2013-05-13 Thread Petite Abeille
On May 13, 2013, at 6:12 PM, Simon Slavin wrote: > I should have asked you for (1,2,20) as well and we could see whether it > outputs '10' or '10.0'. But yes, it would appear that in Oracle, NUMERIC > means FLOAT. Nah. Plus there is no such type as 'NUMERIC' per se in Oracle. Just NUMBER( p

Re: [sqlite] SQL join with "or" condition gives unexpected results

2013-05-09 Thread Petite Abeille
On May 9, 2013, at 3:30 PM, Romulo Ceccon wrote: > But my application is (so far) database agnostic Reconsider. Agnosticism is not a feature. It's a bug. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/lis

Re: [sqlite] looking up records with terms in a table

2013-03-26 Thread Petite Abeille
On Mar 26, 2013, at 10:36 PM, "Paul Mathieu" wrote: > SELECT Sentences FROM T1 JOIN T2 ON T1.Sentences LIKE > CONCAT('%',T2.Terms,'%') Alternatively, use FTS [1]: sqlite> create virtual table sentence using fts4( content text ); sqlite> insert into sentence values( 'FTS3 and FTS4 are nearly i

Re: [sqlite] pragma table_info(database.table) not supported

2013-03-25 Thread Petite Abeille
On Mar 21, 2013, at 6:41 PM, Peter Haworth wrote: > I found the code in the two attached files (are they allowed on this list?) > on the web a while back. The claim was that it created an information > schema database from an sqlite db. I know nothing about Lua but I managed > to get as far as

Re: [sqlite] How do I write a query

2013-03-24 Thread Petite Abeille
On Mar 24, 2013, at 8:30 PM, Larry Brasfield wrote: >> That said… it seems to be odd to have a 'player' vs . 'draftedplayers' >> table… looks like a typical is_a vs has_a confusion... > > The table named 'draftedplayers' is simply a many-to-many relation between > the 'player' and 'league' ta

Re: [sqlite] How do I write a query

2013-03-24 Thread Petite Abeille
On Mar 24, 2013, at 4:13 PM, Simon Slavin wrote: > SELECT playerid FROM players WHERE playerid IS NOT IN (SELECT playerid FROM > draftedplayers) Alternatively: select playerid fromplayers where not exists ( select 1 fromdraftedplayers where

Re: [sqlite] [sqlite-dev] SQLite version 3.7.16

2013-03-20 Thread Petite Abeille
On Mar 20, 2013, at 11:19 PM, Simon Slavin wrote: > What on earth is spellfix ? I don't remember having heard of it before. > googling doesn't seem to turn up any page which says "This is what spellfix > is.". http://www.sqlite.org/draft/spellfix1.html _

Re: [sqlite] [sqlite-dev] SQLite version 3.7.16

2013-03-20 Thread Petite Abeille
On Mar 19, 2013, at 11:25 PM, Richard Hipp wrote: > Try static linking. Example of how to build a shell that contains spellfix1: For the record, aside from being a great little SQL engine, gems like FTS and spellfix are really what make SQLite truly outstanding. Thanks for that :) __

Re: [sqlite] pragma table_info(database.table) not supported

2013-03-20 Thread Petite Abeille
On Mar 20, 2013, at 6:53 PM, Jay A. Kreibich wrote: > If there is any change I'd like to see, it is that all the PRAGMAs > that return tabular data should really be system catalog tables. Triple hurray for that! SQLite deserves a proper data dictionary, no question asked. What about adoptin

Re: [sqlite] [sqlite-dev] SQLite version 3.7.16

2013-03-19 Thread Petite Abeille
On Mar 19, 2013, at 1:33 PM, D. Richard Hipp wrote: > http://www.sqlite.org/releaselog/3_7_16.html • Enhance the spellfix1 extension so that the edit distance cost table can be changed at runtime by inserting a string like 'edit_cost_table=TABLE' into the "command" field. Is there an exam

Re: [sqlite] sqlite and Mac App Store sandbox

2013-03-18 Thread Petite Abeille
On Mar 18, 2013, at 8:02 PM, Marco Bambini wrote: > Anyone have another solution? You may have better luck at . In the meantime: http://developer.apple.com/library/mac/#documentation/Security/Conceptual/AppSandboxDesignGuide/MigratingALegacyApp/MigratingAnAppToASandbox.html _

Re: [sqlite] Fuzzy joins

2013-03-11 Thread Petite Abeille
On Mar 11, 2013, at 10:32 PM, David Bicking wrote: > Um, I am wrong, cause I just tried it and sqlite only returns the level 5 > result. I have no clue why! The joins are setup from most specific to broadest. Each join is evaluated only if the previous one returns null (i.e. all these 'and Pr

Re: [sqlite] Fuzzy joins

2013-03-11 Thread Petite Abeille
On Mar 11, 2013, at 4:54 PM, David Bicking wrote: > Am I missing an obviously better way to do it? > A way that can easily be expanded when they come back to me and say if I > looked at a fifth column, you'd have been able to match it…. As they stand, your updates will always match whatever w

Re: [sqlite] SQLite strong-typing [WAS: inner vs. outer join inconsistency]

2013-03-07 Thread Petite Abeille
On Mar 7, 2013, at 7:53 PM, Ryan Johnson wrote: > Meanwhile, though, I'd be delighted if column affinity, cast(), implicit > conversions performed by arithmetic operations, check(), and triggers all > behaved the same way, with the current behavior of column affinity probably > the least surp

Re: [sqlite] SQLite strong-typing [WAS: inner vs. outer join inconsistency]

2013-03-07 Thread Petite Abeille
On Mar 7, 2013, at 6:21 AM, Nico Williams wrote: > In conclusion, if you want to allow affine type conversions on INSERT, > but not disallow values that cannot be so converted, then > CHECK(my_column = CAST(my_column AS )) works. And if you want > to disallow values of incorrect types even when

Re: [sqlite] SQLite strong-typing [WAS: inner vs. outer join inconsistency]

2013-03-06 Thread Petite Abeille
On Mar 6, 2013, at 11:53 PM, Nico Williams wrote: >> o k i d o k i . . . > > Oh. Oh.. Ew.. Never mind then! Yeah… a bit of a mind melt… nevertheless… such check should work as advertised… even handles nulls properly… perhaps too clever too... :D "All magic comes with a price, Dearie" --

Re: [sqlite] SQLite strong-typing [WAS: inner vs. outer join inconsistency]

2013-03-06 Thread Petite Abeille
On Mar 6, 2013, at 10:49 PM, Nico Williams wrote: > Ah, your confusion comes from the fact that type conversion still > happens when the INSERT gets around to making the record. The CHECK > constraint happens before the record is made. See the vdbe that gets > generated. All good. Small sanit

Re: [sqlite] SQLite strong-typing [WAS: inner vs. outer join inconsistency]

2013-03-06 Thread Petite Abeille
On Mar 6, 2013, at 10:47 PM, Nico Williams wrote: >> Hmmm… on second thought… is that an assignment in that check constraint?!? >> I.e. are you reassigning a to a new cast value?!? > > No. The only place where = is an assignment is in UPDATE statements, > in the SET clause. Yeah… dazed and c

Re: [sqlite] SQLite strong-typing [WAS: inner vs. outer join inconsistency]

2013-03-06 Thread Petite Abeille
On Mar 6, 2013, at 10:43 PM, Petite Abeille wrote: >> CREATE TABLE toy(a INTEGER CHECK(a = CAST(a AS INTEGER))); > > Hmmm… on second thought… is that an assignment in that check constraint?!? > I.e. are you reassigning a to a new cast value?!? > > Are not check con

Re: [sqlite] SQLite strong-typing [WAS: inner vs. outer join inconsistency]

2013-03-06 Thread Petite Abeille
On Mar 6, 2013, at 10:24 PM, Nico Williams wrote: > Nah, use this sort of CHECK constraint: > > CREATE TABLE toy(a INTEGER CHECK(a = CAST(a AS INTEGER))); Hmmm… on second thought… is that an assignment in that check constraint?!? I.e. are you reassigning a to a new cast value?!? Are not chec

Re: [sqlite] SQLite strong-typing [WAS: inner vs. outer join inconsistency]

2013-03-06 Thread Petite Abeille
On Mar 6, 2013, at 10:24 PM, Nico Williams wrote: > CREATE TABLE toy(a INTEGER CHECK(a = CAST(a AS INTEGER))); Any idea on the cost of such check? In term of overhead? Just curious. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.

Re: [sqlite] How can I improve this query?

2013-03-06 Thread Petite Abeille
On Mar 5, 2013, at 10:41 PM, Yuzem wrote: > Hello, I have the following tables: > CREATE TABLE movies (movies,name); > CREATE TABLE genres (movies,genres); IMDB? > > Every movie has many genres and every genre has many movies. > I want to list all genres but those who match a specified movie

Re: [sqlite] Break on cumulative sum

2013-03-05 Thread Petite Abeille
On Mar 5, 2013, at 9:24 AM, Nico Williams wrote: > +1 re: recursive queries. There is a standard for that (in ANSI SQL-99?): recursive 'with' clause, aka recursive subquery factoring, aka recursive common table expressions. http://www.postgresql.org/docs/9.2/static/queries-with.html This

Re: [sqlite] Break on cumulative sum

2013-03-05 Thread Petite Abeille
On Mar 5, 2013, at 8:19 AM, James K. Lowden wrote: >> Postgresql has also had them for a while. > > Yes, and if I'm not mistaken Ingres's QUEL had them long before that. Yes, many databases have them, from Postgres, MSSQL, Sybase IQ, some flavor of DB2, to Oracle, etc, ... > (I see Microsof

Re: [sqlite] Break on cumulative sum

2013-03-04 Thread Petite Abeille
On Mar 4, 2013, at 1:32 AM, James K. Lowden wrote: > What do you have in mind? I've benn adding some user defined functions > and am thinking of creating a repository for them. All the so-called window functions from SQL:2003 (aka analytic functions): "Windowed Tables and Window Functions i

Re: [sqlite] Break on cumulative sum

2013-03-03 Thread Petite Abeille
On Mar 3, 2013, at 2:10 PM, "James K. Lowden" wrote: > There's some cruft, too. I was only demonstrating that it could be > done. If you find a way to simplify it, you'll know you understand > it. Ah… if only… SQLite had analytical functions… oh, well..

Re: [sqlite] SQLite equivalent to Oracle's MERGE INTO

2013-02-27 Thread Petite Abeille
On Feb 27, 2013, at 2:53 PM, James K. Lowden wrote: > On Mon, 25 Feb 2013 23:54:23 +0100 > anydacdev anydacdev wrote: > >> I was wondering what is SQLite's equivalent to: >> >> MERGE INTO x TGT >> USING (SELECT NAME, KEY FROM y) SRC >> ON (TGT.key = SRC.key) >> WHEN MATCHED THEN >> UPDATE SE

Re: [sqlite] SQLite equivalent to Oracle's MERGE INTO

2013-02-25 Thread Petite Abeille
On Feb 25, 2013, at 11:54 PM, anydacdev anydacdev wrote: > I was wondering what is SQLite's equivalent to: > > MERGE INTO x TGT There is none. Even though it's standard SQL (SQL:2003 or such), this is not supported by SQLite in any way, shape, or form. One could make do with a loop of 'inse

Re: [sqlite] column totals

2013-02-23 Thread Petite Abeille
On Feb 23, 2013, at 12:07 AM, Paul Sanderson wrote: > any ideas? As mentioned, you will need two queries and union their respective result sets. For example, assuming the following data set: create table test( key, value ); insert intotest ( key, value ) values ( 'a', 1 ),

Re: [sqlite] SQLite on a Mac: PHP doesn't know about :-(

2013-02-22 Thread Petite Abeille
On Feb 22, 2013, at 9:51 PM, Didier Morandi wrote: > . You seem to be missing the point entirely. No one mentioned anything about OOP at all, whatever that is. Merely that you may be better off using a more contemporary version of SQLite. That's all.

Re: [sqlite] BUG? sqlite not reporting error like "more than one row returned by a subquery used as an expression"

2013-02-20 Thread Petite Abeille
On Feb 20, 2013, at 9:35 PM, "Jay A. Kreibich" wrote: > Not covert... works as documented: "Let us be charitable, and call it a misleading feature" -- Larry Wall > Not random either... at least, not any more random than any other > query. Result order is never meaningful unless there is an

Re: [sqlite] BUG? sqlite not reporting error like "more than one row returned by a subquery used as an expression"

2013-02-20 Thread Petite Abeille
On Feb 20, 2013, at 9:29 PM, Richard Hipp wrote: > On Wed, Feb 20, 2013 at 3:25 PM, Petite Abeille > wrote: > >> >> On Feb 20, 2013, at 2:15 PM, Richard Hipp wrote: >> >>> SQLite automatically adds a LIMIT 1 to a scalar subquery. >> >> Yea

Re: [sqlite] BUG? sqlite not reporting error like "more than one row returned by a subquery used as an expression"

2013-02-20 Thread Petite Abeille
On Feb 20, 2013, at 2:15 PM, Richard Hipp wrote: > SQLite automatically adds a LIMIT 1 to a scalar subquery. Yeah… that's a bit of a death trap though… would be much more productive if SQLite would raise an exception instead of doing something covert and random... ___

Re: [sqlite] select max(x), y from table

2013-02-04 Thread Petite Abeille
On Feb 4, 2013, at 12:47 PM, Ryan Johnson wrote: > Otherwise, it looks like you want some variant of the "windowing" and "rank" > functions, which are non-standard features of postgres: > http://www.postgresql.org/docs/9.1/static/tutorial-window.html Window functions (aka analytics) are standa

Re: [sqlite] sqlite bug? Subquery containing like-expression in where clause with starting '%' returns no rows, but without '%' does

2013-02-03 Thread Petite Abeille
On Feb 3, 2013, at 10:38 PM, Thomas Mittelstaedt wrote: >> Firstly, are you sure you shouldn't be saying IN rather that = ? > > Yep. Correct. Thanks, Keith. No bug! Yeah… perhaps not a "bug" per se, but definitively one of these SQLite "deathtrap"… scalar queries are meant to return one, and

Re: [sqlite] select max(x), y from table

2013-02-03 Thread Petite Abeille
On Feb 3, 2013, at 9:54 PM, Gabor Grothendieck wrote: > What is the SQLite consortium? http://www.sqlite.org/consortium.html ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] trying to exclude records which have a field that is null

2013-02-03 Thread Petite Abeille
On Feb 3, 2013, at 10:55 AM, e-mail mgbg25171 wrote: > (select * from calls where by_or_on <> '') c For the record… one thing to watch out… the empty string (aka '') and null are not the same… so if you are looking to eliminate nulls you have to use 'foo is not null'… as oppose to "foo != ''

Re: [sqlite] trying to exclude records which have a field that is null

2013-02-02 Thread Petite Abeille
On Feb 3, 2013, at 12:19 AM, e-mail mgbg25171 wrote: > "having by_or_on is not null " & _<==THIS ISN'T DOING IT FOR ME > AND I'D LIKE TO KNOW WHY Use a where clause ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:

Re: [sqlite] PRAGMA table_info documentation

2013-02-02 Thread Petite Abeille
On Feb 2, 2013, at 7:32 PM, chojra...@gmail.com wrote: > I'd like to ask about contents of last column in result of PRAGMA > table_info in SQLite 3.7.15.1 because it is not documented ( > http://www.sqlite.org/pragma.html#pragma_table_info). > It looks as if the value is '1', the column is in the

Re: [sqlite] FTS4 languageid : not sure I understand this correctly

2013-01-31 Thread Petite Abeille
On Jan 31, 2013, at 9:27 PM, Gert Van Assche wrote: > Thanks Michael. Not what I hoped for but now I understand it. Perhaps of interest: Language Identification Tools http://www.let.rug.nl/~vannoord/TextCat/competitors.html ___ sqlite-users mailing

[sqlite] sqlite-analyzer & largish db?

2013-01-25 Thread Petite Abeille
Hello, [3.7.15.2 2013-01-09 11:53:05 c0e09560d26f0a6456be9dd3447f5311eb4f238f] [sqlite-analyzer-osx-x86-3071502] sqlite3_analyzer seems to, hmmm, overflow or something given a largish db. For example, for a db of 8,434,233,344 bytes (8.43 GB on disk) : --8<-- *** All tables and indices ***

[sqlite] identify virtual tables?

2013-01-25 Thread Petite Abeille
Hello, What would be a reasonable way to programmatically identify all the virtual tables in a database? Is there a structured way to do so? Short of scanning the DDLs that is? selectname from sqlite_master where type = 'table' and lower( sql ) like '% virtual %' order by

Re: [sqlite] Help needed with query to tell a FK from a PK

2013-01-03 Thread Petite Abeille
On Jan 3, 2013, at 10:19 AM, nospam.nospam.nos...@gmail.com wrote: > I'm trying to create two queries so I can determine which of the keys > for a given sqlite3 table is the primary key and which keys are > foreign. pragma table_info() returns a 'pk' attribute. You can use that to identify the

Re: [sqlite] creating indexes on empty columns

2012-11-26 Thread Petite Abeille
On Nov 26, 2012, at 12:30 AM, Jay A. Kreibich wrote: > "Using SQLite" (http://shop.oreilly.com/product/9780596521196.do) > has a very lengthy discussion of indexes and how they work, > specifically because it is difficult to generalize the use of > indexes. One must really look at each appl

Re: [sqlite] creating indexes on empty columns

2012-11-25 Thread Petite Abeille
On Nov 25, 2012, at 8:41 PM, Keith Medcalf wrote: > (ie, be careful not to just add water into the bag -- the objective is to > poke it around, not just add more water) +1 for the, hmmm, treading water metaphore ___ sqlite-users mailing list sqlite

Re: [sqlite] Mac development question

2012-10-23 Thread Petite Abeille
On Oct 23, 2012, at 11:35 PM, Igor Korot wrote: > So then user home directory (~) should be fine, right? No. Don't. Lookup NSApplicationSupportDirectory and check the documentation. Apple has clear APIs and guidelines about where to put what. Learn them. __

Re: [sqlite] Data type information for derived columns

2012-10-10 Thread Petite Abeille
On Oct 10, 2012, at 7:21 PM, jkp487-sql...@yahoo.com wrote: > New to SQLite. Is there a way to get column data type information for > derived columns in a query or view? For example, if I have something like > this: > > > select Customer.LastName || Customer.FirstName as Fullname cast perhap

<    1   2   3   4   5   6   7   >