Re: [sqlite] any way to find out how many current connections to db?

2007-08-13 Thread Ben Combee
On 8/13/07, Chase <[EMAIL PROTECTED]> wrote:
>
> is there any way (in c/c++) to find out how many current connections
> there are to a database that i am connected to?
>
> i'd like to do some housekeeping on the database every so often, but
> only if there's no one else connected to it at the time.

If you're on a Linux system, you can shell out and run "lsof
/path/to/sql.db" and see all the processes that have the file opened.
You may need to run as root to see all the users, and you should use
the output as a guide, since by the time you parse it, some users may
have quit, others could have joined.

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



Re: [sqlite] how to cout the nandflash expire

2007-07-30 Thread Ben Combee
On 7/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> hello, I port the sqlite3 to linux(file system is jffs2).now , I must cout
> the nandflash expire in sqlite3 running.

SQLite works on top of the file system, so it has no knowledge of what
JFFS2 and MTD are doing to manage your NAND flash.  You'll have to
talk directly to the JFFS2 layer on your device and find out what's
happening to the file that stored the SQLite database.

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



Re: [sqlite] SQLite Version 3.4.1

2007-07-23 Thread Ben Combee

On 7/23/07, Steinmaurer Thomas <[EMAIL PROTECTED]> wrote:

Hi!

has anybody tried to compile SQLite for the ARM CPU architecture?


Sure, I've been using it for several years on an XScale-based system.
It works just fine, in my experience.  We configure it for
cross-compilation with the parameters

--build=i686-linux --host=arm-linux --target=arm-linux
--with-readline-inc=-/arm-sysroot/usr/include/readline
--with-readline-lib=auto --enable-threadsafe --disable-tcl
--enable-tempstore=yes

and when running make, we add the setting

BCC="gcc -g -O2"

to ensure that the right compiler is run for local files instead of
the arm-linux-gcc cross-compiler.

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



Re: [sqlite] Sqlite in Shared Memory

2007-07-12 Thread Ben Combee

On 7/12/07, RaghavendraK 70574 <[EMAIL PROTECTED]> wrote:

Hi,

I want to use Sqlite as in-mem db and want this Mem to be alloacted on SHM.
Has anyone tried it?


Since sqlite3 uses file locking as an IPC mechanism to prevent
multiple modifications, you're probably best using it with a file in
/tmp or some other shared-memory based file system.  Then, the file
locking would control access to the shared memory data.

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



[sqlite] Possible memory leaks in shell.c

2007-07-02 Thread Ben Combee

This one's in shell.c.  In process_input(), zLine is assigned using

 zLine = one_input_line(zSql, in);

Usually, you hit the free(zLine) call in one of the code paths before
repeating the while loop.  However, on line 1614

   if( (zSql==0 || zSql[0]==0) && _all_whitespace(zLine) ) continue;

you can continue to the top of the while loop without freeing zLine,
resulting in a leak when the next line of input is read.

It also looks like you can lose the memory attached to zLine if you
hit line 1609's if statement

 if( in!=0 ) break;

and break out of the while loop.

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



Re: [sqlite] Possible memory leak in select.c

2007-07-02 Thread Ben Combee

On 7/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

"Ben Combee" <[EMAIL PROTECTED]> wrote:
> Won't this code leak the memory to which zName points during the
> assignment from the call to sqlite3MPrintf?
>

The %z calls sqliteFree() for you automatically.


Thanks for the clarification.  One less possible problem.  Just for
reference, Coverity had found about 20 issues.  On inspection, I found
all of them to be false except for this one and for the UTF-8 issue
that's already fixed in 3.4.0.  Now I know this is false too :)

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



[sqlite] Possible memory leak in select.c

2007-07-02 Thread Ben Combee

This is something the Coverity caught when run locally on the SQLite
3.3.17 source, but it seems to still be there in the CVS version:

In select.c's sqlite3ResultSetOfSelect(), zName is allocated using a
malloc-style function at the top of the routine.  Later, there's code
to guarantee a unique name:

   /* Make sure the column name is unique.  If the name is not unique,
   ** append a integer to the name so that it becomes unique.
   */
   for(j=cnt=0; j

[sqlite] Small code comment fix

2007-07-02 Thread Ben Combee

In reading the SQLite source, I think I spotted a cut-and-paste error
in a comment:

In build.c in the parameter list for sqlite3CreateIndex, pStart is described as

 Token *pStart, /* The CREATE token that begins a CREATE TABLE statement */

Shouldn't that be "CREATE INDEX"?

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