Re: [sqlite] sqlite3_get_table question

2008-12-30 Thread schachtobi
Hi,

thanks Dan. This was certainly the problem, since there are a lot of
zeros in the data.

In the meahnwhile I tried out something different. I heard from the
incremental blob API. And it worked!!!

Here is how I solved it:

if(sqlite3_prepare_v2(db, cmd, strlen(cmd), , 0) != SQLITE_OK)
{
  printf("Could not prepare statement.\n");
  return;
}

rc = sqlite3_step(pStmt);
if( rc==SQLITE_ROW )
{
  newBlobSize = sqlite3_column_bytes(pStmt, 2);
  if(newBlobSize > blobSize || blobData == NULL)
  {
printf("(re)allocating buffer\n");
if(blobData != NULL)
  free(blobData);

blobData = malloc(newBlobSize);
blobSize = newBlobSize; 
  }
  memcpy(blobData, sqlite3_column_blob(pStmt, 2), newBlobSize);
}

Now I only need to solve a speed problem, but this I will first try out
by myself:-)

Thanks for your help

Tobias

>>> Date: Mon, 29 Dec 2008 11:20:58 +0700
>>> From: Dan 
>>> Subject: Re: [sqlite] sqlite3_get_table question
>>> To: General Discussion of SQLite Database 
>>> Message-ID: <65fa0cc6-4248-4675-8100-f069423e0...@gmail.com
>>
>>> Why (ncol+2)?
>>
>> I make the following select statement:
>>
>> SELECT fname, dsize, data, ABS(red-%d)+ABS(green-%d)+ABS(blue-%d) err
>>  FROM ch ORDER BY err LIMIT 1;
>>
>> If I want to have the data then this would be 2 + the number of  
>> heading
>> columns (ncol)
> 
> Right. Obviously.
> 
> Note that sqlite3_get_table() won't work for data with embedded 0x00  
> bytes.
> It will truncate each value at the first one encountered. That could be
> the problem.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] memory usage

2008-12-30 Thread ed
Hello,
My multi-threaded application has various sqlite db's open simultaneously,
in memory using the :memory: keyword, disk based db's and at times, tmpfs
(ram) db's. Is there a way to view each individual database's memory usage?

I found the functions sqlite3_memory_used() and
sqlite3_status(SQLITE_STATUS_MEMORY_USED, ...) but these look like they
provide memory statistics for all of sqlite, not per database.

thanks,
ed
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] memory usage

2008-12-30 Thread #
Hello,
My multi-threaded application has various sqlite db's open simultaneously,
in memory using the :memory: keyword, disk based db's and at times, tmpfs
(ram) db's. Is there a way to view each individual database's memory usage?

I found the functions sqlite3_memory_used() and
sqlite3_status(SQLITE_STATUS_MEMORY_USED, ...) but these look like they
provide memory statistics for all of sqlite, not per database.

thanks,
ed
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Drop Trigger with Select

2008-12-30 Thread Martin.Engelschalk
Hi,

My idea would be a to define a function which drops the trigger and 
returns some dummy value and call ist like this:

SELECT MyDropFunction(name) from trigger_status where status = 1

However, i do not know if this will work.

Martin




timdbu...@gmail.com schrieb:
> Hi,
> Is there any way that I could drop a trigger by providing the results of a  
> query? Something similar to the following?:
>
> DROP TRIGGER (SELECT name from trigger_status where status = 1);
>
> Thanks!
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>   

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Drop Trigger with Select

2008-12-30 Thread timdburke
Hi,
Is there any way that I could drop a trigger by providing the results of a  
query? Something similar to the following?:

DROP TRIGGER (SELECT name from trigger_status where status = 1);

Thanks!
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLite 3.6.7 does not create dynamic library with .dylib suffix when compiled under MacOSX 10.3.9

2008-12-30 Thread Myshkin LeVine
Hello,
  I compiled the latest amalgamation under MacOSX 10.3.9 and while the 
compilation completed successfully, the
dynamic library created does not have a file ending of ".dylib". I 
would have expected the library created to be named 
"libsqlite3.0.8.6.dylib" but it was named just "libsqlite3.0". This is 
what the installed libraries look like:

4914583 lrwxr-xr-x   1 root wheel 12 Dec 27 04:50 libsqlite3 -> 
libsqlite3.0
4914582 -rwxr-xr-x   1 root wheel1105976 Dec 27 04:50 libsqlite3.0
4914584 lrwxr-xr-x   1 root wheel 12 Dec 27 04:50 
libsqlite3.0.8.6 -> libsqlite3.0
4914587 -rw-r--r--   1 root wheel1229020 Dec 27 04:50 libsqlite3.a
4914585 -rwxr-xr-x   1 root wheel795 Dec 27 04:50 libsqlite3.la

I tried compiling the 3.6.6.2 amalgamation but the libraries produced 
were named identically. The program I use which depends on SQLite for 
database support functions normally and I assumed it was using the 
static library. I also tried renaming the library and the links to it 
with .dylib file endings but then the sqlite3 command line program 
would not work, complaining that libsqlite3.0 was missing. I am 
concerned that if I need to run a program which needs a dynamic SQLite 
library I will have problems. Anyone have any ideas about what is 
wrong? I have compiled the SQLite amalgamation in the past and the 
dynamic library created was named properly but that was in the 3.5.x 
series.
Take care,
   Myshkin 
LeVine

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users