Re: [sqlite] import in sqlite

2006-07-24 Thread sandhya
Hi, Can you please explain me..How it is Possible? Like Is there any API which accepts a file name given and load into DB or we have to do it i mean getting the length of the file to load into DB and at the DB side how we should do this. How it will store in DB?Any ObjID it will give or

[sqlite] locked implies exception?

2006-07-24 Thread Xavier Noria
I am trying to understand a crash I get very often. There are two processes accessing to the same database in a Windows XP (through Active Record) doing simple CRUDs on tables, and from any of the two at random I get an SQLite3::BusyException, for example (copied by hand):

[sqlite] Handling files in sqlite db

2006-07-24 Thread sandhya
Hi, Can anybody help me. Is there any possibility to import files from the local file system and storing in sqlite DB.And Is there any export option just to check whether the loaded file into a table consists of same data as the original file or not. Like, Is there any API which accepts a

Re: [sqlite] locked implies exception?

2006-07-24 Thread Xavier Noria
On Jul 24, 2006, at 11:47, Xavier Noria wrote: The processes use transactions, Not necessarily. Could it have to do with AR asking for metadata about the schema? Just an idea.

Re: [sqlite] locked implies exception?

2006-07-24 Thread Cory Nelson
On 7/24/06, Xavier Noria <[EMAIL PROTECTED]> wrote: I am trying to understand a crash I get very often. There are two processes accessing to the same database in a Windows XP (through Active Record) doing simple CRUDs on tables, and from any of the two at random I get an SQLite3::BusyException,

[sqlite] selecting rows of the view via its position

2006-07-24 Thread hanno
Hello alltogether! How can I select the predecessor or successor of a current row for comparing values? - without explicit ids on the view! (I think ids don't work for views?) Or if ids are possible, how are they implemented and can I create ID-Counters groupwise for blocks of a table?? thanks

[sqlite] reg:blob files

2006-07-24 Thread sandhya
Hi all, I need to load all file like .jpg,.gif,.asp,.txt,.gz etc in to the database.How the structure of my Table should be?What datatype it will be of?( I mean,say in Postgresql it is of type Oid...)Likewise,in Sqlite what datatype it is? Whether it stores as Large Objects or some

Re: [sqlite] Handling files in sqlite db

2006-07-24 Thread Teg
Hello sandhya, I use SQLite DB's with JPG and PNG files in them. I create a MD5 hash of the file before insertion and use the hash as the primary key in both the information table (about the files) and the blob table that contains the files themselves. If you have a file on disk and do the hash,

[sqlite] Altering a table when field(column) names are unknown

2006-07-24 Thread John Newby
http://www.sqlite.org/faq.html#q13 Hi, the above link goes to an FAQ on the SQLite website stating that the ALTER TABLE command has limited functionality and recommends creating a temp table and copying everything there, dropping the original table, re-creating it with the desired changes and

Re: [sqlite] sqlite3_prepare = SQLITE_BUSY????

2006-07-24 Thread drh
Daniel van Ham Colchete <[EMAIL PROTECTED]> wrote: > > I was trying to understand why would a sqlite3_prepare return > SQLITE_BUSY. If SQLite does not already have the database schema loaded into cache, it needs to read the schema out of the SQLITE_MASTER table before it can prepare the new SQL

Re: [sqlite] Altering a table when field(column) names are unknown

2006-07-24 Thread Martin Jenkins
This is all good when the fields(columns) are known in advance, but how would I attempt doing this without knowing the name of the fields? You need to recast your problem into one where the field names ARE known. ;) Just issue a "pragma table_info(table_name)" as shown below in an sqlite

[sqlite] write/read from BLOB

2006-07-24 Thread Kiril Dzolev
Hello, I just started with SQLite couple a days before so I am new and without any experience. My database have only two columns. First column for the Key and other must be a binary data (binary data contains some float or integer numbers). So the question is how to write/read a binary data...

Re: [sqlite] Handling files in sqlite db

2006-07-24 Thread Jay Sprenkle
On 7/24/06, sandhya <[EMAIL PROTECTED]> wrote: Hi, Can anybody help me. Is there any possibility to import files from the local file system and storing in sqlite DB.And Is there any export option just to check whether The file system is designed to manipulate files. A database is

Re: [sqlite] selecting rows of the view via its position

2006-07-24 Thread Jay Sprenkle
How can I select the predecessor or successor of a current row for comparing values? - without explicit ids on the view! (I think ids don't work for views?) Or if ids are possible, how are they implemented and can I create ID-Counters groupwise for blocks of a table?? What does your schema look

Re: [sqlite] locked implies exception?

2006-07-24 Thread Jay Sprenkle
On 7/24/06, Xavier Noria <[EMAIL PROTECTED]> wrote: I am trying to understand a crash I get very often. There are two processes accessing to the same database in a Windows XP (through Active Record) doing simple CRUDs on tables, and from any of the two at random I get an SQLite3::BusyException,

Re: Re[2]: [sqlite] Help me in SQL

2006-07-24 Thread Jay Sprenkle
On 7/23/06, blins <[EMAIL PROTECTED]> wrote: Hi Jay, Friday, July 21, 2006, 7:05:59 PM, you wrote: JS> Can you change the alias to a different field name than the source tables? I try: select t1.field1 as otherfield1, t2.field2 as otherfield2 from table1 t1 left join table2 t2 on

[sqlite] Getting callback with an INSERT

2006-07-24 Thread Olaf Beckman Lapré
Is it possible to get a callback when doing an INSERT on a table similar to a SELECT callback? The callback would then contain the same parameters but only contain the row(s) being inserted. The reason I'm asking is that this may be usefull in GUI applications where you insert table rows into

Re: [sqlite] locked implies exception?

2006-07-24 Thread Martin Jenkins
Jay Sprenkle wrote: what's a CRUD? I wondered that too. http://en.wikipedia.org/wiki/CRUD_(acronym) Martin

Re: [sqlite] Temp dir

2006-07-24 Thread Jay Sprenkle
On 7/21/06, chtaylo3 <[EMAIL PROTECTED]> wrote: >Set the global variable sqlite3_temp_directory to any >directory you want and it tries that directory first. Ok, fair enough. But why do you try and open the directory? Why can you just try and create the tmp file there and deal with it if

Re: [sqlite] selecting rows of the view via its position

2006-07-24 Thread hanno
Hello Jay! My example schema describes positions on a chessboard. I am aiming to make the neighbourhood relation explicit. From the line/row sorted view I want to associate to each entry the predecessors row value as northern bound of horizon and the successors as the southern bound. I'd like to

RE: [sqlite] Temp dir

2006-07-24 Thread chtaylo3
>/tmp : Temporary files >/var/tmp : Temporary files preserved between system reboots What does this have to do with having the tmp dir's as global read? Mandriva 2006 has a daemon (not sure what the name is) that checks the permissions of certain folders, in this case /var/tmp, usr/tmp, and

Re: [sqlite] Is BETWEEN faster than comparison operators?

2006-07-24 Thread Jay Sprenkle
On 7/23/06, Hartwig Wiesmann <[EMAIL PROTECTED]> wrote: Hello, I have read somewhere that BETWEEN is faster than the equivalent expression using comparison operators. Example: ... WHERE Column BETWEEN 1 AND 10 compared with ...WHERE Column >= 1 AND Column <= 10 between is definitely

Re: [sqlite] write/read from BLOB

2006-07-24 Thread Nuno Lucas
Just "bind" your data using prepared statements. You can pass null characters inside. Another option is to use the X'0011223344' syntax to insert binary data in hexadecimal format (you can retrieve it in the same format by using the "quote" function). Regards, ~Nuno Lucas On 7/24/06, Kiril

Re: [sqlite] Temp dir

2006-07-24 Thread Jay Sprenkle
On 7/24/06, chtaylo3 <[EMAIL PROTECTED]> wrote: >/tmp : Temporary files >/var/tmp : Temporary files preserved between system reboots What does this have to do with having the tmp dir's as global read? It's important that the journal file be preserved between reboots. If the power fails you

RE: [sqlite] Temp dir

2006-07-24 Thread chtaylo3
Christian, > >Or you could just fix the permissions on your temp directories. If the >files in */tmp are sensitive, they should be protected. The file name >themselves should not be sensitive. > >I'm not aware of many installations using the permissions you use for temp >directories. Yes that

Re: [sqlite] locked implies exception?

2006-07-24 Thread Jay Sprenkle
> what's a CRUD? I wondered that too. http://en.wikipedia.org/wiki/CRUD_(acronym) Martin Thanks :)

Re: [sqlite] Retrieving ROWID value on duplicate conflict

2006-07-24 Thread Dennis Cote
Naveen Nathan wrote: On a duplicate entry/conflict I would like to retrieve the rowid of the conflicting entry; by possibly updating columns, or replacing the row entirely while ensuring the rowid doesn't change. On an INSERT OR REPLACE it deletes the existing row and inserts the specified data

RE: [sqlite] Temp dir

2006-07-24 Thread chtaylo3
Jay, >It's important that the journal file be preserved between reboots. >If the power fails you can then recover the database using the journal. >If your code has to go on one of the linuxes(linuxii??) >that follow posix/LSG standards you'll want to know how to make >it work correctly on those

Re: [sqlite] write/read from BLOB

2006-07-24 Thread Kiril Dzolev
Hello and thanks for quick reply, can you give an example how to bind my data using prepared statements. for example this data who is in diferent rows: Key binary_data 1-3.21e-4 2123 and how can I read the binary_data, for example,

Re: [sqlite] Temp dir

2006-07-24 Thread Jay Sprenkle
On 7/24/06, chtaylo3 <[EMAIL PROTECTED]> wrote: Jay, >It's important that the journal file be preserved between reboots. >If the power fails you can then recover the database using the journal. >If your code has to go on one of the linuxes(linuxii??) >that follow posix/LSG standards you'll want

Re: [sqlite] selecting rows of the view via its position

2006-07-24 Thread hanno
Hello Jay! Thank you very much for your help! Unluckily I can't get rowids on views. sqlite does not declare an error, when I select rowid, * on a view. - It just prints this column empty! The problem is, that I have to sort first and then the numbering. So I can't use the table rowids of the

Re: [sqlite] selecting rows of the view via its position

2006-07-24 Thread Jay Sprenkle
Thank you very much for your help! Unluckily I can't get rowids on views. sqlite does not declare an error, when I select rowid, * on a view. - It just prints this column empty! The problem is, that I have to sort first and then the numbering. So I can't use the table rowids of the base table.

Re: [sqlite] Getting callback with an INSERT

2006-07-24 Thread Dennis Cote
Olaf Beckman Lapré wrote: Is it possible to get a callback when doing an INSERT on a table similar to a SELECT callback? The callback would then contain the same parameters but only contain the row(s) being inserted. The reason I'm asking is that this may be usefull in GUI applications where

Re: [sqlite] Getting callback with an INSERT

2006-07-24 Thread Jay Sprenkle
On 7/24/06, Dennis Cote <[EMAIL PROTECTED]> wrote: You can do this by adding an insert trigger to your table and registering a user function that will call back to your code. create trigger t_in after insert on t begin select do_insert_callback(new.rowid); end; You will have to

Re: [sqlite] sqlite3_prepare = SQLITE_BUSY????

2006-07-24 Thread Xavier Noria
On Jul 24, 2006, at 14:49, [EMAIL PROTECTED] wrote: Daniel van Ham Colchete <[EMAIL PROTECTED]> wrote: I was trying to understand why would a sqlite3_prepare return SQLITE_BUSY. If SQLite does not already have the database schema loaded into cache, it needs to read the schema out of the

Re: [sqlite] Temp dir

2006-07-24 Thread drh
chtaylo3 <[EMAIL PROTECTED]> wrote: > Jay, > > >It's important that the journal file be preserved between reboots. > >If the power fails you can then recover the database using the journal. > >If your code has to go on one of the linuxes(linuxii??) > >that follow posix/LSG standards you'll want

Re: [sqlite] Getting callback with an INSERT

2006-07-24 Thread John Stanton
It hardly seems necessary to make it a callback since you could just call your function concurrently with the INSERT SQL. Olaf Beckman Lapré wrote: Is it possible to get a callback when doing an INSERT on a table similar to a SELECT callback? The callback would then contain the same parameters

Re: [sqlite] locked implies exception?

2006-07-24 Thread John Stanton
I used to have one but I had to shoot it when it went feral. Martin Jenkins wrote: Jay Sprenkle wrote: what's a CRUD? I wondered that too. http://en.wikipedia.org/wiki/CRUD_(acronym) Martin

RE: [sqlite] Temp dir

2006-07-24 Thread Christian Smith
chtaylo3 uttered: Christian, Or you could just fix the permissions on your temp directories. If the files in */tmp are sensitive, they should be protected. The file name themselves should not be sensitive. I'm not aware of many installations using the permissions you use for temp

Re: [sqlite] Altering a table when field(column) names are unknown

2006-07-24 Thread Clark Christensen
I have had success using: create temp table my_temp as select * from my_table; Of course, if you don't know the column names, it might be a challenge getting the data back into the new (altered) table. If all you need is to add a column, ALTER TABLE does a good job in later releases. I'm on

Re: [sqlite] selecting rows of the view via its position

2006-07-24 Thread hanno
Hello Jay! Assigning the ids outside sql wouldn't be neccessary because I could easily see the predecessor and successors. You are completely right, when you suggest a sql-external solution. For better understanding I should explain my situation a little. My real problem is, that I do all that

Re: [sqlite] selecting rows of the view via its position

2006-07-24 Thread Jay Sprenkle
On 7/24/06, hanno <[EMAIL PROTECTED]> wrote: Hello Jay! Assigning the ids outside sql wouldn't be neccessary because I could easily see the predecessor and successors. You are completely right, when you suggest a sql-external solution. For better understanding I should explain my situation a

[sqlite] test program won't run anymore! sqliteBtreeOpen: Assertion 'seizeof...

2006-07-24 Thread Keiichi McGuire
I wrote a simple test program and it is running into a problem. I previously wrote pretty simple c programs that interface with an sqlite file, but for some reason over the weekend the program won't want to run. Here's the code: #include #include #include"sqlite.h" int main() { sqlite *db;

Re: [sqlite] test program won't run anymore! sqliteBtreeOpen: Assertion 'seizeof...

2006-07-24 Thread Jay Sprenkle
On 7/24/06, Keiichi McGuire <[EMAIL PROTECTED]> wrote: test: ../sqlite-2.8.17/src/btree.c:702: sqliteBtreeOpen: Assertion 'sizeof(ptr)==sizeof(char*)' failed. Aborted Did you change compilers? Or compile the DLL on a different version than you compiled the test program?

Re: [sqlite] test program won't run anymore! sqliteBtreeOpen: Assertion 'seizeof...

2006-07-24 Thread Keiichi McGuire
nope, compiler is still the same (gcc). actually... i think i might have the answer. Might have jumped the gun on the question. I did install a version of sqlite that is for arm-linux, and that would be why it's not compiling. let me double check and I will post again :), sorry if it was a

Re: [sqlite] test program won't run anymore! sqliteBtreeOpen: Assertion 'seizeof...

2006-07-24 Thread Keiichi McGuire
nope, i was actually using the right sqlite, since the other one actually gave me an architecture error. any ideas? On 7/24/06, Keiichi McGuire <[EMAIL PROTECTED]> wrote: nope, compiler is still the same (gcc). actually... i think i might have the answer. Might have jumped the gun on the

Re: [sqlite] how to flush database to disk?

2006-07-24 Thread joe
On Jul 18, 2006, at 17:04 UTC, Dennis Cote wrote: > Can you repeat this test and reliably loose the data (i.e. is this a > repeatable failure)? If it is doing what you say it is, it should be > easy to reproduce. No, I had done the same thing many times and never lost data before. Also, of

RE: [sqlite] Temp dir

2006-07-24 Thread chtaylo3
>As I'm not familiar with >daemon, I can't comment further. What is this daemon? > I'm not usre about the name of it, but you can configure it with the Madriva Linux Control Center. Respectfully, Christopher

Re: [sqlite] how to flush database to disk?

2006-07-24 Thread Dennis Cote
[EMAIL PROTECTED] wrote: of course, it doesn't help that apparently I'm the only one on the planet that has ever observed this behavior. I'm quite sure that I didn't imagine it, however, as well as the several hours it took me to restore all that data from backups. Joe, This kind of

RE: [sqlite] Temp dir

2006-07-24 Thread chtaylo3
>SQLite opens the directory so that it can fsync() it. It >wants to fsync() the directory after creating the journal file >to make sure that the inode for the journal file gets created >and updated properly. > >Some unix filesystems guarantee that inodes always get updated >correctly. Others do

Re: [sqlite] selecting rows of the view via its position

2006-07-24 Thread Andrew Piskorski
On Mon, Jul 24, 2006 at 09:13:28AM -0700, hanno wrote: > > Hello Jay! > > Assigning the ids outside sql wouldn't be neccessary because I could > easily see the predecessor and successors. You are completely right, > when you suggest a sql-external solution. Do you mean that, you would like to

[sqlite] deductive relational databases Re: [sqlite] selecting rows of the view via its position

2006-07-24 Thread Andrew Piskorski
On Mon, Jul 24, 2006 at 09:13:28AM -0700, hanno wrote: > Subject: Re: [sqlite] selecting rows of the view via its position > My real problem is, that I do all that stuff for my diploma's thesis in > computerscience. I'm trying to show the abilities of relational datamodels > in a deductive

Re: [sqlite] selecting rows of the view via its position

2006-07-24 Thread hanno
Thank you Jay, thank you Andrew! @Andrew: I will check out the links you posted me about the new sql2003 features. - I'm not bound to sqlite, but till now I preferred it. Perhaps it's now time to check out something new. -- View this message in context:

Re: [sqlite] test program won't run anymore! sqliteBtreeOpen: Assertion 'seizeof...

2006-07-24 Thread Keiichi McGuire
Previously when I went into sqlite via command line I could not create a table, and I would get that same error message. So what I did was that I reinstalled sqlite, to a different directory so I can keep my other version to see if I can find any differences. The good thing is that the

Re: [sqlite] test program won't run anymore! sqliteBtreeOpen: Assertion 'seizeof...

2006-07-24 Thread Jay Sprenkle
On 7/24/06, Keiichi McGuire <[EMAIL PROTECTED]> wrote: Previously when I went into sqlite via command line I could not create a table, and I would get that same error message. So what I did was that I reinstalled sqlite, to a different directory so I can keep my other version to see if I can

Re: [sqlite] test program won't run anymore! sqliteBtreeOpen: Assertion 'seizeof...

2006-07-24 Thread Keiichi McGuire
I'm pretty sure my gcc is not broken (although I'm not sure how to check specifically for this problem). I can compile stuff with gcc without a problem as long as the sqlite stuff is not on there. -Keiichi On 7/24/06, Jay Sprenkle <[EMAIL PROTECTED]> wrote: On 7/24/06, Keiichi McGuire <[EMAIL

Re: [sqlite] Getting callback with an INSERT

2006-07-24 Thread Olaf Beckman Lapré
No, that's not the case since I'm using an AUTOINCREMENT key and I can't know the value of the key until the INSERT is completed. Olaf - Original Message - From: "John Stanton" <[EMAIL PROTECTED]> To: Sent: Monday, July 24, 2006 5:30 PM Subject: Re: [sqlite]

Re: [sqlite] test program won't run anymore! sqliteBtreeOpen: Assertion 'seizeof...

2006-07-24 Thread Peter Cunderlik
I'd try the following: 1. make completely sure you're linking against the correct SQLite library. Are you linking dynamically or statically? 2. turn all optimizations off (CFLAGS="" before running ./configure), compile, link and test your app. 3. grab the pre-configured SQLite sources

Re: [sqlite] Getting callback with an INSERT

2006-07-24 Thread John Stanton
Olaf Beckman Lapré wrote: No, that's not the case since I'm using an AUTOINCREMENT key and I can't know the value of the key until the INSERT is completed. Olaf - Original Message - From: "John Stanton" <[EMAIL PROTECTED]> To: Sent: Monday, July 24, 2006

Re: [sqlite] locked implies exception?

2006-07-24 Thread Martin Jenkins
John Stanton wrote: I used to have one but I had to shoot it when it went feral. As a puppy? mj Martin Jenkins wrote: Jay Sprenkle wrote: what's a CRUD? I wondered that too. http://en.wikipedia.org/wiki/CRUD_(acronym) Martin

[sqlite] 3-way join fails

2006-07-24 Thread Jonathan Ellis
Not sure what's wrong with this SQL; it works fine with postgresql: sqlite> SELECT * FROM books LEFT OUTER JOIN (users JOIN loans ON users.name= loans.user_name) ON books.id = loans.book_id; SQL error: no such column: loans.book_id The table definitions are as follows: CREATE TABLE books (

RE: [sqlite] Getting callback with an INSERT

2006-07-24 Thread Robert Simpson
> -Original Message- > From: John Stanton [mailto:[EMAIL PROTECTED] > Sent: Monday, July 24, 2006 2:14 PM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Getting callback with an INSERT > > Olaf Beckman Lapré wrote: > > No, that's not the case since I'm using an AUTOINCREMENT >

Re: [sqlite] 3-way join fails

2006-07-24 Thread Joe Wilson
SQLite is having trouble resolving loans.book_id without an alias... SELECT * FROM books LEFT OUTER JOIN ( select loans.book_id LBID from users JOIN loans ON users.name = loans.user_name ) ON books.id = LBID; --- Jonathan Ellis <[EMAIL PROTECTED]> wrote: > Not sure what's wrong with this

Re: [sqlite] 3-way join fails

2006-07-24 Thread Joe Wilson
this also works: SELECT * FROM books LEFT OUTER JOIN ( select book_id from users JOIN loans ON name = user_name ) ON id = book_id; --- Joe Wilson <[EMAIL PROTECTED]> wrote: > SQLite is having trouble resolving loans.book_id without an alias... > > SELECT * FROM books LEFT OUTER JOIN (

Re: [sqlite] 3-way join fails

2006-07-24 Thread Joe Wilson
--- Jonathan Ellis <[EMAIL PROTECTED]> wrote: > Not sure what's wrong with this SQL; it works fine with postgresql: > > sqlite> SELECT * FROM books LEFT OUTER JOIN (users JOIN loans ON users.name= > loans.user_name) ON books.id = loans.book_id; > SQL error: no such column: loans.book_id > > The

RE: [sqlite] locked implies exception?

2006-07-24 Thread Fred Williams
Good Grief! Everybody knows CRUD is what you clean off on US Navy ships at least once a week. > -Original Message- > From: John Stanton [mailto:[EMAIL PROTECTED] > Sent: Monday, July 24, 2006 10:32 AM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] locked implies exception? > > >

Re: [sqlite] 3-way join fails

2006-07-24 Thread Jonathan Ellis
Thanks, that is a good workaround. Is this a bug or a "feature?" On 7/24/06, Joe Wilson <[EMAIL PROTECTED]> wrote: SQLite is having trouble resolving loans.book_id without an alias... SELECT * FROM books LEFT OUTER JOIN ( select loans.book_id LBID from users JOIN loans ON users.name =