Re: [sqlite] Avoiding Database Is Locked Error

2010-06-11 Thread Jay A. Kreibich
g list. I can no longer provide a reference, however. The book has entered final production and the online version has been removed from O'Reilly's feedback site. http://oreilly.com/catalog/9780596521196/ http://www.amazon.com/Using-SQLite-Jay-Kreibich/dp/0596521189/

Re: [sqlite] [bug] documentation error SELECT statement GROUP BY clause

2010-06-13 Thread Jay A. Kreibich
N t2 ON (ex)" is allowed by the diagrams, yet that makes no sense. There are several other examples. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the

Re: [sqlite] Avoiding Database Is Locked Error

2010-06-14 Thread Jay A. Kreibich
critical. But your general approach of looping over a select and doing other things is completely valid. You just need to be ready to handle a busy condition at the first modification. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is impo

Re: [sqlite] Avoiding Database Is Locked Error

2010-06-14 Thread Jay A. Kreibich
s on autocommit transactions that I don't know all that well. I do know is that intermixing modifications while walking through a SELECT has always worked exactly the way I expected. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is

Re: [sqlite] Parametrized Queries issue (Possible bug)

2010-06-14 Thread Jay A. Kreibich
e value will be used in both locations in the query. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Jo

Re: [sqlite] Parametrized Queries issue (Possible bug)

2010-06-14 Thread Jay A. Kreibich
over-written with the last-used representation. To avoid such problems, it is strongly advised you do not mix parameter types. Either use bare parameters, explicit indexes, or names-- but pick one and stick with it. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H

Re: [sqlite] Parametrized Queries issue (Possible bug)

2010-06-14 Thread Jay A. Kreibich
o it anyways you will likely be confused. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomf

Re: [sqlite] Avoiding Database Is Locked Error

2010-06-15 Thread Jay A. Kreibich
nd you still need to know how to deal with all the locking and busy issues that come with that. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wr

Re: [sqlite] notify all processes of database modification

2010-06-15 Thread Jay A. Kreibich
, the best bet is likely to be PRAGMA user_version. http://www.sqlite.org/pragma.html#pragma_schema_version -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the ten

Re: [sqlite] notify all processes of database modification

2010-06-15 Thread Jay A. Kreibich
On Tue, Jun 15, 2010 at 09:47:23PM -0500, Jay A. Kreibich scratched on the wall: > On Tue, Jun 15, 2010 at 09:48:53PM -0400, Igor Tandetnik scratched on the > wall: > > Rich Rattanni <ratta...@gmail.com> wrote: > > > The creator of SQLite actually gave a talk about usi

Re: [sqlite] create index before or after many inserts?

2010-06-15 Thread Jay A. Kreibich
nce of pages (assuming no existing free pages). Contiguous, yes, but the pages may not be in any logical order. The internal node pages will get shuffled as the tree is built, meaning you might still have a significant number of seeks. -j -- Jay A. Kreibich < J A Y @ K R E I

Re: [sqlite] Sqlite 3.6.23 string functions do not follow case sensitivity in comparions

2010-06-16 Thread Jay A. Kreibich
result seems incorrect. I'm can't offer a definitive answer, however. > > select * from foo where splitstr( value, '@', 1 ) = 'foo'; > 4|f...@bar As a workaround, try: SELECT * FROM foo WHERE splitstr( value, '@', 1 ) COLLATE NOCASE = 'foo'; -j -- Jay A. Kreibich <

Re: [sqlite] c compiler during install

2010-06-17 Thread Jay A. Kreibich
for more details. > I am not a programmer, but I assume that this a c compiler: > > [r...@selkirk sqlite-3.6.23.1]# which cc1 > /usr/libexec/gcc/i386-redhat-linux/4.1.1/cc1 Assuming that is your C compiler, try this: # CC=cc1 ./configure -j -- Jay A. Kreibich < J A Y

Re: [sqlite] SELECT behaviour with INDEX

2010-06-17 Thread Jay A. Kreibich
uery). There are a small handful of exceptions (such as chained OR conditions), but that's a good place to start. > And in this specific case unless you have a boat load of utc's for > each client_id the utc index isn't going to buy you much at all. Correct. It is doubtful the I/O overhead

Re: [sqlite] SELECT behaviour with INDEX

2010-06-17 Thread Jay A. Kreibich
to each row. Yeah, it gets complex real fast -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make t

Re: [sqlite] could be memory leak

2010-06-17 Thread Jay A. Kreibich
is written into memory obtained from sqlite3_malloc() and passed back through the 5th parameter. To avoid memory leaks, the application should invoke sqlite3_free() on error message strings returned through the 5th parameter of of sqlite3_exec() after the error message string is

Re: [sqlite] unexpected large journal file

2010-06-18 Thread Jay A. Kreibich
p the cache up... if you're on a nice desktop with a few gigs of RAM, bump it up 10x to 100x. There are PRAGMAs to do all this. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong

Re: [sqlite] unexpected large journal file

2010-06-18 Thread Jay A. Kreibich
On Fri, Jun 18, 2010 at 04:07:53PM -0400, Eric Smith scratched on the wall: > Jay A. Kreibich wrote: > > > > I'd really love to avoid writing a big journal file. And I'd love to > > > avoid doing a billion-row insert in one transaction. > > > > So turn jo

Re: [sqlite] unexpected large journal file

2010-06-18 Thread Jay A. Kreibich
On Fri, Jun 18, 2010 at 08:24:47PM -0400, Eric Smith scratched on the wall: > Jay A. Kreibich wrote: > > > Yes. Hence the "and this is the important part" comment. Most of > > the time when people are building billion-row files, they're building > > a n

Re: [sqlite] unexpected large journal file

2010-06-20 Thread Jay A. Kreibich
On Fri, Jun 18, 2010 at 07:01:25PM -0700, Scott Hess scratched on the wall: > On Fri, Jun 18, 2010 at 5:24 PM, Eric Smith <eas@gmail.com> wrote: > > Jay A.  Kreibich wrote: > >> Yes.  Hence the "and this is the important part" comment.  Most of > >>

Re: [sqlite] unexpected large journal file

2010-06-20 Thread Jay A. Kreibich
On Sat, Jun 19, 2010 at 12:58:45PM -0400, Eric Smith scratched on the wall: > Jay A. Kreibich wrote: > > I think the use case will usually be (only) writes followed by (only) > reads. There may be incremental writes later, but they will hopefully > be small compared to the i

Re: [sqlite] When to close a db?

2010-06-20 Thread Jay A. Kreibich
Check the return value, but call sqlite3_close(). Always. It will accept a NULL pointer. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to ma

Re: [sqlite] When to close a db?

2010-06-20 Thread Jay A. Kreibich
alled, my guess (and this is a pretty wild one) is the code is forcibly finalizing statements, leaving behind stale pointers. As soon as one of those is dereferenced, things crash. This is even more likely if you're using FTS. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Inte

Re: [sqlite] When to close a db, take 2...

2010-06-21 Thread Jay A. Kreibich
the object is destroyed it will do a double close. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson __

Re: [sqlite] When to close a db, take 2...

2010-06-22 Thread Jay A. Kreibich
s enough complexity that a net positive gain in stability and reliability is somewhat questionable. Invariants are a powerful tool, and they have a strong place in computer science to write verifiable algorithm proofs. But like any powerful tool, they're easy to misuse. Their day-to-day

Re: [sqlite] linear behavior on INSERT (was Re: unexpected large journal file)

2010-06-22 Thread Jay A. Kreibich
cess times, however, especially with larger files. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson _

Re: [sqlite] linear behavior on INSERT (was Re: unexpected large journal file)

2010-06-22 Thread Jay A. Kreibich
Uggg On Tue, Jun 22, 2010 at 05:12:38PM -0500, Jay A. Kreibich scratched on the wall: > On Tue, Jun 22, 2010 at 04:16:42PM -0400, Eric Smith scratched on the wall: > > Jim Wilcoxson wrote: > > > > > Insert times should be constant for the 2nd case: no primary ke

Re: [sqlite] [OT] Avoiding Out Of Office Auto Reply To Group

2010-06-23 Thread Jay A. Kreibich
info/sqlite-users > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear:

Re: [sqlite] marking transaction boundaries

2010-06-23 Thread Jay A. Kreibich
t prepares a fresh ID for the next transaction. You would need per-connection values, but if your application is only using one connection at a time, it is pretty simple. You could even do all that in an external extension. You'd need to somehow load the extension, but you wouldn't need any o

Re: [sqlite] How accept sqlite3 commands from stdin

2010-06-24 Thread Jay A. Kreibich
the second problem without modifications to sqlite3. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel unc

Re: [sqlite] How accept sqlite3 commands from stdin

2010-06-24 Thread Jay A. Kreibich
initcli or something that simply ignored the first line of input. It could also imply -batch. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency

Re: [sqlite] Why null is not printed?

2010-06-24 Thread Jay A. Kreibich
I tried it in sqlite3, only an empty line is printed. Is it the > cases that sqlite3 change the way to show null after the book was > published? Likely. See sqlite3 command ".nullvalue". -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intell

Re: [sqlite] when foreign key is PRIMARY KEY AUTOINCREMENT

2010-06-25 Thread Jay A. Kreibich
name TEXT, > PRIMARY KEY(ChildId), FOREIGN KEY(ParentId) REFERENCES > Parent(ParentId));after insert into Parent values('name1'); how to get > parentId and set the parentId in table Child.Thanks, > Zeal. last_insert_rowid() http://www.sqlite.org/lang_corefunc.html -j

Re: [sqlite] TRIGGER ?

2010-06-25 Thread Jay A. Kreibich
h column: table1.a at SQLiteTrigger.plx > line 35. > > I would think that I have referred to the table properly... Try "OLD.a". http://www.sqlite.org/lang_createtrigger.html -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: i

Re: [sqlite] Use of strftime in a CREATE INDEX sintax.

2010-06-25 Thread Jay A. Kreibich
gt; fat_datfat)) ON CONFLICT FAIL; > > > > Could it be translated into a corret sintax without add another field > > (fat_year)? > > No. You could, however, write a collation that only pays attention to the year, and then build your index and queries using that. -j -- Jay

Re: [sqlite] normalization example(s)

2010-06-26 Thread Jay A. Kreibich
On Sat, Jun 26, 2010 at 03:51:12AM +0100, Simon Slavin scratched on the wall: > So you're posting to a mailing list you don't read ? People replay without seeming to read all the time... -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: i

Re: [sqlite] german locale: queries calculated float fields deliver wrong dec.sep.

2010-06-27 Thread Jay A. Kreibich
g that might be converted (in the case of the functions) but given raw in the case of just returning a raw column. For example: SELECT X, typeof( X ) FROM MY_POINTS; -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that y

Re: [sqlite] replacing a table

2010-06-27 Thread Jay A. Kreibich
he master table to change the name of target_table2 to > target_table > > According to the FAQ, sqlite_master is read-only. Is there any to pull of > this trick? You can do this with "PRAGMA writeable_schema", but I think the real answer you're looking for is ALTER TABLE ..

Re: [sqlite] (python) how to define unchangeable global ID in a table?

2010-06-28 Thread Jay A. Kreibich
for example. ROWID values can change, but PK values cannot be changed or altered. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Jay A. Kreibich
actually surprises me, since I was under the impression CREATE TABLE ... AS SELECT always produced NONE affinities. Is this a semi-recent (last year) change? -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that yo

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Jay A. Kreibich
hat to do with it. If you read that SQL into any other database, all best are off, and this is the very least of your compatibility concerns. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Jay A. Kreibich
s like it has been there, in some form, for some time. I suspect I'm mis-remembering a big discussion from some months ago about why a generated table that uses a numeric expression doesn't have numeric columns, or something like that. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-30 Thread Jay A. Kreibich
ults. Your concerns about PKs and FKs don't even come into play, as they can't happen-- even within the same implementation. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has th

Re: [sqlite] Bug with commandline option -csv and -separator

2010-07-01 Thread Jay A. Kreibich
de csv sqlite> select * FROM t; 1,2,3 sqlite> Basically, the "mode" operators may set the separator. It wouldn't really be a *C*SV output if it didn't. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that y

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-07-01 Thread Jay A. Kreibich
er is 'INT.' -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson

Re: [sqlite] How to determine when to VACUUM?

2010-07-06 Thread Jay A. Kreibich
nt for somewhat large databases that have a high flux. Overall, I tend to manually VACUUM files when I delete something very large, or when roughly 40% of the contents have changed. I've never done it in code. There are many applications that use utility databases (prefs, configs, and even docu

Re: [sqlite] Import all tables from one db file to another

2010-07-06 Thread Jay A. Kreibich
empt to copy the data with an INSERT...SELECT command. This usually only works with simple tables, however, and gets messy with indexes, foreign keys, and other constraints. If you really want to see how to do it, look at the code for VACUUM. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread Jay A. Kreibich
quot;d" in these statements? Without looking at the docs? Do you think most programmers do? Do you think they usually get it "right" ? int i, d; sscanf( "0123", "%i", ); sscanf( "0123", "%d", ); -j -- Jay A. Kreibich

Re: [sqlite] Getting declared datatype of a column in C

2010-07-07 Thread Jay A. Kreibich
lt-set column is a direct column reference, and only if SQLite is compiled to handle meta-data. Declared types are fairly unimportant in SQLite. They don't mean much. Most applications never need to deal with them. -j > On 07/07/10 04:41, Jay A. Kreibich wrote: > > On Tue, Jul

Re: [sqlite] Getting declared datatype of a column in C

2010-07-07 Thread Jay A. Kreibich
For example, these will both insert the same three bytes (ASCII 'A' = 0x41): X'414243'is a BLOB value. 'ABC' is a text value. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but show

Re: [sqlite] How to determine when to VACUUM?

2010-07-07 Thread Jay A. Kreibich
in size, the database lifespan is significant, and the database will be subjected to an extremely high amount of flux and row thrashing. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to th

Re: [sqlite] Books which cover C API

2010-07-07 Thread Jay A. Kreibich
o SQLite" by Mike Owens. It is a bit older, but the core APIs haven't really changed: http://www.amazon.com/Definitive-Guide-SQLite-Mike-Owens/dp/1590596730/ This one is coming out next month. I like it. http://www.amazon.com/Using-SQLite-Jay-Kreibich/dp/0596521189/ -j -- Jay A. Kre

Re: [sqlite] Which SQLite API return SQLITE_BUSY?

2010-07-08 Thread Jay A. Kreibich
k that's the bulk of it, however. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson _

Re: [sqlite] Getting declared datatype of a column in C

2010-07-08 Thread Jay A. Kreibich
s in it, you can also just keep asking for BLOBs. SQLite will covert them using the rules defined here: http://sqlite.org/c3ref/column_blob.html -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing

Re: [sqlite] WAL questions

2010-07-08 Thread Jay A. Kreibich
ses newer APIs not working on an older version of the OS. If you want the ability to do this, don't use new features (or turn it off every time you close the database). -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you

Re: [sqlite] Temp views and sqlite_temp_master

2010-07-08 Thread Jay A. Kreibich
s been fixed? Not if you understand how it works. Not fixing what isn't broken. > Letter c) makes me wonder: is there is a way to reference both views? As others have answered, just qualify the identifier with a database name. -j -- Jay A. Kreibich < J A Y @ K R

Re: [sqlite] WAL questions

2010-07-08 Thread Jay A. Kreibich
ven more sense to have "PRAGMA wal=[on|off]" or "PRAGMA transaction=[wal|journal]" ? > Other suggestions? This has nothing to do with WAL, but it might be nice to expose the logic that does SQL-type => SQLite-affinity mappings (i.e. sqlite3AffinityType()): int

Re: [sqlite] WAL questions

2010-07-08 Thread Jay A. Kreibich
On Thu, Jul 08, 2010 at 08:06:23PM +0400, Alexey Pechnikov scratched on the wall: > 2010/7/8 Jay A. Kreibich <j...@kreibi.ch> > > > > It's not helpful for backward compability. How about version downgrade of > > > the Android or some other mobile OS and as result i

Re: [sqlite] Retrieve Specific record number in one shot.

2010-07-09 Thread Jay A. Kreibich
ill return rows 211 through 420. If you want row 210, you need "LIMIT 1 OFFSET 209". Or "LIMIT 209, 1" -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wr

Re: [sqlite] Null character problem

2010-07-09 Thread Jay A. Kreibich
This causes a problem because sprintf stops printing when it > encounters ?null?. Don't do that. Use statement parameters and bind the data directly. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that

Re: [sqlite] restricting values allowed in a column

2010-07-11 Thread Jay A. Kreibich
K constraint. > Since that table/column exists today without any restrictions, how > do I alter it to restrict the values entered? You can't. You need to build a new table and copy the data over. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like u

Re: [sqlite] restricting values allowed in a column

2010-07-11 Thread Jay A. Kreibich
On Sun, Jul 11, 2010 at 09:12:09AM -0500, Jay A. Kreibich scratched on the wall: > On Sun, Jul 11, 2010 at 01:45:50PM +, c...@comcast.net scratched on the > wall: > > > I would like to restrict the values that are entered into > > the "recommendation" colu

Re: [sqlite] binding an IN

2010-07-11 Thread Jay A. Kreibich
you're looking for. There is no general-purpose way of doing this that can be used for different size lists. You can have different statements with different numbers of parameters, but each statement parameter can represent only one value. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C

Re: [sqlite] restricting values allowed in a column

2010-07-11 Thread Jay A. Kreibich
place to lookup the possible choices, which is useful for building drop-down menus, etc. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them fee

Re: [sqlite] restricting values allowed in a column

2010-07-11 Thread Jay A. Kreibich
On Sun, Jul 11, 2010 at 02:15:09PM -0400, Igor Tandetnik scratched on the wall: > Jay A. Kreibich <j...@kreibi.ch> wrote: > > You can't add a CHECK constraint to an existing table. > > You should be able to do it by directly updating sqlite_master table: > >

Re: [sqlite] update trigger to require input

2010-07-11 Thread Jay A. Kreibich
set." You can make the column NOT NULL with no DEFAULT. You can also add a CHECK constraint to make sure the string isn't empty. If you do it with triggers instead, make sure you create both update and insert triggers. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H &g

Re: [sqlite] EXTERNAL: binding an IN

2010-07-12 Thread Jay A. Kreibich
for example, 2, 4, 8, 16, etc., parameters. Find the one that fits what you need, and bind NULLs to the end (or just call sqlite3_clear_bindings()). NULL IN ( NULL ) returns NULL, but ( NULL IN ( NULL ) IS 1 ) will return 0. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H >

Re: [sqlite] How is the table getting locked and how to unlock it?

2010-07-12 Thread Jay A. Kreibich
ocess has it open. Are you using sqlite3_exec() for all of these? My first guess is that you're not finalizing the INSERT statement (or allowing it to run to completion) before trying to drop the table. You can't drop a table if there are any in-progress statements. -j -- Jay A. Kre

Re: [sqlite] How is the table getting locked and how to unlock it?

2010-07-12 Thread Jay A. Kreibich
On Mon, Jul 12, 2010 at 12:00:40PM -0400, Sam Carleton scratched on the wall: > On Mon, Jul 12, 2010 at 10:36 AM, Jay A. Kreibich <j...@kreibi.ch> wrote: > > > > > Are you using sqlite3_exec() for all of these? My first guess is that > > you're not finalizing the

Re: [sqlite] Case insensitive join available?

2010-07-14 Thread Jay A. Kreibich
A join B on A.a=B.a; Replace "A.a=B.a" with "A.a COLLATE NOCASE = B.a" -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them

Re: [sqlite] Sqlite Insert Speed Optimization

2010-07-14 Thread Jay A. Kreibich
ial... which means there are really good reasons why it isn't there. There is a really big gun right here (3.6.23.1): $ grep -n \"-journal\" sqlite3.c 35406:memcpy(>zJournal[nPathname], "-journal", 8); You're not finding "db-journal" because the "db" comes from your

Re: [sqlite] SQLITE_CANTOPEN returned from sqlite3_step

2010-07-15 Thread Jay A. Kreibich
ht try keeping temp files in memory. See: "PRAGMA temp_store = memory" -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tende

Re: [sqlite] Removing duplicate entries from a database

2010-07-15 Thread Jay A. Kreibich
rimary key. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson __

Re: [sqlite] How much a table takes (will this query always work)

2010-07-16 Thread Jay A. Kreibich
This technique defragements and re-packs the pages, not unlike the VACUUM command. It should give you pretty good numbers for the VACUUMed size, but not for the current size. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is im

Re: [sqlite] working with a many-to-many relationship

2010-07-18 Thread Jay A. Kreibich
. >     If so, how do I specify that? CREATE TABLE a_b_link ( a_id INTEGER NOT NULL REFERENCES a( _id ), b_id INTEGER NOT NULL REFERENCES b( _id ), PRIMARY KEY ( a_id, b_id ) ); The PK will make an index over a_b_link(a_id,b_id). Chances are good you'll also want an

Re: [sqlite] create one index on multiple columns or create multiple indexes, each of which is on one column?

2010-07-18 Thread Jay A. Kreibich
inted out, the first one can also utilize an index, while the second one cannot. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people

Re: [sqlite] EXTERNAL:Re: VFS Layer for to split database into several files?

2010-07-19 Thread Jay A. Kreibich
rt >2GB as long as > you have the disk space. -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson __

Re: [sqlite] VFS Layer for to split databaseinto several files?

2010-07-19 Thread Jay A. Kreibich
a tad bit ugly, but less so than modifying the default VFS. I'd be very concerned about locking under NFSv2 as well. You might look into dot-locking instead. NFSv2 has no locking. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it

Re: [sqlite] ATTACH DATABASE with connection pooling

2010-07-19 Thread Jay A. Kreibich
quot;Using SQLite" wraps PRAGMA database_list in a virtual table so that you can do just this. Of course, it calls PRAGMA database_list interally, so it isn't any faster than doing it yourself. http://www.amazon.com/Using-SQLite-Jay-Kreibich/dp/0596521189/ (Next month!) -j -- J

Re: [sqlite] suggestion: bitwise shift right optimization

2010-07-20 Thread Jay A. Kreibich
s don't even use binary integers to store natural-number values. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel unco

Re: [sqlite] how to retrieve the result of an sqlite_exec()

2010-07-20 Thread Jay A. Kreibich
were you expecting the result to show up? > It should be faster to name a specific column rather than use '*': Definitely not, for many reasons. It may not even provide the same answer. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwea

Re: [sqlite] VACUUM not reclaiming space

2010-07-27 Thread Jay A. Kreibich
ould be expected behavior. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson

Re: [sqlite] choosing an installation

2010-07-31 Thread Jay A. Kreibich
sume you could also strip out the Tcl bindings, build them as a different library (dependent on a generic sqlite3.so build), and just link everything that way. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you

Re: [sqlite] crypt() as SQL core function

2010-07-31 Thread Jay A. Kreibich
u just want to expose the the system crypt() function to the SQL environment, that's a 15 minute project. Maybe an hour if you've never written a custom SQL function before. Package it all up into an extension, and you can drop it into any environment, no patches required. -j -- J

Re: [sqlite] crypt() as SQL core function

2010-08-01 Thread Jay A. Kreibich
-j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson ___ sql

Re: [sqlite] crypt() as SQL core function

2010-08-02 Thread Jay A. Kreibich
think that's a good compromise. While it is a somewhat standard function in many database systems, it is also an oddball that most people don't use. As such, it is there if you need it, but the majority of people will never notice it isn't there by default. -j -- Jay A. Kreibich &

Re: [sqlite] list table structure

2010-08-02 Thread Jay A. Kreibich
it in Oracle. http://www.sqlite.org/faq.html#q7 -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson

Re: [sqlite] list table structure

2010-08-02 Thread Jay A. Kreibich
On Mon, Aug 02, 2010 at 11:21:12AM -0500, Jay A. Kreibich scratched on the wall: > On Mon, Aug 02, 2010 at 11:11:25AM -0500, Chris Hare scratched on the wall: > > I read on the SQLite how to get the list of tables in the SQLite database. > > > > How do I get the table

Re: [sqlite] threading error in sqlite 3 in python

2010-08-04 Thread Jay A. Kreibich
On Wed, Aug 04, 2010 at 01:00:02PM -0500, Chris Hare scratched on the wall: > How do I figure out what version of sqlite3 is actually installed > in the python install? (It is python2.6) If it isn't too old: SELECT sqlite_version(); -j -- Jay A. Kreibich < J A Y @ K R E

Re: [sqlite] copying only new rows from one table to another

2010-08-06 Thread Jay A. Kreibich
I don't actually know, however. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson ___

Re: [sqlite] Is there a table that show all the available function from sqlite3?

2010-08-13 Thread Jay A. Kreibich
As far as I know, there is no way to extract the current function list. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel unco

Re: [sqlite] Why the deadlock?

2010-08-19 Thread Jay A. Kreibich
the connection, not the statements, so two statements using the same connection can never deadlock. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the

Re: [sqlite] Can we get a pragma for SQLITE_FCNTL_CHUNKS_SIZE?

2010-08-20 Thread Jay A. Kreibich
s around with every write (including writes to existing space in existing files) to spread out the write cycles. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tende

Re: [sqlite] Can we get a pragma for SQLITE_FCNTL_CHUNKS_SIZE?

2010-08-20 Thread Jay A. Kreibich
or issue. One of the "how to write a custom SQL function" examples in "Using SQLite" builds a wrapper around sqlite3_limit(). I know people that are not using the C interface are faced with additional challenges when it comes to loading extensions or modifying the core SQLite lib

Re: [sqlite] partial index?

2010-08-20 Thread Jay A. Kreibich
r not. My personal opinion is that this is a unique enough feature, and workarounds exist (even if they aren't exactly pretty), that it does not justify the long-term testing and upkeep costs. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it

Re: [sqlite] Better way to export sqlite3 data than pipe?

2010-08-23 Thread Jay A. Kreibich
On Mon, Aug 23, 2010 at 08:09:51AM -0500, Peng Yu scratched on the wall: > Hi, > > Since I don't find a command that can directly export the data into a > file, I use pipe to export data from sqlite3 to a tsv file. Is there a > better way to do so?A See ".output "

[sqlite] "Using SQLite" - O'Reilly Deal of the Day

2010-08-24 Thread Jay A. Kreibich
ot;. Once purchased, the book can be downloaded in DRM-free PDF, Mobi, and ePub. http://oreilly.com/ (upper right corner) http://oreilly.com/catalog/9780596521189/ O'Reilly, Amazon, and other vendors also have the print version in stock: Amazon ($44.99): http://www.amazon.com/Usi

Re: [sqlite] database writes by multiple processes (on a very old computer)

2010-08-24 Thread Jay A. Kreibich
is working on. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson ___

Re: [sqlite] Parameters in views preparation

2010-08-26 Thread Jay A. Kreibich
saved in the file, > >> they're not part of the attachment. > > > > Yes it does > > So you are trying to create a VIEW which does already exist. In that > case, there's no mystery about why you're getting an error message. No, he's trying the *PREPARE* a CREATE VIEW

Re: [sqlite] Parameters in views preparation

2010-08-26 Thread Jay A. Kreibich
On Thu, Aug 26, 2010 at 11:59:03AM -0400, Igor Tandetnik scratched on the wall: > Jay A. Kreibich <j...@kreibi.ch> wrote: > >> So you are trying to create a VIEW which does already exist. In that > >> case, there's no mystery about why you're getting an error message

<    1   2   3   4   5   6   7   8   9   10   >