Re: [sqlite] PySQLite problem

2007-12-26 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Cesar D. Rodas wrote:
> Any one had an idea how to solve this problem?

I am not 100% certain about this, but I believe the cause is:

 * SQLite doesn't check that strings you insert are valid UTF-8.  It
assumes that what you supply is correct.
 * pysqlite doesn't check either, or you used a different program to
insert the data.  That basically means that what went into the database
is in some other encoding.
 * When you retrieved the data, either pysqlite or SQLite tried to treat
it as valid UTF-8 and it turned out not to be, hence the error

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHcs04mOOfHg372QQRAnU0AKDjJRCaykwYUl2opgir6DWu3y02vQCgmg30
KQqplC4HXxwxS5aXbvKN1ug=
=k4mo
-END PGP SIGNATURE-

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] shared cache and 'no such table' issue

2007-12-26 Thread Darío Mariani
I found that the sqlite3_open call is not thread safe even if you open
different files in separate connections. Cannot tell you about
sqlite3_close but may be the same problem.
Darío

On Dec 26, 2007 6:40 AM, Pathompong Puengrostham <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a multi-threaded program. Each thread opens a connection to the same
> database file. It runs fine most of the time but sometime I get a 'no such
> table' error from a SQL select statement. It appears that if one thread
> close the database connection, it closes all the schema without checking
> nRef in BtShared. This make other threads receive a 'no such table' error.
>
> Do I get it right that schema is also shared together with Btree? When
> shared cache mode is enabled, does SQLite really share cache within one
> thread and not between other threads? I don't know much about internal of
> SQLite. But from looking at the source code, there is only one
> sqlite3SharedCacheList variable that is shared with every threads.
>
> Jay
>

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Regarding sqlite website...

2007-12-26 Thread Cesar D. Rodas
Hello,

Merry x-mass to everyone, I'd like to know if all the documentation (
http://www.sqlite.org/c3ref/update_hook.html for example) was generating
with a software that generate documentation from source code or it was
generated by a human.

If the first option is true, does any one can tell me where can I download
that software?

Regards

-- 
Best Regards

Cesar D. Rodas
http://www.cesarodas.com
http://www.thyphp.com
http://www.phpajax.org
Phone: +595-961-974165


Re: Re[2]: [sqlite] Fastest way to check if new row or update existing one?

2007-12-26 Thread Kees Nuyt
On Wed, 26 Dec 2007 10:17:43 +0200, Ion Silvestru
<[EMAIL PROTECTED]> wrote:

>>>QUESTION: is there a better way to make this important decision? using
>>>Sqlite
>
>>INSERT OR REPLACE may work for you.
>
>There is a problem with "INSERT OR REPLACE" in that "REPLACE" is not
>truly , but is  (existing row is deleted and
>new row is added), or I am wrong?

It is a full replacement of the row, just as the word REPLACE
(Take the place or move into the position of) suggests. Perhaps
you are confused with UPDATE.
REPLACE has been introduced to increase compatibility with other
database engines, they all follow the same strategy.

>If I am correct, then a question to developers of SQLite:
>
>Is it difficult to change the behaviour of the "REPLACE" part of "INSERT OR 
>REPLACE"
>to be the correct behaviour, row content is updated, and not deleted then 
>inserted?

What would be the difference? 
I guess your new row doesn't provide some of the column values
of the existing row, and you want to keep some of those. In that
case, SELECT / UPDATE is the only option.

To change the behaviour of REPLACE into selective updating of
columns SQLite would have to know which columns it would have to
update and which not. It simply can't.

A nice solution is found in 
Date: Tue, 24 Apr 2007 14:36:48 -0400
Subject: [sqlite] Re: INSERT OR REPLACE without new rowid ,
Message-ID: <[EMAIL PROTECTED]> :

IT> You can do
IT>
IT> UPDATE ... WHERE keyfield='xxx';
IT>
IT> then use sqlite3_changes to see whether any update 
IT> has in fact taken place, and run INSERT if not.
IT>
IT> Igor Tandetnik 

>Thanks in advance and happy hollidays!

HTH
-- 
  (  Kees Nuyt
  )
c[_]

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] shared cache and 'no such table' issue

2007-12-26 Thread Pathompong Puengrostham
Hi,

I have a multi-threaded program. Each thread opens a connection to the same
database file. It runs fine most of the time but sometime I get a 'no such
table' error from a SQL select statement. It appears that if one thread
close the database connection, it closes all the schema without checking
nRef in BtShared. This make other threads receive a 'no such table' error.

Do I get it right that schema is also shared together with Btree? When
shared cache mode is enabled, does SQLite really share cache within one
thread and not between other threads? I don't know much about internal of
SQLite. But from looking at the source code, there is only one
sqlite3SharedCacheList variable that is shared with every threads.

Jay


Re[2]: [sqlite] Fastest way to check if new row or update existing one?

2007-12-26 Thread Ion Silvestru
>>QUESTION: is there a better way to make this important decision? using
>>Sqlite

>INSERT OR REPLACE may work for you.

There is a problem with "INSERT OR REPLACE" in that "REPLACE" is not
truly , but is  (existing row is deleted and
new row is added), or I am wrong?

If I am correct, then a question to developers of SQLite:

Is it difficult to change the behaviour of the "REPLACE" part of "INSERT OR 
REPLACE"
to be the correct behaviour, row content is updated, and not deleted then 
inserted?

Thanks in advance and happy hollidays!


-
To unsubscribe, send email to [EMAIL PROTECTED]
-