[sqlite] Copying the content of a table to another table

2007-06-04 Thread Kirrthana M
Hi all, I have created a table with two columns c1 and c2 and inserted some values into,in future i may include some additional columns c3,c4. to the same table.In tat case i should not loose my data in the current table,so i should be able to copy the content of the current

Re: [sqlite] baffled by dates

2007-06-04 Thread John Stanton
OK Sqlite doesn't have a date type, period. Just as it doesn't have other types, but don't let it it stop you from using dates very successfully with Sqlite by defining a date type and using the functionally built into the product. The Sqlite storage model plus its style of declared types is

[sqlite] Hashed Index proposed

2007-06-04 Thread Andrew Finkenstadt
I updated the Incompatible Changes page with an idea for using hashed-key indexes instead of b-tree indexes. exact-match retrievals could reduce the number of disk pages necessary to read to find the rowid from an average of Log(B)(n) (where B is the number of buckets per b-tree) to Log(2^B)(n).

Re: [sqlite] baffled by dates

2007-06-04 Thread Joe Wilson
--- John Stanton <[EMAIL PROTECTED]> wrote: > Sqlite does have a date format, it is physically a 64 bit floating point > number. There are functions to transform in and out of that format to > present dates as required by the user. The Sqlite date format uses a > magib epoch which matches all

[sqlite] SQLite and multiple process behavior

2007-06-04 Thread Jeff Nokes
Hi, I'm a little new to SQLite, but have been using it successfully for about 8 months, as a read only repository for application configuration parameters in my mod_perl based web application. I have recently added functionality to update the configuration tables I have, via the web interface.

Re: [sqlite] baffled by dates

2007-06-04 Thread John Stanton
Look at the date functions, the file date.c is self explanatory and lists the reference for the date type. The underlying type for a date is a float, so that may be how you missed the date details. P Kishor wrote: On 6/4/07, John Stanton <[EMAIL PROTECTED]> wrote: Sqlite does have a date

Re: [sqlite] sqlite function list?

2007-06-04 Thread John Stanton
Scott Baker wrote: Is there a list somewhere (I can't find it on the wiki) of all the functions (specifically math) functions that sqlite understands? I'm thinking things like: int, round, floor, ceil, sqrt etc. You have the source. They are all presented there and you can add more if you

Re: [sqlite] baffled by dates

2007-06-04 Thread John Stanton
Chris Fonnesbeck wrote: On 6/4/07, P Kishor <[EMAIL PROTECTED]> wrote: There is no "DATE" format in SQLite. Dates are stored as strings. The only formats SQLite knows and understands are TEXT, REAL, INTEGER, BLOB, and NULL (see the link on datatypes). On the other hand, there are built-in

Re: [sqlite] baffled by dates

2007-06-04 Thread P Kishor
On 6/4/07, John Stanton <[EMAIL PROTECTED]> wrote: Sqlite does have a date format, it is physically a 64 bit floating point number. If that is the case, I would love to see the documentation on that. As far as I can see, there are only TEXT, REAL, INTEGER, BLOB, NULL types supported. There

Re: [sqlite] extracting and comparing dates

2007-06-04 Thread John Stanton
We use declared types of DATE, TIMESTAMP and DATETIME and store dates as floating point using the Sqlite date conversion functions. The applications get dates formatted as ISO8601 or according to the declared locale. Functions do date artithmetic. Samuel R. Neff wrote: SQLite doesn't have

Re: [sqlite] baffled by dates

2007-06-04 Thread John Stanton
Sqlite does have a date format, it is physically a 64 bit floating point number. There are functions to transform in and out of that format to present dates as required by the user. The Sqlite date format uses a magib epoch which matches all of the major internaional date systems. P Kishor

Re: [sqlite] extracting and comparing dates

2007-06-04 Thread John Stanton
Chris Fonnesbeck wrote: I'm at a complete loss about how to work with dates in SQLite. The documentation doesnt seem to be helping me. I have a table with some date fields, in the proper -mm-dd format: sqlite> select First_Capture from PIT_manatees limit 5; 1997-6-17 1998-5-6 1997-6-24

Re: [sqlite] Re: Dropping updates after exiting application

2007-06-04 Thread Omar Eljumaily
OK, I think I found the problem. What I was doing was calling the following inappropriately (for the wrong statement): sqlite3_finalize(_stmt); I was doing it previous to the update calls. There was nothing wrong with the update calls. The problematic finalize was for a lookup. The

Re: [sqlite] Re: Dropping updates after exiting application

2007-06-04 Thread Will Leshner
On 6/4/07, Igor Tandetnik <[EMAIL PROTECTED]> wrote: One step is always enough for INSERT, UPDATE and DELETE as they don't produce a resultset. Only SELECT requires multiple steps, one for each row. I thought that might be the case. Thanks.

[sqlite] Re: Dropping updates after exiting application

2007-06-04 Thread Igor Tandetnik
Will Leshner <[EMAIL PROTECTED]> wrote: On 6/4/07, Omar Eljumaily wrote: qlite3_prepare_v2(con->_db, text.c_str(), text.size(), &_stmt, ); sqlite3_bind_text(_stmt, which, s.c_str(), s.size(), SQLITE_TRANSIENT); sqlite3_step(_stmt); Is one step enough to finish the operation? One step is

Re: [sqlite] Dropping updates after exiting application

2007-06-04 Thread Will Leshner
On 6/4/07, Omar Eljumaily <[EMAIL PROTECTED]> wrote: qlite3_prepare_v2(con->_db, text.c_str(), text.size(), &_stmt, ); sqlite3_bind_text(_stmt, which, s.c_str(), s.size(), SQLITE_TRANSIENT); sqlite3_step(_stmt); Is one step enough to finish the operation?

Re: [sqlite] Re: Dropping updates after exiting application

2007-06-04 Thread Omar Eljumaily
Igor Tandetnik wrote: Do you, by any chance, begin a transaction, perform the updates, then close the DB connection without committing the transaction (e.g. when exiting the app)? If you do this or something similar, the transaction gets rolled back. Igor Tandetnik This is what I have

[sqlite] Re: Dropping updates after exiting application

2007-06-04 Thread Igor Tandetnik
Omar Eljumaily wrote: "update mytable set name = 'newname' where id = 1" would propogate for the life of the application, then disappear after the app exits. Do you, by any chance, begin a transaction, perform the updates, then close the DB connection without committing the transaction

[sqlite] Dropping updates after exiting application

2007-06-04 Thread Omar Eljumaily
I have this problem where my application is is dropping updates after exiting my application. create mytable { int id primary key, name text }; Something like: "insert into mytable(name) values('myname')" would update properly. However "update mytable set name = 'newname' where id = 1"

Re: [sqlite] sqlite function list?

2007-06-04 Thread Trey Mack
Included functions: http://www.sqlite.org/lang_expr.html See the section "Core Functions" near the bottom of the page for the builtin functions. To add more: http://www.sqlite.org/contrib extension-functions.tgz for details on adding functions like ceil. - TM - Original Message -

RE: [sqlite] baffled by dates

2007-06-04 Thread Griggs, Donald
Hi Chris, I think you've seen Rich Shepard's reply, and emails crossed. But just in case you didn't: The sqlite date/time functions require input dates to contain a preceeding zero for month and day-of-month where needed to make them two digits. E.g., '2007-6-4' bad '2007-06-04'

[sqlite] Re: baffled by dates

2007-06-04 Thread Igor Tandetnik
Chris Fonnesbeck wrote: On 6/4/07, P Kishor <[EMAIL PROTECTED]> wrote: There is no "DATE" format in SQLite. Wow, thanks. So, why does this table creation work then, and not give an error? CREATE TABLE PIT_manatees(Manatee_Log INTEGER, Name text, First_Capture date, Recovered date, Coast

[sqlite] sqlite function list?

2007-06-04 Thread Scott Baker
Is there a list somewhere (I can't find it on the wiki) of all the functions (specifically math) functions that sqlite understands? I'm thinking things like: int, round, floor, ceil, sqrt etc. -- Scott Baker - Canby Telcom RHCE - System Administrator - 503.266.8253

Re: [sqlite] baffled by dates

2007-06-04 Thread Scott Baker
What you want is here: http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions I'm thinking you want: select First_Capture from PIT_manatees where date(First_Capture) < '2000-1-1' limit 5; - Scott Chris Fonnesbeck wrote: > I'm at a complete loss about how to work with dates in SQLite. The >

Re: [sqlite] baffled by dates

2007-06-04 Thread Chris Fonnesbeck
On 6/4/07, P Kishor <[EMAIL PROTECTED]> wrote: There is no "DATE" format in SQLite. Dates are stored as strings. The only formats SQLite knows and understands are TEXT, REAL, INTEGER, BLOB, and NULL (see the link on datatypes). On the other hand, there are built-in functions that can act on

Re: [sqlite] extracting and comparing dates

2007-06-04 Thread Rich Shepard
On Mon, 4 Jun 2007, Chris Fonnesbeck wrote: I'm at a complete loss about how to work with dates in SQLite. The documentation doesnt seem to be helping me. I have a table with some date fields, in the proper -mm-dd format: sqlite> select First_Capture from PIT_manatees limit 5; 1997-6-17

RE: [sqlite] extracting and comparing dates

2007-06-04 Thread Samuel R. Neff
SQLite doesn't have any internal notion of a date, only numbers or strings. You can choose to store dates as numbers and SQLite has some conversion functions to help you work with dates. Personally I store dates as strings. These are not properly formatted dates: 1997-6-17 1998-5-6 1997-6-24

Re: [sqlite] baffled by dates

2007-06-04 Thread P Kishor
There is no "DATE" format in SQLite. Dates are stored as strings. The only formats SQLite knows and understands are TEXT, REAL, INTEGER, BLOB, and NULL (see the link on datatypes). On the other hand, there are built-in functions that can act on your date strings and convert them back and forth,

[sqlite] baffled by dates

2007-06-04 Thread Chris Fonnesbeck
I'm at a complete loss about how to work with dates in SQLite. The documentation doesnt seem to be helping me. I have a table with some date fields, in the proper -mm-dd format: sqlite> select First_Capture from PIT_manatees limit 5; 1997-6-17 1998-5-6 1997-6-24 1998-5-6 2000-3-15 however,

[sqlite] extracting and comparing dates

2007-06-04 Thread Chris Fonnesbeck
I'm at a complete loss about how to work with dates in SQLite. The documentation doesnt seem to be helping me. I have a table with some date fields, in the proper -mm-dd format: sqlite> select First_Capture from PIT_manatees limit 5; 1997-6-17 1998-5-6 1997-6-24 1998-5-6 2000-3-15 however,

Re: [sqlite] No space left on device?

2007-06-04 Thread Nuno Lucas
On 6/4/07, Alberto Simões <[EMAIL PROTECTED]> wrote: What happens when no space is left on device? Does the process die, or does it try to store as much as it can using main memory? SQLite should return an error indicating it failed to write to disk and the reason indicates there is no space

[sqlite] No space left on device?

2007-06-04 Thread Alberto Simões
Hi What happens when no space is left on device? Does the process die, or does it try to store as much as it can using main memory? I'm asking this because I have a process dying (being killed) because it exauted main memory. Cheers Alberto -- Alberto Simões