Re: [sqlite] What happens to the data obtained from sqlite3_column_*?

2005-12-03 Thread Henrik Ronellenfitsch
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

[EMAIL PROTECTED] wrote:

> The data is automatically freed by SQLite the next time you call
> sqlite3_step(), sqlite3_reset(), or sqlite3_finalize(). If you need
> the data to last longer you will need to make your own copy. -- D.
> Richard Hipp <[EMAIL PROTECTED]>
>
That's what I needed to know, thanks!
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDkee39vAfrm0sescRAjDFAKCaYxqM+j5zZXhhTaph9gQLwgS/cgCeNrfI
K3Z7/ACBFISBvjxDQNS27pY=
=L0+e
-END PGP SIGNATURE-



Re[2]: [sqlite] Database recovery best practice?

2005-12-03 Thread Teg
Hello drh,

That works for me.

Thank!

C


Saturday, December 3, 2005, 11:55:41 AM, you wrote:

dhc> Teg <[EMAIL PROTECTED]> wrote:
>> Version 3.2.7
>> 
>> I've got a 7gb damaged database. It's at least partially readable but,
>> when I want to vacuum or drop a table it gives me the "malformed disk
>> image" error.
>> 
>> What's the best practice for salvaging this database? ".dump" then
>> import?
>> 

dhc> Yes.  Also try doing ".dump TABLENAME" on individual tables.
dhc> --
dhc> D. Richard Hipp <[EMAIL PROTECTED]>




-- 
Best regards,
 Tegmailto:[EMAIL PROTECTED]



Re: [sqlite] Database recovery best practice?

2005-12-03 Thread drh
Teg <[EMAIL PROTECTED]> wrote:
> Version 3.2.7
> 
> I've got a 7gb damaged database. It's at least partially readable but,
> when I want to vacuum or drop a table it gives me the "malformed disk
> image" error.
> 
> What's the best practice for salvaging this database? ".dump" then
> import?
> 

Yes.  Also try doing ".dump TABLENAME" on individual tables.
--
D. Richard Hipp <[EMAIL PROTECTED]>



[sqlite] Database recovery best practice?

2005-12-03 Thread Teg
Version 3.2.7

I've got a 7gb damaged database. It's at least partially readable but,
when I want to vacuum or drop a table it gives me the "malformed disk
image" error.

What's the best practice for salvaging this database? ".dump" then
import?

Thanks

-- 
Best regards,
 Tegmailto:[EMAIL PROTECTED]



Re: [sqlite] sqlite3_create_function in delphi

2005-12-03 Thread Miha Vrhovnik
juan perez <[EMAIL PROTECTED]> je ob 3.12.2005 17:16:00 napisal(a):

>There is a "nocase" collation for that purpose.
>
>jp
Which works only on ASCII characters I need unicode version of Lower function.

Regards,
Miha


Re: [sqlite] sqlite3_create_function in delphi

2005-12-03 Thread juan perez

There is a "nocase" collation for that purpose.

jp

Miha Vrhovnik wrote:

Does anybody know how to add custom function to sqlite3 in Delphi? Cariotoglou 
Mike?

I'd like to add function 'Lower' so I can match case insenisitive text columns 
in table.

Regards,
Miha






[sqlite] sqlite3_create_function in delphi

2005-12-03 Thread Miha Vrhovnik
Does anybody know how to add custom function to sqlite3 in Delphi? Cariotoglou 
Mike?

I'd like to add function 'Lower' so I can match case insenisitive text columns 
in table.

Regards,
Miha


Re: [sqlite] locking problem (on insert inside callback)

2005-12-03 Thread Rachel Willmer
(Replying to my own email so I can find this answer again via google
in the future...)

I have an even better solution...

CREATE VIEW NewView AS SELECT * FROM table1 LEFT JOIN table2 on
table1.field=table2.field WHERE table2.field is NULL;

Works just fine...

Cheers
Rachel

Back In Oct, I asked:
Rachel Willmer <[EMAIL PROTECTED]> wrote:
> I want to search two tables which should contain the same records and
> add any that are missing from the second into the first.
>
> So I do
>
> SELECT * FROM table1 LEFT JOIN table2 on table1.field=table2.field
> WHERE table2.field is NULL
>
> So far, so good, I get the records I want. Then in the callback, I try
>
> INSERT INTO table1 etc...
>
> This fails with a "database table is locked" error.
>
> I'm assuming that this is because I'm still in the middle of doing the
> SELECT statement.
>
> So my question is this, do I have to use the callback to copy the
> records into a temp table, and then only add them after the
> sqlite3_exec() which calls the SELECT has returned? or is there a more
> elegant/obvious solution?

On 14/10/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Solution 1 is to use a TEMP table:
>
>   CREATE TEMP TABLE diffs AS
>  SELECT * FROM table1 LEFT JOIN table2 ;
>   SELECT * FROM diffs; -- Insert into table1 in the callback;
>   DROP TABLE diffs;
>
> Solution 2 is a dirty trick.  It works now and in all historical versions
> of SQLite and there are no plans to change it, but there are also no
> promises not to change it.  In solution 2, add
>
>   ORDER BY +table1.rowid
>
> to the end of your SELECT statement.  The "+" sign in front of the
> "table1.rowid" is *essential* if this is trick is to work.
>
>   --
> D. Richard Hipp <[EMAIL PROTECTED]>