Re: [sqlite] SQLITE_CONSTRAINT, which one failed?

2012-04-05 Thread Simon Slavin
On 6 Apr 2012, at 1:50am, BareFeetWare wrote: > On 06/04/2012, at 12:12 AM, Richard Hipp wrote: > >> The way SQLite keeps track of foreign key constraints is by use of a >> counter. When foreign key constraints are violated, the counter increments >> and when the

Re: [sqlite] SQLITE_CONSTRAINT, which one failed?

2012-04-05 Thread Simon Slavin
On 6 Apr 2012, at 3:27am, BareFeetWare wrote: > eliminating a lot of superfluous, redundant and inaccurate external checking I see what you nearly did there. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] SQLITE_CONSTRAINT, which one failed?

2012-04-05 Thread BareFeetWare
On 06/04/2012, at 11:02 AM, Richard Hipp wrote: > On Thu, Apr 5, 2012 at 8:50 PM, BareFeetWare wrote: > >> On 06/04/2012, at 12:12 AM, Richard Hipp wrote: >> >>> The way SQLite keeps track of foreign key constraints is by use of a >>> counter... >>> we don't have

[sqlite] sqlite3_transaction trans(db); can't work in c, I don't know why?

2012-04-05 Thread YAN HONG YE
sqlite_transaction trans(db); sqlite3_prepare(db,"insert into image values('.rar',?);",-1,,0); sqlite3_bind_blob(stat,1,ffile,filesize,NULL); sqlite3_step(stat); free(ffile); sqlite3_finalize(stat); trans.commit(); ___ sqlite-users mailing list

Re: [sqlite] SQLITE_CONSTRAINT, which one failed?

2012-04-05 Thread Richard Hipp
On Thu, Apr 5, 2012 at 8:50 PM, BareFeetWare wrote: > On 06/04/2012, at 12:12 AM, Richard Hipp wrote: > > > The way SQLite keeps track of foreign key constraints is by use of a > counter. When foreign key constraints are violated, the counter increments > and when the

Re: [sqlite] SQLITE_CONSTRAINT, which one failed?

2012-04-05 Thread BareFeetWare
On 06/04/2012, at 12:12 AM, Richard Hipp wrote: > The way SQLite keeps track of foreign key constraints is by use of a counter. > When foreign key constraints are violated, the counter increments and when > the constraints are resolved, the counter decrements, and an error is issued > at

Re: [sqlite] SQlite3 Locking Question

2012-04-05 Thread Jay A. Kreibich
On Thu, Apr 05, 2012 at 07:29:48PM +0200, Andreas Wiencke scratched on the wall: > >> In my code I want to read from one table and write the results to > >> another table. But if I don't fetch all the results and close the > >> reading connection, I cannot write to another table in the same > >>

Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Pete
Hi SImon, Sorry if my replies seem a little disjointed - I get a daily digest of the list so I don't see any responses to my posts until the next day. Anyway, turns out this solution doesnt work - the INSERT fails because there are two columns in t3 but only 1 column named in the SELECT. The

Re: [sqlite] SQLite & JDBC & generated key

2012-04-05 Thread gwenn
Thanks for your replies. I will add a tweak to ignore column access by name when running "SELECT last_insert_rowid();" On Thu, Apr 5, 2012 at 2:17 AM, Kees Nuyt wrote: > On Wed, 4 Apr 2012 21:08:24 +0200, gwenn wrote: > >>  2) Do you know if there are

Re: [sqlite] Compiling with VS 2010 (force foreign key constraints)

2012-04-05 Thread Joe Mistachkin
Matjaž Cof wrote: > > I recompiled it, add reference to System.Data.SQlite and > System.Data.SQLite.Linq to my project and run. I get: The type > initializer for 'System.Data.SQLite.SQLiteFactory' threw an exception. > I try to add SQLite.Interop.Static.2010 SQLITE_DEFAULT_FOREIGN_KEYS > in

Re: [sqlite] Variation on INSERT with SELECT issue

2012-04-05 Thread Pete
Thank you Michael, that works. Pete On Thu, Apr 5, 2012 at 9:00 AM, wrote: > Message: 17 > Date: Thu, 5 Apr 2012 12:31:58 + > From: "Black, Michael (IS)" > To: General Discussion of SQLite Database >

Re: [sqlite] SQlite3 Locking Question

2012-04-05 Thread Andreas Wiencke
>> In my code I want to read from one table and write the results to >> another table. But if I don't fetch all the results and close the >> reading connection, I cannot write to another table in the same >> database. > >  Do it all from the same connection.  The locks are "owned" by a >  database

[sqlite] Compiling with VS 2010 (force foreign key constraints)

2012-04-05 Thread Matjaž Cof
I am trying something, and i am confused as far as i can be. I only want that SQlite would enforce foreign key constraint by default. I don't want to use PRAGMA foreign_keys every time i mada a connection. After searching on net, i found that i can compile with SQLITE_DEFAULT_FOREIGN_KEYS. I

Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Igor Tandetnik
On 4/5/2012 1:09 PM, Simon Slavin wrote: On 5 Apr 2012, at 6:05pm, Simon Slavin wrote: I don't understand what you think is wrong with insert into t3 SELECT Col1 FROM t2; Oh, now I do. Okay, SQLite insists on the number of columns matching when you use a sub-SELECT

Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Simon Slavin
On 5 Apr 2012, at 6:05pm, Simon Slavin wrote: > I don't understand what you think is wrong with > > insert into t3 SELECT Col1 FROM t2; Oh, now I do. Okay, SQLite insists on the number of columns matching when you use a sub-SELECT even though it doesn't when you use

Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Simon Slavin
On 5 Apr 2012, at 5:33pm, Pete wrote: > Thank you Igor and Simon, I think I understand this now. On reading the > docs more closely, it looks like the scond test case (NOT NULL with a > DEFAULT) could be solved by using INSERT OR REPLACE. I'm wondering if > there might

Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Igor Tandetnik
On 4/5/2012 12:33 PM, Pete wrote: Thank you Igor and Simon, I think I understand this now. On reading the docs more closely, it looks like the scond test case (NOT NULL with a DEFAULT) could be solved by using INSERT OR REPLACE. I don't see how. I'm wondering if there might be a way to

Re: [sqlite] table names

2012-04-05 Thread Igor Tandetnik
On 4/5/2012 12:18 PM, inq1ltd wrote: I have a program that is complete and in testing. In testing we found that sqlite complains if a table is named using a leading text numeral. For example I can't name a table "12-0401". Table name must be an identifier, or else surrounded by double

Re: [sqlite] table names

2012-04-05 Thread Jay A. Kreibich
On Thu, Apr 05, 2012 at 12:18:30PM -0400, inq1ltd scratched on the wall: > > sqlite help, > > I have a program that is complete and in testing. > > In testing we found that sqlite complains if a > table is named using a leading text numeral. > > For example I can't name a table "12-0401". >

Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Pete
Thank you Igor and Simon, I think I understand this now. On reading the docs more closely, it looks like the scond test case (NOT NULL with a DEFAULT) could be solved by using INSERT OR REPLACE. I'm wondering if there might be a way to solve the first test case by using a trigger? Pete On Thu,

Re: [sqlite] table names

2012-04-05 Thread Rob Richardson
In SQLite Expert, I created table "12-345" with no problem, but I noted that when the new table was displayed, its name was wrapped in square brackets: "[12-345]". Perhaps you could wrap numeric names in brackets similarly. Good luck! RobR ___

[sqlite] table names

2012-04-05 Thread inq1ltd
sqlite help, I have a program that is complete and in testing. In testing we found that sqlite complains if a table is named using a leading text numeral. For example I can't name a table "12-0401". I haven't seen anything in the sqlite create table info about not using a name such as

Re: [sqlite] SQlite3 Locking Question

2012-04-05 Thread Jay A. Kreibich
On Thu, Apr 05, 2012 at 03:15:37PM +0100, Simon Slavin scratched on the wall: > On 5 Apr 2012, at 3:04pm, Andreas Wiencke wrote: > > In my code I want to read from one table and write the results to > > another table. But if I don't fetch all the results and close the > >

Re: [sqlite] SQlite3 Locking Question

2012-04-05 Thread Simon Slavin
On 5 Apr 2012, at 3:15pm, Richard Hipp wrote: > Probably the $r query is not being finalized, and is thus holding the read > lock, preventing the subsequent write from happening. You shouldn't have > to close the connection in order to finalize the query - but I don't know >

Re: [sqlite] SQLITE_CONSTRAINT, which one failed?

2012-04-05 Thread Jay A. Kreibich
On Thu, Apr 05, 2012 at 04:08:29PM +0200, Gert Corthout scratched on the wall: > > hi all, > I have the database set to fail in case of constraint violation. > And it does return SQLITE_CONSTRAINT from sqlite3_step when I try > to insert/update an invalid foreign key. But is there any way to >

Re: [sqlite] SQlite3 Locking Question

2012-04-05 Thread Jay A. Kreibich
On Thu, Apr 05, 2012 at 04:04:23PM +0200, Andreas Wiencke scratched on the wall: > > Hello, > > I have a question regarding the locking in Sqlite3: Does Sqlite3 > lock the entire database when there is a lock on only one table? The whole database. http://sqlite.org/lockingv3.html > In my

Re: [sqlite] SQlite3 Locking Question

2012-04-05 Thread Simon Slavin
On 5 Apr 2012, at 3:04pm, Andreas Wiencke wrote: > I have a question regarding the locking in Sqlite3: Does Sqlite3 lock the > entire database when there is a lock on only one table? Yes. In fact it locks the entire database when there's only reason to lock one row.

Re: [sqlite] SQlite3 Locking Question

2012-04-05 Thread Richard Hipp
On Thu, Apr 5, 2012 at 10:04 AM, Andreas Wiencke wrote: > > Hello, > > I have a question regarding the locking in Sqlite3: Does Sqlite3 lock the > entire database when there is a lock on only one table? > In my code I want to read from one table and write the results to

Re: [sqlite] SQLITE_CONSTRAINT, which one failed?

2012-04-05 Thread Richard Hipp
On Thu, Apr 5, 2012 at 10:08 AM, Gert Corthout wrote: > > hi all, > I have the database set to fail in case of constraint violation. And it > does return SQLITE_CONSTRAINT from sqlite3_step when I try to insert/update > an invalid foreign key. But is there any way to

Re: [sqlite] SQlite3 Locking Question

2012-04-05 Thread Pavel Ivanov
> I have a question regarding the locking in Sqlite3: Does Sqlite3 lock the > entire database when there is a lock on only one table? Yes. > But if I don't fetch all the results and close the reading > connection, I cannot write to another table in the same database. Is this the > intended

[sqlite] SQLITE_CONSTRAINT, which one failed?

2012-04-05 Thread Gert Corthout
hi all, I have the database set to fail in case of constraint violation. And it does return SQLITE_CONSTRAINT from sqlite3_step when I try to insert/update an invalid foreign key. But is there any way to find out exactly which constraint failed as I might have many foreign key fields in the

[sqlite] SQlite3 Locking Question

2012-04-05 Thread Andreas Wiencke
Hello, I have a question regarding the locking in Sqlite3: Does Sqlite3 lock the entire database when there is a lock on only one table? In my code I want to read from one table and write the results to another table. But if I don't fetch all the results and close the reading connection, I

Re: [sqlite] SQLite db file viewer

2012-04-05 Thread Igor Tandetnik
Meng Ng wrote: > I have a SQLite db file. Can someone tell which software is needed to view > the file? Thanks. http://www.sqlite.org/cvstrac/wiki?p=ManagementTools -- Igor Tandetnik ___ sqlite-users mailing list

Re: [sqlite] SQLite db file viewer

2012-04-05 Thread Simon Slavin
On 5 Apr 2012, at 2:44pm, Meng Ng wrote: > I have a SQLite db file. Can someone tell which software is needed to view > the file? Thanks. The SQLite team provides a command line tool which you can use to view the file in various formats. Documentation:

[sqlite] SQLite db file viewer

2012-04-05 Thread Meng Ng
Hi, I have a SQLite db file. Can someone tell which software is needed to view the file? Thanks. -- Meng ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

[sqlite] Unicode problem when setting PRAGMA journal_mode

2012-04-05 Thread Nick Shaw
Hi all, Our windows application uses sqlite, and we've had no problems with it in our existing builds, which use the multibyte character set. We are now converting our codebase to Unicode. SqLite is quite happily running with our Unicode builds, creating SqLite databases in UTF-16LE

Re: [sqlite] Variation on INSERT with SELECT issue

2012-04-05 Thread Black, Michael (IS)
You need 2 inserts to do what you want. Hopefully the order in the table doesn't matter to you. sqlite> CREATE TABLE t2 (Col1 text,Col2 text); sqlite> insert into t2 (Col1) values('xxx'); sqlite> insert into t2 values('yyy','def'); sqlite> select * from t2; xxx| yyy|def sqlite> sqlite>

Re: [sqlite] about The open-source Fossil version control system

2012-04-05 Thread Niall O'Reilly
On 5 Apr 2012, at 04:42, YAN HONG YE wrote: > When I open the source on the page, but I don't found > #include "config.h" > #include "main.h" > file, where it is? You need to do your homework. Persistently looking to people on the list to do it for you is not just

Re: [sqlite] sqlite3_transaction can't work

2012-04-05 Thread Simon Davies
On 5 April 2012 09:44, YAN HONG YE wrote: > sqlite3_transaction trans(db); can't work in c, I don't know why? Give us a clue: what are you expecting, and what actually happens... Regards, Simon ___ sqlite-users mailing list

[sqlite] sqlite3_transaction can't work

2012-04-05 Thread YAN HONG YE
sqlite3_transaction trans(db); can't work in c, I don't know why? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users