Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Pero Mirko
OK, I think I got it. Thank you both Igor and Simon for your kind answers! ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Porting a simple logon script to SQLite3 from MySQL

2011-10-05 Thread David Garfield
C Lindgren writes: > $sql=$db->exec("INSERT INTO users(ID,username,password) > VALUES > ('0','".$username."','".$password."')"); In MYSQL, null and 0 are magic for a INTEGER PRIMARY KEY AUTO_INCREMENT column. In SQLite,

Re: [sqlite] Big FLOAT bug

2011-10-05 Thread Kyle McKay
On October 5, 2011 08:59:14 PDT, Black, Michael (IS) wrote: Changing the 2 "15g" entries in sqlite3.c to "16g" corrects this problem. 15 digits is all that is guaranteed but the vast majority of 16-digit values are representable. Is this a valid solution? Or are there other side effects?

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Simon Slavin
On 5 Oct 2011, at 6:40pm, Pero Mirko wrote: > So in other words a pseudo function like this: > > BEGIN EXCLUSIVE > if anyerror return > INSERT INTO [table] > if anyerror ROLLBACK > INSERT INTO [table] > if anyerror ROLLBACK > UPDATE [table] > if anyerror ROLLBACK > UPDATE [table] > if anyerror

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Igor Tandetnik
On 10/5/2011 1:40 PM, Pero Mirko wrote: So in other words a pseudo function like this: BEGIN EXCLUSIVE if anyerror return INSERT INTO [table] if anyerror ROLLBACK INSERT INTO [table] if anyerror ROLLBACK UPDATE [table] if anyerror ROLLBACK UPDATE [table] if anyerror ROLLBACK COMMIT if anyerror

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Pero Mirko
So in other words a pseudo function like this: BEGIN EXCLUSIVE if anyerror return INSERT INTO [table] if anyerror ROLLBACK INSERT INTO [table] if anyerror ROLLBACK UPDATE [table] if anyerror ROLLBACK UPDATE [table] if anyerror ROLLBACK COMMIT if anyerror ROLLBACK return Would that guarantee

Re: [sqlite] Porting a simple logon script to SQLite3 from MySQL

2011-10-05 Thread C Lindgren
Quoting Stephan Beal : On Wed, Oct 5, 2011 at 6:56 PM, C Lindgren wrote: if (isset ($_post ['submit'] )) { Aside from this use of POST being a huge security hole, $_post is spelled wrong: it whould be $_POST (or $_REQUEST if you want to treat

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Simon Slavin
On 5 Oct 2011, at 5:42pm, Pero Mirko wrote: > Furthermore doing something like: > BEGIN EXCLUSIVE > INSERT OR ROLLBACK INTO table > INSERT OR ROLLBACK INTO table > INSERT OR ROLLBACK INTO table > COMMIT > > also doesn't make sense - because if first insert is successful and second > is not it

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Igor Tandetnik
On 10/5/2011 12:42 PM, Pero Mirko wrote: and then it fails - will the database insert / update / delete first 10 or will it return to initial state before any inserts? The default behavior is ABORT, which means the statement that caused the error is rolled back, but the transaction stays

Re: [sqlite] Porting a simple logon script to SQLite3 from MySQL

2011-10-05 Thread Simon Slavin
On 5 Oct 2011, at 5:56pm, C Lindgren wrote: > I'm trying to port a simple logon script that was originally for MySQL to > SQLite3. MySQL uses connections to a server with a password. SQLite accesses a file on a hard disk. Make sure your web app (probably apache or httpd) has enough access

Re: [sqlite] Porting a simple logon script to SQLite3 from MySQL

2011-10-05 Thread Stephan Beal
On Wed, Oct 5, 2011 at 6:56 PM, C Lindgren wrote: > if (isset ($_post ['submit'] )) { Aside from this use of POST being a huge security hole, $_post is spelled wrong: it whould be $_POST (or $_REQUEST if you want to treat GET/POST the same). >

[sqlite] Porting a simple logon script to SQLite3 from MySQL

2011-10-05 Thread C Lindgren
I'm trying to port a simple logon script that was originally for MySQL to SQLite3. Everything seems to work but won't post data to the database and won't return the else statements if no data is entered or "user added" when submitted. New and trying to learn PDO with SQLite3... Can

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Pero Mirko
> > >and then it fails - will the database insert / update / delete first 10 or > >will it return to initial state before any inserts? > >The default behavior is ABORT, which means the statement that caused the error is rolled back, but the transaction stays open with any prior changes still in

Re: [sqlite] Big FLOAT bug

2011-10-05 Thread Black, Michael (IS)
Changing the 2 "15g" entries in sqlite3.c to "16g" corrects this problem. 15 digits is all that is guaranteed but the vast majority of 16-digit values are representable. Is this a valid solution? Or are there other side effects? Before change: sqlite> create table t (a float); sqlite> insert

Re: [sqlite] Big FLOAT bug

2011-10-05 Thread yary
Thought it was a little odd to have the "a=" in the select side and not the where clause, but I see where you are going with this. The real doesn't survive the roundtrip exactly unchanged, apparently, though it looks like it does. sqlite> select a, cast(a as text), cast(cast(a as text) as float)

[sqlite] Big FLOAT bug

2011-10-05 Thread Wiktor Adamski
SQLite version 3.7.8 2011-09-19 14:49:19 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table t(a float); sqlite> insert into t values(1125899906842624); sqlite> select a = cast(cast(a as text) as float) from t; 0 Yes, I know - 16 digits. But

Re: [sqlite] ensuring uniqueness of tuples spanning across multipletables?

2011-10-05 Thread Jim Morris
The recent thread may relate: "[sqlite] Is there an efficient way to insert unique rows (UNIQUE(a, b, c)) into an fts3 virtual table?" INSERT INTO fts3_table (a,b,c) SELECT 'an A','a B','a C' WHERE NOT EXISTS (SELECT DISTINCT a,b,c FROM fts3_table WHERE a='an A' AND b='a B' AND c='a C'); The

Re: [sqlite] How do you check if a sqlite database is open?

2011-10-05 Thread James Brison
Thanks for the tips Roger. I'll use them to debug this Thanks James On Oct 4, 2011, at 11:23 PM, Roger Binns wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 10/04/2011 10:52 PM, James Brison wrote: >> Can you open a database twice without closing it? >

Re: [sqlite] Conversion of SQLite Database to MySql format

2011-10-05 Thread Donald Griggs
Hello, Alberto, Simon's initial reply was full of helpful facts, but I'm thinking he might have misread and you are asking about conversion in the opposite direction: I.e., from an sqlite database into a MySQL database (or perhaps just into MySQL-compatible text statements to perform an

Re: [sqlite] Conversion of SQLite Database to MySql format

2011-10-05 Thread Simon Slavin
On 5 Oct 2011, at 2:03pm, Swithun Crowe wrote: > Hard though it is to believe, the OP wants to go in the other direction. Hah ! I completely missed that. Thanks for pointing it out, sorry to the OP. Oh well, same tools, opposite directions. Use '.dump' instead of '.read' in the SQLite

Re: [sqlite] Conversion of SQLite Database to MySql format

2011-10-05 Thread Swithun Crowe
Hello SS> > I have a very large (600 mb) SQLite database file SS> > I'm trying to convert it to MySql (.sql) file format on a windows platform. SS> > Does anyone know of a free conversion utility? SS> Use any MySQL utility to dump the database as SQL commands into a text SS> file. On a Mac I

[sqlite] Is there an efficient way to insert unique rows (UNIQUE(a, b, c)) into an fts3 virtual table?

2011-10-05 Thread Adrian Aichner
Hi! Haven't been able to find a solution reading sqlite-users mailing list, http://www.sqlite.org/, nor googling at large. I need to insert rows with a unique column combination into a fts3 virtual table. http://www.sqlite.org/fts3.html states: "This is pure syntactic sugar, the supplied

Re: [sqlite] Conversion of SQLite Database to MySql format

2011-10-05 Thread Simon Slavin
On 4 Oct 2011, at 10:01pm, Alberto Larotonda wrote: > Hello. It was recommended to me that I ask for assistance on this mailing > list. > > I have a very large (600 mb) SQLite database file > I'm trying to convert it to MySql (.sql) file format on a windows platform. > Does anyone know of a

[sqlite] Conversion of SQLite Database to MySql format

2011-10-05 Thread Alberto Larotonda
Hello. It was recommended to me that I ask for assistance on this mailing list. I have a very large (600 mb) SQLite database file I'm trying to convert it to MySql (.sql) file format on a windows platform. Does anyone know of a free conversion utility? Thanks in advance. Alberto

Re: [sqlite] EXT :Re: How Do i use sqlite3 log?

2011-10-05 Thread Black, Michael (IS)
I would also like to know: #1 How long does it take if you remove the transaction? (in other words is it really working?) #2 What does your TABLE look like? #2 What does your INSERT look like? Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate

Re: [sqlite] How Do i use sqlite3 log?

2011-10-05 Thread Simon Slavin
On 5 Oct 2011, at 10:06am, 张一帆 wrote: > Thank you very much for reply. > yes.i have tried transaction ,and my database is created by the name > ':memory:'. > > now it takes about 5 minutes to insert 20 thousand record. it is really > slow. Are you running this on a computer or a different

Re: [sqlite] How Do i use sqlite3 log?

2011-10-05 Thread 张一帆
Thank you very much for reply. yes.i have tried transaction ,and my database is created by the name ':memory:'. now it takes about 5 minutes to insert 20 thousand record. it is really slow. by the way,how do i use 'pragma'? like sqlite_exec(handle,"PRAGMA cache_size = 4096",...)?

Re: [sqlite] How do you check if a sqlite database is open?

2011-10-05 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/04/2011 10:52 PM, James Brison wrote: > Can you open a database twice without closing it? That has absolutely nothing whatsoever with what you are seeing. > What is odd, is that I am using the prepare_v2 API. The documentation says > it