Re: [sqlite] Namespacing sqlite3

2013-09-24 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 24/09/13 16:37, Neville Dastur wrote: > That's a very interesting concept. I've been doing it since 2004, and support all versions of Python from 2.3 onwards including 3.x. > Are you using http://www.cython.org/ or something else to "create" the

Re: [sqlite] Namespacing sqlite3

2013-09-24 Thread Neville Dastur
That's a very interesting concept. Are you using http://www.cython.org/ or something else to "create" the library wrapper Neville On 24 Sep 2013, at 22:39, Roger Binns wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 24/09/13 12:56, Neville Dastur

Re: [sqlite] Namespacing sqlite3

2013-09-24 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 24/09/13 12:56, Neville Dastur wrote: > Searching around on Google it seems that namespacing in c / obj-c is > not possible for the sqlite3 library. There is another approach that I use. I produce a Python C extension. The final shared library

[sqlite] best practice on sqlite database schema refactoring

2013-09-24 Thread Bao Niu
>From time to time, with a database already loaded with hundreds records, I need to change a column name, or move a field from one table to another table(sometimes even another database). I use python to code with my database. With python if you want to refactor your code there is a lot of tools

Re: [sqlite] Bug in sqlite3.exe?

2013-09-24 Thread Keith Medcalf
It is using the country table and aliasing it to languages ... > -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of John Drescher > Sent: Tuesday, 24 September, 2013 10:50 > To: General Discussion of SQLite Database >

Re: [sqlite] Namespacing sqlite3

2013-09-24 Thread Neville Dastur
Okay, so it's already namespaced with a prefix which I can replace. Thank you On 24 Sep 2013, at 21:27, Richard Hipp wrote: > On Tue, Sep 24, 2013 at 3:56 PM, Neville Dastur > wrote: > >> Hi >> >> I am hoping someone can help with this one. I am

Re: [sqlite] Namespacing sqlite3

2013-09-24 Thread Richard Hipp
On Tue, Sep 24, 2013 at 3:56 PM, Neville Dastur wrote: > Hi > > I am hoping someone can help with this one. I am aware that some might > consider it a C issue more than sqlite3, but C doesn't handle this well and > so I am looking for specific sqlite3 info. > > I am

[sqlite] Namespacing sqlite3

2013-09-24 Thread Neville Dastur
Hi I am hoping someone can help with this one. I am aware that some might consider it a C issue more than sqlite3, but C doesn't handle this well and so I am looking for specific sqlite3 info. I am looking to create my own sqlite3 Appcelerator module. Appcelerator at present already uses

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Richard Hipp
On Mon, Sep 23, 2013 at 12:19 PM, Jean-Marie CUAZ wrote: > Hello, > > Thanks to SQlite developement team for this wonderfull library > > We have been hit today by the following : > > package require sqlite3 > > sqlite3 db1 test > > db1 eval {CREATE TABLE T1 (A PRIMARY KEY, B,

Re: [sqlite] sqlite database created in PHP not readable in python

2013-09-24 Thread Richard Hipp
On Mon, Sep 23, 2013 at 11:19 PM, Aryc wrote: > All; > I'm trying to use SQlite as a transfer medium between my PHP world and my > Python world. > in PHP i can read and write just fine. but when i try to read the database > from a python program i get the dreaded "file is

Re: [sqlite] SQLite3 3.7.17 => using column names with character '@'.

2013-09-24 Thread Richard Hipp
On Tue, Sep 24, 2013 at 2:02 PM, Petite Abeille wrote: > > On Sep 24, 2013, at 7:59 PM, Dan Kennedy wrote: > > > A double quoted string is treated as a column name if possible, or a > > string literal otherwise. It's an SQL thing. > > Nah. The

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 8:16 PM, Simon Slavin wrote: > The first version (INSERT OR FAIL, then UPDATE) won't lead to any SQLite > errors if one of the rows already exists. So you can do a whole lot of both > lines in one transaction and the transaction will still succeed.

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Simon Slavin
On 24 Sep 2013, at 7:19pm, Marc L. Allen wrote: > INSERT OR IGNORE? Dammit, yes. I meant INSERT OR IGNORE, not INSERT OR FAIL. Thanks Marc. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 8:05 PM, Simon Slavin wrote: > Which is why you do an INSERT first, and allow it to fail, then do the UPDATE. Sure. A lot of error proce procedural code to do what one SQL statement could do much more naturally.

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Marc L. Allen
So it does! And, for those of us lucky enough to be on a system that isn't 8 years old, enjoy! ;) And now that I see that, I will renew push for upgrades. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Petite Abeille

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Marc L. Allen
INSERT OR IGNORE? -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Tuesday, September 24, 2013 2:16 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Bug : Tcl interface + "INSERT OR

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Simon Slavin
On 24 Sep 2013, at 7:09pm, Marc L. Allen wrote: > Also, there are times when you do a bulk insert, so you have to structure the > query to not fail on records that are already present. Yeah. Actually I got what I posted wrong. I should have written Which is why

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 8:09 PM, Marc L. Allen wrote: > Not complaining, mind you. MS SQL doesn't have it, and I've long learned to > deal with it. MS SQL Server sports a MERGE statement if I'm not mistaken: http://msdn.microsoft.com/en-us/library/bb510625.aspx

Re: [sqlite] Bug in sqlite3.exe?

2013-09-24 Thread Igor Tandetnik
On 9/24/2013 12:49 PM, John Drescher wrote: On Tue, Sep 24, 2013 at 12:35 PM, Staffan Tylen wrote: SQLite version 3.7.16.2 2013-04-12 11:52:43 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .tables CityCountry

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 8:06 PM, Marc L. Allen wrote: > Considered harmful? How so? I wouldn't mind a version of ON CONFLICT UPDATE > fieldlist. In its current form. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Marc L. Allen
Yes, of course. But, it seems a waste of time, since you're obviously already at the record (or at least done the initial index search) to not be able to simply update it. Not complaining, mind you. MS SQL doesn't have it, and I've long learned to deal with it. Also, there are times when

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 7:54 PM, "Marc L. Allen" wrote: > Yep. What most people want is an INSERT OR UPDATE. Yep. Which is what one usually calls 'MERGE': http://en.wikipedia.org/wiki/Merge_(SQL) And sadly, SQLite doesn't provide anything like that at all. Oh,

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Marc L. Allen
Considered harmful? How so? I wouldn't mind a version of ON CONFLICT UPDATE fieldlist. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Petite Abeille Sent: Tuesday, September 24, 2013 1:59 PM To: General Discussion of

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Simon Slavin
On 24 Sep 2013, at 6:58pm, Petite Abeille wrote: > On Sep 24, 2013, at 7:54 PM, "Marc L. Allen" > wrote: > >> Yep. What most people want is an INSERT OR UPDATE. > > Yep. Which is what one usually calls 'MERGE': > >

Re: [sqlite] SQLite3 3.7.17 => using column names with character '@'.

2013-09-24 Thread Petite Abeille
On Sep 24, 2013, at 7:59 PM, Dan Kennedy wrote: > A double quoted string is treated as a column name if possible, or a > string literal otherwise. It's an SQL thing. Nah. The second part is a SQLite thing. Randomly converting identifiers into literals is more of a

Re: [sqlite] Problem with method numRows() in Sqlite3

2013-09-24 Thread Simon Slavin
On 24 Sep 2013, at 9:50am, pisey phon wrote: > And now I have an error with insert data into database with Sqlite3. > Errro: "SQLite3::exec() [sqlite3.exec]: near "SET": syntax error". Insert a debugging line into your program so that having make up the full INSERT

Re: [sqlite] sqlite database created in PHP not readable in python

2013-09-24 Thread Simon Slavin
On 24 Sep 2013, at 4:19am, Aryc wrote: > I'm trying to use SQlite as a transfer medium between my PHP world and my > Python world. > in PHP i can read and write just fine. but when i try to read the database > from a python program i get the dreaded "file is encrypted

Re: [sqlite] SQLite3 3.7.17 => using column names with character '@'.

2013-09-24 Thread Dan Kennedy
On 09/24/2013 04:52 PM, Alexander Syvak wrote: Hello, using input select all "project@na" from project where 1 yields 4 lines of "project@na". In fact the column named project@na does not exist, but the project@name does in the tested data base. What is the gist of such a result? A double

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Marc L. Allen
Yep. What most people want is an INSERT OR UPDATE. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Petite Abeille Sent: Tuesday, September 24, 2013 1:48 PM To: General Discussion of SQLite Database Subject: Re: [sqlite]

Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Petite Abeille
On Sep 23, 2013, at 6:19 PM, Jean-Marie CUAZ wrote: > -> no exception is raised to host langage Tcl for 2 rows not inserted because > a UNIQUE constraint is not respected > -> partial execution : 2 rows are definitely deleted from the table ...(ouch > !) Yep. Looks like it

[sqlite] SQLite3 3.7.17 => using column names with character '@'.

2013-09-24 Thread Alexander Syvak
Hello, using input select all "project@na" from project where 1 yields 4 lines of "project@na". In fact the column named project@na does not exist, but the project@name does in the tested data base. What is the gist of such a result? P.S. Please, reply to my e-mail. Regards, Alexander.

Re: [sqlite] Problem with method numRows() in Sqlite3

2013-09-24 Thread pisey phon
And now I have an error with insert data into database with Sqlite3. Errro: "SQLite3::exec() [sqlite3.exec]: near "SET": syntax error". I a a new with Sqlite3 here is my code: open($db_file); } public function connecting($db){ if(!$db){

[sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement

2013-09-24 Thread Jean-Marie CUAZ
Hello, Thanks to SQlite developement team for this wonderfull library We have been hit today by the following : package require sqlite3 sqlite3 db1 test db1 eval {CREATE TABLE T1 (A PRIMARY KEY, B, C, D UNIQUE DEFAULT '-')} db1 eval {INSERT INTO T1 VALUES (0, 1, 1, 'a') , (1, 1, 1, 'b') ,

Re: [sqlite] Problem with method numRows() in Sqlite3

2013-09-24 Thread pisey phon
thanks you so much for replying it really help me -- View this message in context: http://sqlite.1065341.n5.nabble.com/Problem-with-method-numRows-in-Sqlite3-tp71420p71439.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users

[sqlite] sqlite database created in PHP not readable in python

2013-09-24 Thread Aryc
All; I'm trying to use SQlite as a transfer medium between my PHP world and my Python world. in PHP i can read and write just fine. but when i try to read the database from a python program i get the dreaded "file is encrypted or not a database" message. can any body help me? Thanks Paul

Re: [sqlite] Bug in sqlite3.exe?

2013-09-24 Thread Staffan Tylen
Many who solved this, thank you all. Staffan On Tue, Sep 24, 2013 at 7:11 PM, Yuriy Kaminskiy wrote: > Staffan Tylen wrote: > > On Tue, Sep 24, 2013 at 6:50 PM, Simon Slavin > wrote: > > > >> On 24 Sep 2013, at 5:35pm, Staffan Tylen

Re: [sqlite] Bug in sqlite3.exe?

2013-09-24 Thread Yuriy Kaminskiy
Staffan Tylen wrote: > On Tue, Sep 24, 2013 at 6:50 PM, Simon Slavin wrote: > >> On 24 Sep 2013, at 5:35pm, Staffan Tylen wrote: >> >>> sqlite> .tables >>> CityCountry Languages >>> Country Country

Re: [sqlite] Bug in sqlite3.exe?

2013-09-24 Thread Dan Kennedy
On 09/24/2013 11:53 PM, Staffan Tylen wrote: Well, it's not my database I'm looking at. What puzzles me is that Country Languages works but Country Official Languages doesn't, so could there be a parsing problem? It's because the AS keyword is optional. These two are equivalent: SELECT

Re: [sqlite] Bug in sqlite3.exe?

2013-09-24 Thread John Drescher
On Tue, Sep 24, 2013 at 12:53 PM, Staffan Tylen wrote: > Well, it's not my database I'm looking at. What puzzles me is that Country > Languages works but Country Official Languages doesn't, so could there be a > parsing problem? > > I think I see what is happening.. when

Re: [sqlite] Bug in sqlite3.exe?

2013-09-24 Thread Richard Hipp
On Tue, Sep 24, 2013 at 12:35 PM, Staffan Tylen wrote: > SQLite version 3.7.16.2 2013-04-12 11:52:43 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> .tables > CityCountry Languages > Country

Re: [sqlite] Bug in sqlite3.exe?

2013-09-24 Thread Staffan Tylen
Well, it's not my database I'm looking at. What puzzles me is that Country Languages works but Country Official Languages doesn't, so could there be a parsing problem? I agree, the names should be quoted ... On Tue, Sep 24, 2013 at 6:50 PM, Simon Slavin wrote: > > On 24

Re: [sqlite] Bug in sqlite3.exe?

2013-09-24 Thread John Drescher
On Tue, Sep 24, 2013 at 12:35 PM, Staffan Tylen wrote: > SQLite version 3.7.16.2 2013-04-12 11:52:43 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> .tables > CityCountry Languages > Country

Re: [sqlite] Bug in sqlite3.exe?

2013-09-24 Thread Simon Slavin
On 24 Sep 2013, at 5:35pm, Staffan Tylen wrote: > sqlite> .tables > CityCountry Languages > Country Country Official Languages > Country CapitalsCountryLanguage Either don't use spaces in your token names (table

Re: [sqlite] Bug in sqlite3.exe?

2013-09-24 Thread John Drescher
On Tue, Sep 24, 2013 at 12:35 PM, Staffan Tylen wrote: > SQLite version 3.7.16.2 2013-04-12 11:52:43 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> .tables > CityCountry Languages > Country

[sqlite] Bug in sqlite3.exe?

2013-09-24 Thread Staffan Tylen
SQLite version 3.7.16.2 2013-04-12 11:52:43 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .tables CityCountry Languages Country Country Official Languages Country CapitalsCountryLanguage sqlite> select