[sqlite] Conditional table select

2007-05-04 Thread Vitali Lovich
Hi, I was wondering what would be the optimal way to select 1 matching row from multiple tables. Here is the scenario. Multiple tables contain a primary key KEY. If Table1 contains a matching KEY, then I want that row from Table1. Only if it isn't in Table1, then look in Table2 if it is t

Re: [sqlite] Conditional table select

2007-05-06 Thread Vitali Lovich
Dan Kennedy wrote: On Fri, 2007-05-04 at 18:22 -0400, Vitali Lovich wrote: Multiple tables contain a primary key KEY. If Table1 contains a matching KEY, then I want that row from Table1. Only if it isn't in Table1, then look in Table2 if it is there. If not in Table2 go on to Table3

Re: [sqlite] multiple databases

2007-09-19 Thread Vitali Lovich
I think you need to clarify your needs a bit, cause it seems somewhat confusing. So you have a wireless network, where all the nodes connect wirelessly to it. What is the database being used for? Is each node accessing and updating a local copy of some database (i.e. what other nodes it can

Re: [sqlite] Bug: Database connection closed on different thread

2007-10-04 Thread Vitali Lovich
I'm confused with your statement about threads. With multi-core multi-cpu machines becoming more prevalent on the desktop, seems to me that multi-threaded apps would provide better performance (obviously for specific problem sets). Also, don't apps that properly separate UI and background wor

Re: [sqlite] any way to SELECT the 100th-104th row of a table?

2007-10-07 Thread Vitali Lovich
The only way I can think of doing it without modifying the table (i.e. adding a rowid column that's updated on every delete) is to select all the rows on the table and then increment count for every step that returns a row. Adam Megacz wrote: Hello. This is probably a stupid question, but...

Re: [sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Vitali Lovich
Can you please clarify why this would be needed? Sqlite databases are opened by name, thereby you can use standard OS or stdlib functions to open the same file with a different handle. Cyrus Durgin wrote: i'm wondering if there's a "standard" way to get an open file handle from an sqlite3 poi

Re: [sqlite] how to get file handle from sqlite3 object?

2007-10-10 Thread Vitali Lovich
Two approaches - use sqlite, or use OS code. Use proper filesystem synchronization as appropriate for the given OS & filesystem, where you guarantee that your db copy is the only one that holds an exclusive lock. Then do the file copy and release the lock. The better approach, IMHO would be to

Re: [sqlite] In-memory database: manually modifying ROWID value increases memory.

2007-10-16 Thread Vitali Lovich
My question is how you're measuring the memory useage? Are you accounting for the space overhead of the various bookkeeping sqlite needs (i.e. master table)? The way you're creating you're table implies you're not using autoincrement for the integer field - are you accounting for the extra in

Re: [sqlite] Compact statement for table to table copy

2007-10-16 Thread Vitali Lovich
Well, you don't have to list the columns if you're not changing the ordering. INSERT INTO table1 SELECT * FROM table2; Rich Rattanni wrote: I have two tables in a database with exactly the same schema (idNum PRIMARY KEY, data1, data2) I want to copy all the records in table 2 to table 1, curr

Re: [sqlite] In-memory database: manually modifying ROWID value increases memory.

2007-10-17 Thread Vitali Lovich
? Memory measurement is done by sqlite3GenericMalloc using SQLITE_ENABLE_MEMORY_MANAGEMENT macro enabled. Calculating each allocation size gives total memory allocation. Thanks. On 10/17/07, Vitali Lovich <[EMAIL PROTECTED]> wrote: My question is how you're measuring the memory

Re: [sqlite] Compact statement for table to table copy

2007-10-19 Thread Vitali Lovich
Sorry - then I don't really know a syntactically shorter way On 10/17/07, Rich Rattanni <[EMAIL PROTECTED]> wrote: > > I am not changing the ordering, but i do not want to copy the primary > key field since it is auto increment (I neglected too mention that > before, sorry)

Re: [sqlite] installation of sqlite in linux

2008-03-04 Thread Vitali Lovich
debz wrote: > I have downloaded tclsqlite-3.5.6.so.gz(with tcl binding , i need tcl).I dont > know how to install.plz help. > > You should be able to either put it into a common system library path (i.e. /usr/lib) or set the environment variable LD_LIBRARY_PATH before invoking the program t

Re: [sqlite] Compiling sources for Coldfire embedded platform

2008-03-04 Thread Vitali Lovich
Actually, the correct way would be to do make CC=compilername, although for most situations it may produce the same effect. Also, SQLite uses autotools, so it's just a matter of doing CC=compilername ./configure. You can find more info using ./configure --help. Also, for cross-compilation, yo

Re: [sqlite] Two different DLLs linked statically to Sqlite and loaded in the same process

2008-03-04 Thread Vitali Lovich
From what I remember, an attempt at database compatibility is attempted across major revision numbers (i.e. all SQLite v2 revisions can read SQLite v2 databases, all SQLite v3 revisions can read SQLite v3 databases), but I can't remember. I don't believe it's generally recommended to be doing

[sqlite] Problem executing sqlite3_prepare command

2006-07-11 Thread Vitali Lovich
I'm trying to call the sqlite3_prepare command with the string 'CREATE TABLE $table ( $columns );'. It fails and the errmsg functions returns 'near "$table": syntax error'. I've tried using ? as well and I get the same message. What am I missing? Thanks

[sqlite] RE: Problem executing sqlite3_prepare command

2006-07-11 Thread Vitali Lovich
Never mind. I just realized (from rereading a previous newsgroup posting) that the wildcards can only be used to replace values within expressions (and not the table or column names).

Re: [sqlite] fast Java solution?

2006-07-17 Thread Vitali Lovich
My suggestion to speed up the step call backs would be to have the JNI code do the actual step routine and cache up the pertinent information into an array. Then after it's complete or the cache limit is reached (set the cache limit to a sufficient size such that the time spent processing that

[sqlite] Escaping wildcards when using LIKE & UTF-16

2006-10-12 Thread Vitali Lovich
I have a statement along the lines of: "SELECT * FROM table WHERE value LIKE :abc" I want to bind a UTF-16 string to abc - however, it can potentially contain % or _ - does sqlite provide any functionality for escaping these characters (I know I have to use the escape clause, but I still have

Re: [sqlite] Escaping wildcards when using LIKE & UTF-16

2006-10-13 Thread Vitali Lovich
dify the values I'm using to query). Dennis Cote wrote: Vitali Lovich wrote: I have a statement along the lines of: "SELECT * FROM table WHERE value LIKE :abc" I want to bind a UTF-16 string to abc - however, it can potentially contain % or _ - does sqlite provide any functionality

Re: [sqlite] Escaping wildcards when using LIKE & UTF-16

2006-10-13 Thread Vitali Lovich
values are simply bound). I was hoping that I could bypass figuring out the precise performance hit if I could figure out a clever way of doing this (right now sqlite only accounts for about 16% of the time spent). Thanks anyways Dennis Cote wrote: Vitali Lovich wrote: Maybe there's somet

Re: [sqlite] Escaping wildcards when using LIKE & UTF-16

2006-10-16 Thread Vitali Lovich
ile the query every time the fields needed changes (which for my purposes could potentially be never or rarely). It also allows me to use the = operator to ensure that the id3 tags match exactly. Dennis Cote wrote: Vitali Lovich wrote: Yeah, I know I can do that, and that's my backup option.

Re: [sqlite] Escaping wildcards when using LIKE & UTF-16

2006-10-16 Thread Vitali Lovich
This actually isn't really something that really has a user interface (at least not at the moment). sourceforge.net/projects/networkmedia for the little blurb - basically I'm working on a way of synchronizing disjoint music collections - i.e. music collection on laptop, music collection on mai

Re: [sqlite] Escaping wildcards when using LIKE & UTF-16

2006-10-16 Thread Vitali Lovich
Sorry.. Pressed send before completing the explanation. Most of the time is spent actually just creating the db representation of the library, which is a fairly significant amount of time - it's inserting at about 3-5 mp3 files per second into the DB, but that's only a profiled release build.

Re: [sqlite] number problem with 3.2.8

2006-10-25 Thread Vitali Lovich
I'm fairly certain that it's because when you're saying ring_time > '10', it's asking sqlite to take all strings that are greater than the string '10'. So all the numbers you presented are greater than 1. What you want is "where ring_time > 10". Notice the lack of quotes which means treat 10

Re: [sqlite] Re: How safe is sqlite3_prepare compared to sqlite3_exec?

2006-11-30 Thread Vitali Lovich
Regarding your code snippet: // SQL Statement is: "SELECT * FROM table WHERE name LIKE ?" search = '%test%'; sqlite3_bind_text(prepared_statement, 0,search , search , SQLITE_STATIC); First I'm not sure what language you're using - it seems Perl-like. Anyways, the documentation for http://www.s

Re: [sqlite] Re: How safe is sqlite3_prepare compared to sqlite3_exec?

2006-12-01 Thread Vitali Lovich
Try instead of "SELECT * FROM table WHERE name LIKE ?" as your sql query, "SELECT * FROM table WHERE name LIKE :comparison" Thomas Zangl wrote: Vitali Lovich schrieb: Regarding your code snippet: // SQL Statement is: "SELECT * FROM table WHERE nam

Re: [sqlite] shared-cache mode and firefox

2006-12-06 Thread Vitali Lovich
http://www.sqlite.org/sharedcache.html It's controlled at runtime by the function int sqlite3_enable_shared_cache(int); Thus that behaviour is probably controlled by Firefox (assuming it uses a version of sqlite with cache support compiled in). You'd have to ask them. Jay Sprenkle wrote: G

Re: [sqlite] db vs shell

2008-08-10 Thread Vitali Lovich
Careful when using time. The bash built-in called time times 1 shell statement (including pipes). The binary in /usr/bin/time only times the command given - it does not span pipes. [EMAIL PROTECTED] wrote: > On Tue, Jul 29, 2008 at 02:15:54AM -0500, Robert Citek wrote: > >> Are you sure tim