Re: [sqlite] Which SQLite API return SQLITE_BUSY?

2010-07-13 Thread Lloyd
Thanks Jay for your detailed reply.
I would be more happy if the SQLite documentaion include the error codes 
each function can return.

Thanks a lot,
  Lloyd


- Original Message - 
From: Jay A. Kreibich j...@kreibi.ch
To: General Discussion of SQLite Database sqlite-users@sqlite.org
Sent: Thursday, July 08, 2010 8:27 PM
Subject: Re: [sqlite] Which SQLite API return SQLITE_BUSY?


 On Thu, Jul 08, 2010 at 12:42:36PM +0530, Lloyd scratched on the wall:
 Hi,

 Which are all the type of SQLite APIs can return SQLITE_BUSY?

 sqlite3_open_v2
 sqlite3_prepare_v2

  All styles of these calls, not just the _v2 versions.

 sqlite3_step

  That's the big one.

 sqlite3_finalize

  sqlite3_reset() can as well, but in the case of both _finalize() and
  _reset() the call itself (e.g. the finalize operation or reset
  operation) will always work.  The error code is returned as the left
  over from sqlite3_step().  See the history between _prepare() and
  _prepare_v2().

 sqlite3_bind_blob
 sqlite3_column_int

  The sqlite3_column_xxx() and sqlite3_bind_xxx() calls should not.



  Additionally, sqlite3_blob_open() can, however, as can some of the
  sqlite3_backup_xxx() calls (they use _prepare/_step internally).
  sqlite3_exec() and sqlite3_get_table() as well.


  sqlite3_close() can also return SQLITE_BUSY, but it isn't a locking
  issue-- it just means you forgot to finalize all the statements.
  IIRC, there are one or two other functions that do something similar,
  but they're usually pretty obvious.

  I think that's the bulk of it, however.

   -j

 -- 
 Jay A. Kreibich  J A Y  @  K R E I B I.C H 

 Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable. -- Angela Johnson
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
 



__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] order of select result

2010-07-12 Thread Lloyd
Hi,

Lets assume that we have a very simple without any indexing or constraints. Now 
we have inserted some data to the table. When we do a simple select query, is 
it guranteed that the rows will be retrieved in the same order as they are 
inserted?

Thanks a lot,
  Lloyd


__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



Re: [sqlite] order of select result

2010-07-12 Thread Lloyd

Thanks Swithun. I dont have any supportive column in table to issue order 
by. Can it be achieved by issuing an ordr by query on row_id (used by 
sqlite internaly)?

Thanks,
  Lloyd

 Hello

 L Lets assume that we have a very simple without any indexing or
 Lconstraints. Now we have inserted some data to the table. When we do a
 Lsimple select query, is it guranteed that the rows will be retrieved
 Lin the same order as they are inserted?

 No. It may look like they are being selected in the order they were
 inserted. But there is no guarantee. So you should use an ORDER BY clause
 to get the order you want.

 Swithun.




__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Which SQLite API return SQLITE_BUSY?

2010-07-08 Thread Lloyd
Hi,

Which are all the type of SQLite APIs can return SQLITE_BUSY?

sqlite3_open_v2
sqlite3_prepare_v2
sqlite3_step
sqlite3_finalize
sqlite3_bind_blob
sqlite3_column_int

Thanks,
  Lloyd




__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite3_step returns sqlite_busy

2010-07-07 Thread Lloyd
Hi,

We have a multi-threaded application (I know threads are evil, but this is a 
small server application). Each thread tries to access the SQLite database. 
When trying to get a DB handle (sqlite3_open), if it returns SQLITE_BUSY, then 
the thread will wait for some time and try to open it again (until it gets the 
handle). In our case, two threads are running, one thread is preparing an 
INSERT statement (It returns SQLITE_OK), then it is executed using 
sqlite3_step. sqlite3_step returns an SQLITE_BUSY! Is there any possibility for 
this? ( I think these two threads are obtaining the DB handle at the same time 
using sqlite_open - with wrtie permission- is it possible?) I have tried 
compiling the application with both  -DSQLITE_THREADSAFE=2 and 
-DSQLITE_THREADSAFE=1.

Any hint would be very helpful...

Thanks a lot,
  Lloyd

__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] EXTERNAL: sqlite3_step returns sqlite_busy

2010-07-07 Thread Lloyd

- Original Message - 
From: Black, Michael (IS) michael.bla...@ngc.com
To: General Discussion of SQLite Database sqlite-users@sqlite.org
Sent: Wednesday, July 07, 2010 5:35 PM
Subject: Re: [sqlite] EXTERNAL: sqlite3_step returns sqlite_busy


Of course it's possible -- multiple clients accesing the database is just 
fine.

Is there any reason you need exclusive access for each thread in ping-pong 
mode?  If not, just handle the BUSY in both places.

I just want to ensure that the right data is read always. And also I want 
it to return the data always. (Even if the database is locked, I am ready to 
wait and open it)

You men to handle the BUSY by waiting for some time and trying to execute 
sqlite3_step?

Thanks a lot,
  Lloyd 



__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_step returns sqlite_busy

2010-07-07 Thread Lloyd
So it means we can have mor than one valid db handle?

Thanks,
  Lloyd

- Original Message - 
From: Pavel Ivanov paiva...@gmail.com
To: General Discussion of SQLite Database sqlite-users@sqlite.org
Sent: Wednesday, July 07, 2010 6:40 PM
Subject: Re: [sqlite] sqlite3_step returns sqlite_busy


 one thread is preparing an INSERT statement (It returns SQLITE_OK),
 then it is executed using sqlite3_step. sqlite3_step returns an
 SQLITE_BUSY! Is there any possibility for this?
 
 Sure. Preparing INSERT statement doesn't acquire any write locks on
 the database. It's executing the INSERT statement that acquires locks.
 So if while executing statement finds that it can't get the locks then
 sqlite3_step returns SQLITE_BUSY. And thread-safety is irrelevant
 here.
 
 
 Pavel
 


__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] View - What happens internally

2009-03-02 Thread Lloyd
Thank you Igor and Dan. Now I am clear about the concept.

On Sat, 28 Feb 2009 20:07:45 +0530, Dan danielk1...@gmail.com wrote:


 On Feb 28, 2009, at 8:44 PM, Lloyd wrote:


 Hi,

 When we create a view what happens internally in sqlite? Does it
 select
 all the data from the table and then insert it in to the view? or
 would
 the records in the view keep references to records in main table?
 just to
 know whether creating more views on a big in-memory database would
 require
 more memory.

 A view in SQLite is just a SELECT statement that is saved in the
 database
 schema. If you do:

CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM v1;

 The SQL compiler (the thing that runs when you call
 sqlite3_prepare_v2())
 converts the select statement to SELECT * FROM (SELECT * FROM t1)
 before compiling a prepared statement to implement the query.

 So adding a view doesn't require a huge amount of extra memory.

 Dan.




 Thanks,
   Lloyd

 __
 Scanned and protected by Email scanner
 ___
 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



__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL question, probably stuipid but ...

2009-02-17 Thread Lloyd

To escape ' use cosecutive ' , i.e ''

On Wed, 18 Feb 2009 10:32:28 +0530, J. R. Westmoreland j...@jrw.org wrote:

 I can't remember how to escape a ' in a string.

 My statement looks something like:

 insert . values ('DAY'S AVE' .);


 It's been a long day.

 Thanks in advance.


 J. R.


 

 J. R. Westmoreland

 E-mail: j...@jrw.org


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



__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Updating only the last raw

2008-10-17 Thread Lloyd
Thank you very much Dan.

On Fri, 2008-10-17 at 14:10 +0700, Dan wrote:
 On Oct 17, 2008, at 1:43 PM, Lloyd wrote:
 
  Hi,
 
  Lets assume a table having following data
 
  No. NameAddress
  
  1   A   addrA
  2   B   addrB
  3   C   addrC
  4   B   addrB1
 
  I want to update the filed 'Address' based on field 'Name'. But if  
  there
  are multiple table entries (The case of B), I just want to update the
  last entry in the table. How can I write a query for this?
 
  My present query is
 
  update mytab set Address=addr where name=B
 
 If you are using version 3.6.4 and compile with
 SQLITE_ENABLE_UPDATE_DELETE_LIMIT, then you can use the new
 syntax:
 
UPDATE mytab SET Address='addr' WHERE name='B' ORDER BY rowid DESC  
 LIMIT 1;
 
 Otherwise, you have to do:
 
UPDATE mytab SET Address='addr' WHERE rowid = (SELECT max(rowid)  
 FROM mytab WHERE name = 'B');
 
 
 Dan.
 
 
 
 
 
 
 
  The output of this query would be
 
  No. NameAddress
  
  1   A   addrA
  2   B   addr
  3   C   addrC
  4   B   addr
 
  But the Output we want is
 
  No. NameAddress
  
  1   A   addrA
  2   B   addrB
  3   C   addrC
  4   B   addr
 
 
  If my question is not clear, I am ready to explain it more...
 
 
 
  Thanks,
   Lloyd
 
 
 
  __
  Scanned and protected by Email scanner
  ___
  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


__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Testing sqlite

2008-04-30 Thread Lloyd
Hi,
  In the test folder of sqlite3 source distribution I saw so many test
scripts. How can I run these tests? I am curious to know the various
testing methods used in sqlite.

Thanks,
 Lloyd


__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] can't find libsqlite3.so.0 on RHEL

2008-03-13 Thread Lloyd
Hi Punkish,

I think after installing the library, and making the path entry in
the /etc/ld.so.conf (If it is not there), simply running the ldconfig
command will serve your need.

Regards,
  Lloyd

On Thu, 2008-03-13 at 12:09 -0500, P Kishor wrote:
 I am not at all conversant with RH Linux (RHEL-es3). I have just
 compiled sqlite3.5.6 from amalgamation, and I get the error that
 libsqlite3.so.0 can't be found. I did the following
 
 ../configure
 make  make install
 
 sqlite3 is place in /usr/local/bin
 and libsqlite3.so.0 is placed in /usr/local/lib
 
 [12:07 PM] /usr/local/lib$ ls -l libsql*
 -rw-r--r--1 root   765640 Mar 13 11:51 libsqlite3.a
 -rwxr-xr-x1 root  828 Mar 13 11:51 libsqlite3.la*
 lrwxrwxrwx1 root   19 Mar 13 11:51 libsqlite3.so -
 libsqlite3.so.0.8.6*
 lrwxrwxrwx1 root   19 Mar 13 11:51 libsqlite3.so.0 -
 libsqlite3.so.0.8.6*
 -rwxr-xr-x1 root   679734 Mar 13 11:51 libsqlite3.so.0.8.6*
 
 
 of course ldd -v does say
 
 [12:03 PM] ~$ ldd -v /usr/local/bin/sqlite3
 libsqlite3.so.0 = not found
 
 What extra step do I have to take on this computer to make sqlite3
 work properly?
 


__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] 64bit on 32bit machine

2007-07-12 Thread Lloyd
Hi,
  Can I know how SQLite performs 64bit operations (addition,
multiplication, division) on 32bit machine?

Thank you very much,
  Lloyd


__
Scanned and protected by Email scanner

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



Re: [sqlite] 64bit on 32bit machine

2007-07-12 Thread Lloyd
Thanks Andy.
So, SQLite doesn't have its own features to manage this? So I must be
able to perform 64bit operations on a 32bit machine using C. How can I
do that? or how to declare a 64bit integer on a 32bit machine?

Thanks,
  Lloyd



On Thu, 2007-07-12 at 15:06 -0500, Andrew Finkenstadt wrote:
 It uses the feature built-in to the language compiler that you use.
 
 In the case of Visual Studio (Microsoft, x86) the underlying compiler uses
 either the library implementations or direct assembly code using pairs of
 registers and whatever dual-register assembly instructions are available on
 the specific CPU.
 
 In the case of GCC, the underlying compiler uses whatever made sense in its
 library implementation.  Usually intrinsics are used in release mode, and
 library functions are used in debug mode.
 
 --andy
 
 On 7/12/07, Lloyd [EMAIL PROTECTED] wrote:
 
  Hi,
Can I know how SQLite performs 64bit operations (addition,
  multiplication, division) on 32bit machine?
 
  Thank you very much,
Lloyd
 
 
  __
  Scanned and protected by Email scanner
 
 
  -
  To unsubscribe, send email to [EMAIL PROTECTED]
 
  -
 
 


__
Scanned and protected by Email scanner

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



Re: [sqlite] Re: 64bit on 32bit machine

2007-07-12 Thread Lloyd
Thanks Igor :)

Regards,
  Lloyd

On Fri, 2007-07-13 at 00:18 -0400, Igor Tandetnik wrote:
 Lloyd lloyd-jowPkhCZOFef0DUV/[EMAIL PROTECTED] wrote:
  So, SQLite doesn't have its own features to manage this? So I must be
  able to perform 64bit operations on a 32bit machine using C. How can I
  do that? or how to declare a 64bit integer on a 32bit machine?
 
 Most modern compilers provide a long long type, usually mapped to a 
 64-bit integer on 32-bit machines. Consult the documentation for the 
 compiler you use.
 
 Igor Tandetnik 
 
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



Re: [sqlite] 64bit on 32bit machine

2007-07-12 Thread Lloyd
Thank you very much Andrew.

Regards,
 Lloyd

On Thu, 2007-07-12 at 23:37 -0500, Andrew Finkenstadt wrote:
 Use sqlite_int64 as your type.  That typedef supports 'long long' or 'signed
 __int64' or whatever the compiler environment needs.
 
 --a
 
 On 7/12/07, Lloyd [EMAIL PROTECTED] wrote:
 
  Thanks Andy.
  So, SQLite doesn't have its own features to manage this? So I must be
  able to perform 64bit operations on a 32bit machine using C. How can I
  do that? or how to declare a 64bit integer on a 32bit machine?
 
  Thanks,
Lloyd
 
 
 
  On Thu, 2007-07-12 at 15:06 -0500, Andrew Finkenstadt wrote:
   It uses the feature built-in to the language compiler that you use.
  
   In the case of Visual Studio (Microsoft, x86) the underlying compiler
  uses
   either the library implementations or direct assembly code using pairs
  of
   registers and whatever dual-register assembly instructions are available
  on
   the specific CPU.
  
   In the case of GCC, the underlying compiler uses whatever made sense in
  its
   library implementation.  Usually intrinsics are used in release mode,
  and
   library functions are used in debug mode.
  
   --andy
  
   On 7/12/07, Lloyd [EMAIL PROTECTED] wrote:
   
Hi,
  Can I know how SQLite performs 64bit operations (addition,
multiplication, division) on 32bit machine?
   
Thank you very much,
  Lloyd
   
   
__
Scanned and protected by Email scanner
   
   
   
  -
To unsubscribe, send email to [EMAIL PROTECTED]
   
   
  -
   
   
 
 
  __
  Scanned and protected by Email scanner
 
 
  -
  To unsubscribe, send email to [EMAIL PROTECTED]
 
  -
 
 


__
Scanned and protected by Email scanner

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



[sqlite] reserved chars in insert

2007-06-13 Thread Lloyd
Hi,
  I would like to know the reserved characters which cannot be used in
inserting a string.. (like ,',...).

Thanks in advance,
  Lloyd


__
Scanned and protected by Email scanner

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



Re: [sqlite] Copying the content of a table to another table

2007-06-05 Thread Lloyd
 create table x(c1 number,c2 number);
 create table y(v1 number,v2 number,v3 number,v4 number);
 insert into y (v1,v2) select c1,c2 from x;

or better you can use the alter table command on your old table (here x)

 alter table x add v3 number;
 alter table x add v4 number;

the following way doesn't seem to work for me

alter table x add (v3 number,v4 number);

Regards,
 Lloyd

On Tue, 2007-06-05 at 11:25 +0530, Kirrthana M wrote:
 Hi all,
 I have created a table with two columns c1 and c2 and inserted some
 values into,in future i may include some additional columns c3,c4. to
 the same table.In tat case i should not loose my data in the current
 table,so i should be able to copy the content of the current table(values of
 c1 and c2) to the new table and start working with the new table and delete
 the existing one,could anybody give me a suggestion for doing this.
 
 Regards
 Kirrthana


__
Scanned and protected by Email scanner

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



Re: [sqlite] Monitor Queries

2007-05-23 Thread Lloyd
On Wed, 2007-05-23 at 07:21 -0700, Joe Wilson wrote:
  I've a black-box (Linux) program - so no source available - using
 a
  sqlite database. Is there any way I can monitor/log the queries made
 to
  the database?
 
 If it's dynamically linked, just replace libsqlite3.so with your own.

How should be my own libsqlite3.so looking like. Can you explain the way
I should make the library? I would like to learn this technique :)

 If it is statically linked and has -g symbols, use gdb.
 If it's stripped, x86 assembler is not that hard to learn.
 

Thanks,
  Lloyd


__
Scanned and protected by Email scanner

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



Re: [sqlite] A suggestion

2007-05-09 Thread Lloyd
In old versions it work... But in new versions (3.* I think) its not
working!

On Wed, 2007-05-09 at 12:11 +0200, Peter van Dijk wrote:
 On 9-mei-2007, at 11:06, A.J.Millan wrote:
 
  As a suggestion, and even in the risk to abuse of Mr Hipp's  
  patience. Would
  it be possible to include in the command-line program (sqlite3.exe)  
  the
  ability to edit, an repeat at least the five or six last commands,  
  as in
  Linux?. Is to say with up-arrow and down-arrow.  I believe it would  
  be too
  helpful.
 
 Arrow up and down work fine for me, I'm not sure what your actual  
 request is then?
 
 Cheers, Peter.
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



Re: [sqlite] Sqlite 14 (cant open database)

2007-05-03 Thread Lloyd
This error occurs only on FAT 32 file system! I have a directory with
32764 files. one of the file is my sqlite database. It seems that, when
the file count reaches around this particular no. the SQLite cant open
database error occurs. Can anybody give me some hint? (I am mounting
FAT32 file system on my Linux)

Thanks and Regards,
  Lloyd


On Wed, 2007-04-25 at 10:13 +0530, Lloyd wrote:
 Hi,
  I am working on Redhat EL4, with sqlite3. In my application (written in
 C++ and wxWidgets, and I use wxSqlite3 wrapper) there a module which
 will be called repeatedly which in turn opens and closes the database
 each time the module is called. When the application runs (process the
 input) for short period of time (10 mins -small input) am not getting
 any error. But when it runs for around 1 hour (large input) I am getting
 an error called
 
 sqlite 14, cant open database !
 
 What could be the reason for this particular error?
 
 Thanks and regards,
   Lloyd
 
 



__
Scanned and protected by Email scanner

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



Re: [sqlite] Sqlite 14 (cant open database)

2007-05-03 Thread Lloyd
Thank you Arjen. I would consider your alternative or I will go for some
other file system. (Because I would have to handle files larger than
2GB)

Thanks and Regards,
 Lloyd

On Thu, 2007-05-03 at 13:52 +0200, Arjen Markus wrote:
 Lloyd wrote:
 
 This error occurs only on FAT 32 file system! I have a directory with
 32764 files. one of the file is my sqlite database. It seems that, when
 the file count reaches around this particular no. the SQLite cant open
 database error occurs. Can anybody give me some hint? (I am mounting
 FAT32 file system on my Linux)
 
   
 
 That is a very large number of files! I know FAT32 can not handle files 
 larger than
 2 GB, and I imagine there is limit on the number of files as well. Try 
 creating
 some subdirectories and moving the files there. The problem is most 
 likely in the filesystem.
 
 Regards,
 
 Arjen
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



[sqlite] Sqlite 14 (cant open database)

2007-04-24 Thread Lloyd
Hi,
 I am working on Redhat EL4, with sqlite3. In my application (written in
C++ and wxWidgets, and I use wxSqlite3 wrapper) there a module which
will be called repeatedly which in turn opens and closes the database
each time the module is called. When the application runs (process the
input) for short period of time (10 mins -small input) am not getting
any error. But when it runs for around 1 hour (large input) I am getting
an error called

sqlite 14, cant open database !

What could be the reason for this particular error?

Thanks and regards,
  Lloyd


__
Scanned and protected by Email scanner

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



Re: [sqlite] Data structure

2007-04-20 Thread Lloyd
Thank you John Stanton. This has opened new doors for me, and think it
would be helpful for others in the list too..

Thanks and Regards
Lloyd

On Thu, 2007-04-12 at 12:34 -0500, John Stanton wrote:
 We use a very simple data retrieval method for smallish datasets.  The 
 data is just stored in memory or as a memory mapped file and a 
 sequential search used.  It sounds crude but when you use a fast search 
 algorithm like Boyer-Moore it outperforms index methods up to a 
 surprisingly large number of records.  As you can imagine the code 
 footprint is miniscule and if you add regular expression logic you can 
 realize very intricate search patterns.
 
 We use the method in conjunction with a database to achieve an enormous 
 speed increase on LIKE type searches.  Grep a few files to get a feel 
 for the performance.
 
 Another method which works well for memory resident storage is to 
 implement self balancing AVL trees.  The code is simple and the 
 performance lightning fast.  With a little ingenuity you can use disk 
 storage.  Mini Sql (MSql) is a good example of how this can be effective.
 
 As Einstein said - Make it as simple as possible, but not too simple. 
 Applying Occam's Razor can turn bloated solutions into more 
 effective lean ones.  Typical solutions come in two sizes just like Army 
 boots - too big and too small.
 



__
Scanned and protected by Email scanner

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



[sqlite] Data structure

2007-04-11 Thread Lloyd
Hi,
I don't know whether this is an irrelevant question in SQLite list, but
I don't see a better place to ask.

Which data structure is best to store and retrieve data very fastly?
There is a 95% chance that the searched data to be present in the data
structure. There will be 1000s of nodes in the data structure and it
will be searched millions of times. The data is not in any ordered form.

Thanks for your information,

Lloyd


__
Scanned and protected by Email scanner

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



Re: [sqlite] Data structure

2007-04-11 Thread Lloyd
hi Puneet and Martin,
On Wed, 2007-04-11 at 14:27 +0100, Martin Jenkins wrote:
 File system cache and plenty of RAM?
 

It is meant to run on an end user system (eg. Pentium 4 1GB RAM). If you
mean Swap space as file system cache, it is also limited, may be 2GB.


Puneet Kishor
 you haven't provided any further details about the data itself so I
 would venture to say -- get a computer with gobs of RAM (the new Mac
 Pro 8-cores can accomodate 16 GB), and use a memory based hash. Query
 away.


Each node of the data structure will contain only very little data (A
structure sizing 70 bytes and the key field would be of size maximum of
20 bytes). (I will see, what is memory based hash)

Thanks and Regards,
  Lloyd


__
Scanned and protected by Email scanner

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



Re: [sqlite] Data structure

2007-04-11 Thread Lloyd

 
 I was just wondering what the odds were of doing a better job than the 
 filing system pros, how much time/code that would take on your part and 
 how much that time would cost versus speccing a bigger/faster machine.
 
 Martin

I am not fully clear. I just want my program to run at most efficient
and fast even on a low profile end user system. So I am in search for
the best data structure. 

I have heard about bloom filter, but in my case it is not applicable.
The final point is, I am just searching for a data structure which is
the result of lateral thinking by experts ;) (like bloom filter)

Thanks,
  Lloyd


__
Scanned and protected by Email scanner

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



Re: [sqlite] Data structure

2007-04-11 Thread Lloyd
On Wed, 2007-04-11 at 10:00 -0500, P Kishor wrote:
 I think, looking from Lloyd's email address, (s)he might be limited to
 what CDAC, Trivandrum might be providing its users.
 
 Lloyd, you already know what size your data sets are. Esp. if it
 doesn't change, putting the entire dataset in RAM is the best option.
 If you don't need SQL capabilities, you probably can just use
 something like BerkeleyDB or DBD::Deep (if using Perl), and that will
 be plenty fast. Of course, if it can't be done then it can't be done,
 and you will have to recommend more RAM for the machines (the CPU
 seems fast enough, just the memory may be a bottleneck).

Sorry, I am not talking about the limitations of the system in our side,
but end user who uses our software. I want the tool to be run at its
best on a low end machine also. 

I don't want the capabilities of a data base here. Just want to store
data, search for presence, remove it when there is no more use of it.

Surely I will check out BerkeleyDB. The data set must be in ram, because
the total size of it is very small. (Few maga bytes) I just want to
spped up the search, which is done millions of times.

Thanks,

 LLoyd


__
Scanned and protected by Email scanner

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



Re: [sqlite] Data structure

2007-04-11 Thread Lloyd
Thank you all. I got so many new ideas from your replies. Now I just
have to derive the best solution for me, thanks :)

Lloyd


On Wed, 2007-04-11 at 10:35 -0500, John Stanton wrote:
 You might discover that you can craft a very effective memory
 resident 
 storage system using a compression system like Huffman Encoding and
 an 
 index method appropriate to the key you are using for retrieval.
 That 
 could work very well in an embedded system, have a small footprint in 
 data and code and be very fast.


__
Scanned and protected by Email scanner

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



Re: [sqlite] Data structure

2007-04-11 Thread Lloyd
Would anybody suggest a good tool for performance measurement (on
Linux) ?

On Wed, 2007-04-11 at 10:35 -0500, John Stanton wrote:
 You might discover that you can craft a very effective memory
 resident 
 storage system using a compression system like Huffman Encoding and
 an 
 index method appropriate to the key you are using for retrieval.
 That 
 could work very well in an embedded system, have a small footprint in 
 data and code and be very fast.


__
Scanned and protected by Email scanner

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



[sqlite] What would you suggest?

2007-04-08 Thread Lloyd
Hi,

I want to store and retrieve sorted integer (these integers are file
offsets). So do I have to use SQLite or shall I store it in a file?
(Reading from the file will be easy by using fseek()). Which would be
efficient? SQLit or this file way? or do you have any other suggestions?
(In this case, I will have millions of integers to store and retrieve)

What the real data is a network packet dump file. I want to store and
retrieve the location of each packet, in order to make packet reading a
faster way from a very large dump file (in terms of GBs) 

Thanks,
  Lloyd


__
Scanned and protected by Email scanner

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



[sqlite] matching only part of a string

2007-03-27 Thread Lloyd K L
Hi,
  My table contains a text field called Name. Let the data be

Name
---
Abc
abcd
AB
cab
def

I want to selcct all the rows which contains the term ab (not case
sensitive). How can I do this?

Thanks in advance,
  Lloyd


-
This email was sent using SquirrelMail.
   Webmail for nuts!
http://squirrelmail.org/


__
Scanned and protected by Email scanner

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



[sqlite] C

2007-03-01 Thread Lloyd
Even though I know this is not the right question to ask this list, I
would expect some help from you.

The question is regarding C bit fields..

struct
{
 unsigned int a:1;
};

This declares a to hold 1 bit value;

How can I make an array of bit fields? something like, using the 16 bits
of a short as an array of bits

Thanks,
  Lloyd

Sorry for asking irrelevant question to this list. 


__
Scanned and protected by Email scanner

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



Re: [sqlite] Re: C

2007-03-01 Thread Lloyd
Thanks Igor. This is what I wanted.

On Thu, 2007-03-01 at 07:46 -0500, Igor Tandetnik wrote:
 Lloyd lloyd-jowPkhCZOFef0DUV/[EMAIL PROTECTED] wrote:
  How can I make an array of bit fields? something like, using the 16
  bits
  of a short as an array of bits
 
 You can't. But, if you can use C++ rather than C, there's std::bitset 
 class that does just that.
 
 Igor Tandetnik 
 
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



Re: [sqlite] C

2007-03-01 Thread Lloyd
Thanks John. yes, I am familiar with this way, I just wanted to know
whether there is a way to make bit field array. From Igor's reply I
understood that it is not possible in C.

Thanks,
 Lloyd

On Thu, 2007-03-01 at 09:48 -0600, John Stanton wrote:
 Use a mask to load from and store to your bit field/array by using a 
 bitwise AND ().
 
 Lloyd wrote:
  Even though I know this is not the right question to ask this list, I
  would expect some help from you.
  
  The question is regarding C bit fields..
  
  struct
  {
   unsigned int a:1;
  };
  
  This declares a to hold 1 bit value;
  
  How can I make an array of bit fields? something like, using the 16 bits
  of a short as an array of bits
  
  Thanks,
Lloyd
  
  Sorry for asking irrelevant question to this list. 
  
  
  __
  Scanned and protected by Email scanner
  
  -
  To unsubscribe, send email to [EMAIL PROTECTED]
  -
  
 
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



Re: [sqlite] Abuse of the SQLite website

2007-01-30 Thread Lloyd Thomas
Would not adding verification cause a problem for those include the 
downloading of sqlite in bash/make files of certain apps.


Lloydie T

- Original Message - 
From: Rich Shepard [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Tuesday, January 30, 2007 2:50 PM
Subject: Re: [sqlite] Abuse of the SQLite website



On Tue, 30 Jan 2007, Mark Richards wrote:


Returning a link that expires in an email to the requester is a method
that works nicely. It does require some programming and maintenance, but
would be a nice gatekeeper.


  Rather than this, I support the idea of an image with letters and digits
in various fonts or colors (so they cannot be readily harvested by OCR
methods) that are to be manually copied to a text entry field.

  I've no idea of the relative amounts of effort required by these 
different
approaches, but I suspect that such images are readily available on the 
Web

and a sufficiently large collection could be used with each presentation
being arbitrary. Perhaps once this is done -- and hidden from page source
view -- it would not need much maintenance.

  The inconvenience to us who access the site is the price we need to pay
given the abuse of the 'Net and the Web.

Rich

--
Richard B. Shepard, Ph.D.   |The Environmental Permitting
Applied Ecosystem Services, Inc.|  Accelerator(TM)
http://www.appl-ecosys.com Voice: 503-667-4517  Fax: 
503-667-8863


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




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



[sqlite] A little help with count

2007-01-13 Thread Lloyd Thomas


I wish to create a query where I do a number of counts on the same table but 
with different filters.

ie:
count(id) as numrows
count(id) as inrows where direction = 'In'
count(id) as outrows where direction = 'Out'

Could I do the above in a single query?

| id |  date  | direction | duration | cost |
| 1 |2007-01-01|In| 56 | 0.00 |
| 2 |2007-01-01|   Out  | 60 | 0.10 |
| 3 |2007-01-02|   Out  | 47 | 0.10 |
| 4 |2007-01-02|In| 120   | 0.20 |


Thx
Lloydie T 



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



Re: [sqlite] LEMON

2006-12-29 Thread Lloyd
Ethereal make use of Lemon

On Fri, 2006-12-29 at 11:08 -0400, Cesar Rodas wrote:
 Where can i find a tutorial with examples of how to use LEMON parser...
 because i need to build interpreted language
 
 Thanks to all


__
Scanned and protected by Email scanner

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



RE: [sqlite] Time zone conversion

2006-12-20 Thread Lloyd


Thanks Karthick. My code too works fine... (I made a small typo mistake in 
query, which executed silently)
But  I guess your method is the right one.

Regards,
  Lloyd

On Wed, 2006-12-20 at 16:54 +0530, Karthick V - TLS , Chennai wrote:
 Let the time zone given by user
 +0530
 
 Therefore its  330 minutes / 13200 seconds
 
 select datetime( StartTime,'unixepoch','+13200.0 seconds') from mytable
 --- gives you the local time
 
 Select datetime( StartTime,'unixepoch')gives u universal time
 
 Where StartTime is an integer(unixtimestamp stored in the database) 
 
 
 With Regards
  
 Karthick V
 
  
 Don't bother just to be better than your contemporaries or predecessors.
 Try to be better than yourself
 William Faulkner
 
 -Original Message-
 From: Lloyd [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, December 20, 2006 10:30 AM
 To: sqlite-users@sqlite.org
 Subject: [sqlite] Time zone conversion
 
 Hi,
   I would like to implement a time zone independent function. So I get the
 time zone information from user, and plans to convert the datetime to the
 time zone specified. To make it clear I give an example
 
 here StartTime is stored as an integer in the database
 
 select datetime(StartTime,'unixepoch') from mytable;
 
 will give the universal time.
 
 To get the local time, what I do is- Let the time zone given by user
 +0530
 
 convert   +0530 to seconds, =13200 ((5*60+30)*60), then 
 
 select datetime(StartTime+13200,'unixepoch') from mytable;
 
 But it is not working as I expected. (no result is shown)
 
 what could be the reason? Is there any better way for me to achieve the same
 result?
 
 Thanks and Regards,
   Lloyd
 
 
 __
 Scanned and protected by Email scanner
 
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 
 -
 DISCLAIMER 
 The contents of this e-mail and any attachment(s) are confidential and 
 intended for the 
 
 named recipient(s) only. It shall not attach any liability on the originator 
 or HCL or its 
 
 affiliates. Any views or opinions presented in this email are solely those of 
 the author and 
 
 may not necessarily reflect the opinions of HCL or its affiliates. Any form 
 of reproduction, 
 
 dissemination, copying, disclosure, modification, distribution and / or 
 publication of this 
 
 message without the prior written consent of the author of this e-mail is 
 strictly 
 
 prohibited. If you have received this email in error please delete it and 
 notify the sender 
 
 immediately. Before opening any mail and attachments please check them for 
 viruses and 
 
 defect.
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -
 


__
Scanned and protected by Email scanner

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



[sqlite] Time zone conversion

2006-12-19 Thread Lloyd
Hi,
  I would like to implement a time zone independent function. So I get
the time zone information from user, and plans to convert the datetime
to the time zone specified. To make it clear I give an example

here StartTime is stored as an integer in the database

select datetime(StartTime,'unixepoch') from mytable;

will give the universal time.

To get the local time, what I do is- Let the time zone given by user
+0530

convert   +0530 to seconds, =13200 ((5*60+30)*60), then 

select datetime(StartTime+13200,'unixepoch') from mytable;

But it is not working as I expected. (no result is shown)

what could be the reason? Is there any better way for me to achieve the
same result?

Thanks and Regards,
  Lloyd


__
Scanned and protected by Email scanner

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



[sqlite] Query generation

2006-12-06 Thread Lloyd
Hi,
 I am generating queries dynamically from my program based on the input.
The primary part of the query is always

select a from mytable where (b=0) and

based on the user input I add more where clauses to my query like

select a from mytable where (b=0) and (x=10)

but in one case there in no where clause to add, so my final query
become

select a from mytable where (b=0) and

and this is a syntax error.

Is there any option to add a null clause after the 'and' ?

Thanks,
  Lloyd


__
Scanned and protected by Email scanner

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



Re: [sqlite] Query generation

2006-12-06 Thread Lloyd
Thanks, 0=0 works well enough for me. (This hint is what I wanted)

Thanks again,
  Lloyd

On Wed, 2006-12-06 at 10:00 +0100, Mario Frasca wrote:
 Lloyd wrote:
 
 select a from mytable where (b=0) and
 
 and this is a syntax error.
   
 
 you're not saying which language you're using.
 
 in Python a common solution looks like this:
 clauses = []
 # add strings to the clauses list, like
 clauses.append('(b=0)')
 # join the parts using appropriate glue
 where = ' AND '.join(clauses)
 
 sometimes I do need something like what you call an empty clause...
 some engines accept 'TRUE', others don't know that literal.
 I find this quite convenient:
 '0=0'
 
 hth...
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



Re: [sqlite] Re: Re: ip2long

2006-12-05 Thread Lloyd
I feel little difficulty in understanding what you actually want (I
thing the same is for all...). So could make it more clear? so that your
problem can be solved fast!

Thanks,
  Lloyd.  


Yes, they are stored as INTEGER. and the conversion outside sqlite
 is simple. However, I still need to SELECT the range before displaying.
 And without doing SELECT *
 maybe I should use MySQL and NET_ATON / INET_NTOA
 but it would be much nicer and portable in SQLite
 
 Kind regards
 Kevin
 


__
Scanned and protected by Email scanner

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



Re: [sqlite] Re: Re: ip2long

2006-12-04 Thread Lloyd
The way I am dealing with this is...

First convert the IP to a 32bit integer. (In the system it will
represented as a 32bit integer)
Store it in the database.
Perform the comparison operations on this stored data.

Thanks,
  Lloyd


On Mon, 2006-12-04 at 22:07 -0500, Igor Tandetnik wrote:
 Kevin Waterson [EMAIL PROTECTED] wrote:
  This one time, at band camp, Igor Tandetnik
  [EMAIL PROTECTED] wrote:
  
  How is the range specified?
  
  
  In the database the IP is 1.2.3.4 and the range is eg: 65536
 
 I don't quite understand. To continue your example, exactly which IP
 addresses are considered to fall into the range 65536? How do you
 figure 1.2.3.4 is in this range, if indeed it is?
 
 Igor Tandetnik
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



[sqlite] Selection Time

2006-11-28 Thread Lloyd
Hi,
  How much time can it take to perform 2000 selection queries on the
same database ?  Mostly the result set will contain only 1 raw. Is there
is any way to improve the selection speed?

Thanks,
  Lloyd


__
Scanned and protected by Email scanner

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



Re: [sqlite] Music Files

2006-11-27 Thread Lloyd
I think, Through the command line mode it is impossible.

For this you have to write a program which open and reads the (binary)
data in file and inserts it to the sqlite database.

Thanks,
  Lloyd 

On Tue, 2006-11-28 at 13:36 +0800, LuYanJun wrote:
 Can anybody give a simple example for domestrating ?
 I am puzzled by this topic, how does a music file be sotred in DB as BLOB 
 type?
 
 TKS.
 - Original Message - 
 From: Alex Roston [EMAIL PROTECTED]
 To: sqlite-users@sqlite.org
 Sent: Saturday, October 28, 2006 4:35 AM
 Subject: Re: [sqlite] Music Files
 
 
  At one point there was a project that did something like this, and it 
  was called Route66. I think it used mysql, perl and a player called 
  splay. You might google it.
  
  Alex
  
  sebcity wrote:
  
 Is it possible to store mp3 files in a SSQLite database? would they be able
 to be played from the database? How would you save them?
   
 
  
  
  -
  To unsubscribe, send email to [EMAIL PROTECTED]
  -
  
 


__
Scanned and protected by Email scanner

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



Re: [sqlite] Journal file not getting deleted

2006-11-24 Thread Lloyd
Are you forgetting to close the database?

On Fri, 2006-11-24 at 02:03 -0800, mithin wrote:
 Hi,
 
 In my application I am using SQLite 3 c++ API. Everything works fine till my
 application is open. While doing any transaction a journal file is created.
 Once I close the app, the journal file is not getting deleted. Also, when I
 close open the application again, all the newly added data is lost.
 
 Is there anything that I am missing?
 
 Thanks a lot for your time.
 


__
Scanned and protected by Email scanner

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



[sqlite] Database Locked

2006-11-14 Thread Lloyd
Hi,
  I have opened a database, created tables and inserted data to it in a
single transaction. Then I have closed the data base. Then I reopened
the database and tried to update the table entries. But it throws an
exception called Database Locked. Where can be the mistake? I am using
wxSqlite3 wrapper class. All these are performed from a single program. 

Thanks,
  Lloyd.


__
Scanned and protected by Email scanner

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



Re: [sqlite] Database Locked

2006-11-14 Thread Lloyd
Thanks Clay Dowling,

Yes there is a function for fanalize function. Now the problem is
solved.


On Tue, 2006-11-14 at 08:02 -0500, Clay Dowling wrote:
 Lloyd,
 
 You need at some point to call the sqlite3_finalize function.  I don't use
 wxSqlite, but if it's not handled by the destructor of the recordset then
 there should be a method, possibly called finalize or close, that needs to
 be called.  I recommend consulting the documentation for wxSQLite since
 most of the wxWidgets components are pretty well documented.
 
 Clay Dowling
 
 Lloyd said:
  I have tracked down the problem and found th following.
 
  I have a select statement which stores the result set in a pointer
  variable. If the result set of select statement is empty, the program
  executes, otherwise it gives a Database Locked error.
 
  How can I solve this problem ?
 
  Thanks again,
Lloyd.
 
 
 
  On Wed, 2006-11-15 at 14:46 +0530, Lloyd wrote:
  Hi,
I have opened a database, created tables and inserted data to it in a
  single transaction. Then I have closed the data base. Then I reopened
  the database and tried to update the table entries. But it throws an
  exception called Database Locked. Where can be the mistake? I am using
  wxSqlite3 wrapper class. All these are performed from a single program.
 
  Thanks,
Lloyd.
 
 
  __
  Scanned and protected by Email scanner
 
  -
  To unsubscribe, send email to [EMAIL PROTECTED]
  -
 
 
  __
  Scanned and protected by Email scanner
 
  -
  To unsubscribe, send email to [EMAIL PROTECTED]
  -
 
 
 
 


__
Scanned and protected by Email scanner

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



Re: [sqlite] Database Locked

2006-11-14 Thread Lloyd
I have tracked down the problem and found th following.

I have a select statement which stores the result set in a pointer
variable. If the result set of select statement is empty, the program
executes, otherwise it gives a Database Locked error.   

How can I solve this problem ?

Thanks again,
  Lloyd.



On Wed, 2006-11-15 at 14:46 +0530, Lloyd wrote:
 Hi,
   I have opened a database, created tables and inserted data to it in a
 single transaction. Then I have closed the data base. Then I reopened
 the database and tried to update the table entries. But it throws an
 exception called Database Locked. Where can be the mistake? I am using
 wxSqlite3 wrapper class. All these are performed from a single program. 
 
 Thanks,
   Lloyd.
 
 
 __
 Scanned and protected by Email scanner
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



Re: [sqlite] PHP5 with SQLite3

2006-11-08 Thread Lloyd Thomas


- Original Message - 
From: Rúben Lício [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Wednesday, November 08, 2006 1:03 PM
Subject: [sqlite] PHP5 with SQLite3


Are you connecting correctly to the database. Which version of sqlite3 was 
the database created in. I beleive php5.1 is version 3.2.8



Hi,

I'm trying to use PHP5 with SQLite 3, but it's not working.

I see then the native PHP only suporte SQLite 2.8, but i can compile last
version of php with SQLite 3 suport.

O compile last PHP version with this line:
make clean  ./configure --prefix=/usr/local/php5 --enable-pdo
--with-sqlite=shared --with-pdo-sqlite=shared --with-zlib
--enable-track-vars --with-apxs2=/usr/local/apache2/bin/apxs
--enable-sqlite-utf8  make  make install

phpinfo tell-me that it is ok with SQLite 3 suport. But when I try to
execute query, i have that exception message:
'PDOException' with message 'SQLSTATE[HY000]: General error: 1 SQL logic
error or missing database' in ...

Anybody know how to correct that problem?

ty

Ruben

--
Linux user #433535
Linux because we are freedon.




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



[sqlite] Date data type

2006-11-07 Thread Lloyd
Hi,
  How can I manage date and time using sqlite? [Do I have to do it
outside sqlite?]

Thanks,
  Lloyd. 


__
Scanned and protected by Email scanner

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



Re: [sqlite] Date data type

2006-11-07 Thread Lloyd
Thanks gg and Craig Morrison for your informative reply.

I would like to know one more thing, can I use these date and time
functions with comparison operators? Will they return the correct result
or as per the string comparison rules?

Thanks again,
  Lloyd.

On Tue, 2006-11-07 at 04:25 -0500, Craig Morrison wrote:
 Lloyd wrote:
  Hi,
How can I manage date and time using sqlite? [Do I have to do it
  outside sqlite?]
 
 http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions
 


__
Scanned and protected by Email scanner

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



[sqlite] Retrieving date

2006-11-07 Thread Lloyd
Hi,
  I stored a unix epoch (32 bit integer) date in the sqlite data base. I
want to retrieve it in the readable date format. For that I use the
following query

select datetime(sdate,'unixepoch') from mytab;

It shows a formatted date, but there is some changes in the hours.

How can I retrieve the accurately converted date and time ?

Thanks,
 Lloyd.


__
Scanned and protected by Email scanner

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



[sqlite] Date and time

2006-11-07 Thread Lloyd
Hi,

I felt sqlite's date and time functions are very useful and suits my
needs.

But still am not clear about one thing. I gave the following query

select datetime(1162961284,'unixepoch');

2006-11-08 04:48:04

The date is correct but the time is 5 hours lagging. So for local time
correction I gave the following query

 select datetime(1162961284,'unixepoch','localtime');

 2006-11-08 10:18:04

The result is correct.

I would like to know how sqlite is performing the localtime correction. 

My problem is, I am getting these time stamps from network packets, And
I want to  display it accurately. (as in the localtime).

Which way can I prefer ?

Thanks,
  Lloyd.



__
Scanned and protected by Email scanner

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



Re: [sqlite] Date and time

2006-11-07 Thread Lloyd

Thanks Craig Morrison. Now I got the idea clearly.

On Wed, 2006-11-08 at 00:55 -0500, Craig Morrison wrote:
 Lloyd wrote:
   select datetime(1162961284,'unixepoch','localtime');
  
   2006-11-08 10:18:04
  
  The result is correct.
  
  I would like to know how sqlite is performing the localtime correction. 
 
 timestamps are in relation to UTC.. When you use the localtime modifier, 
 you are instructing the code to adjust the timestamp display in 
 accordance with your local settings. IOW, the offset from UTC of your 
 system is used in the calculation of the displayed date.
 
 Google: strftime, asctime and localtime for a better explanation.
 


__
Scanned and protected by Email scanner

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



Re: [sqlite] sqlite backup from the program.

2006-11-03 Thread Lloyd K. L
SQLite database is stored as a normal file in the disk. Why dont you use
Operating System calls to back up the file?



- Original Message -
From: [EMAIL PROTECTED]
To: sqlite-users@sqlite.org
Sent: Friday, November 03, 2006 2:18 PM
Subject: [sqlite] sqlite backup from the program.



Hi All,

How to take a backup of the sqlite database (dump) from the
C program.

Is there any C API for that? Or is there any mechanism to achieve it?



Please throw some light on it.



Thanks in Advance,

Regards,

Ravi K






The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not
the intended recipient, you should not disseminate, distribute or copy this
e-mail. Please notify the sender immediately and destroy all copies of this
message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The
company accepts no liability for any damage caused by any virus transmitted
by this email.

www.wipro.com


__
Scanned and protected by Email scanner

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



Re: [sqlite] sqlite backup from the program.

2006-11-03 Thread Lloyd K. L
Whether your database creation error solved? what was the problem?


- Original Message -
From: [EMAIL PROTECTED]
To: sqlite-users@sqlite.org
Sent: Friday, November 03, 2006 2:18 PM
Subject: [sqlite] sqlite backup from the program.



Hi All,

How to take a backup of the sqlite database (dump) from the
C program.

Is there any C API for that? Or is there any mechanism to achieve it?



Please throw some light on it.



Thanks in Advance,

Regards,

Ravi K






The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not
the intended recipient, you should not disseminate, distribute or copy this
e-mail. Please notify the sender immediately and destroy all copies of this
message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The
company accepts no liability for any damage caused by any virus transmitted
by this email.

www.wipro.com


__
Scanned and protected by Email scanner

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



Re: [sqlite] Memory Usage

2006-10-30 Thread Lloyd
I don't know whether I am right in this perspective. Just to know
whether sqlite is causing the high memory usage, comment the commands
(statements)  related to sqlite and check the memory status.  

Thanks,
  Lloyd.

On Mon, 2006-10-30 at 12:45 +, Nuno Lucas wrote:
 On 10/30/06, Ben Clewett [EMAIL PROTECTED] wrote:
  Nuno,
 
  Thanks for the excelent description of my error.  I have learnt a little
  more about Linux virtual memory model.  Very glad to hear Sqlite is as
  perfect as ever :)
 
  My problem, which is definitely my problem, is that 90 x 16MB of
  reserved memory is still a loss of 1.4G.  Especially as I use hardly any
  of it.
 
 Each process has it's own virtual address space, so 16MB of reserved
 virtual addresses (except when they are kernel addresses) for one
 process doesn't do nothing to the ammount of virtual addresses free
 for other processes. And as each process usually has 2/3GB of virtual
 addresses for it's own use, 16MB is pretty low (it depends on the
 system, but 2 GB is the most common minimum, on 32 bits).
 
 I still find strange that your program uses so much virtual addresses,
 but you didn't specify (or I don't recall) what language you are using
 and what libraries you are linking to. You may want to investigate
 this further.
 
 
 Regards,
 ~Nuno Lucas
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



Re: [sqlite] Regarding sqlite3_open

2006-10-28 Thread Lloyd
Which platform are you using? Do you (application) have enough
permission to create files in the specified location ?

On Sat, 2006-10-28 at 16:19 +0530, [EMAIL PROTECTED] wrote:
 Hi All,
 
 I am using sqlite3_open() in my program. It is returning
 error code 14(file not found) every time.
 
 Where does it search for the file? I even tried with the fully qualified
 path, Also placing the file in the working directory. Even if the file
 does not exist, it should create the file and return SQLITE_OK.
 
 Please throw some light on it.
 
 
 
 Thanks,
 
 Regards,
 
 Ravi K
 
 
 
 
 
 
 The information contained in this electronic message and any attachments to 
 this message are intended for the exclusive use of the addressee(s) and may 
 contain proprietary, confidential or privileged information. If you are not 
 the intended recipient, you should not disseminate, distribute or copy this 
 e-mail. Please notify the sender immediately and destroy all copies of this 
 message and any attachments.
 
 WARNING: Computer viruses can be transmitted via email. The recipient should 
 check this email and any attachments for the presence of viruses. The company 
 accepts no liability for any damage caused by any virus transmitted by this 
 email.
 
 www.wipro.com


__
Scanned and protected by Email scanner

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



Re: [sqlite] reg:SqliteDB file

2006-10-27 Thread Lloyd
Whether your question mean to open database file which is in some other
location?

If yes,

 we will be using the 


int sqlite3_open(const char *filename,sqlite3 **ppDb);


call to open the database. In that we will have to mention the file
name. There instead of using the file name simply, give the full path of
the file. It will work fine.

Thanks,
  Lloyd.

On Fri, 2006-10-27 at 12:17 +0530, sandhya wrote:
 Hi,
Is it possible to refer db file from other than the Current project 
 location.If Yes,How can we refer(tell) the location of the DB file to the 
 project.Please help me.
 
 Thank you all,
 - Sandhya


__
Scanned and protected by Email scanner

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



Re: [sqlite] Memory Usage

2006-10-27 Thread Lloyd
Most probably it will be a memory leak in your program. We must release
the dynamically allocated memory ourselves. So check whether you are
forgetting to do that. Most probably that leak will be happening inside
some loops or repeatedly calling functions.


On Fri, 2006-10-27 at 17:00 +0100, Ben Clewett wrote:
 Dear Sqlite,
 
 I very much enjoy using Sqlite, it is extremely useful.
 
 I have a memory usage query.
 
 I am linking to libsqlite3.so.0.8.6.  After calling sqlite3_open(...) I 
 find my programs data memory jumps by 16392 Kb.
 
 This seems a lot.  The database I am opening is only 26K in size.
 
 I have a similar process opening about 90 times.  This obviously 
 consumes a very large amount of memory, 1.4G with 90 processes.
 
 May I ask if this is what would be expected, and whether there is 
 anything I can do to lower this loading?
 
 Thanks for your help,
 
 Ben.
 
 
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



Re: [sqlite] encrypted file

2006-10-25 Thread Lloyd
Thanks for your informative reply. 

I would like to know, whether I can open a database which is created
using the sqlite API from a program, using the sqlite command line
client?

[I tried it using sqlite db name with full path  and it shown the
following error-

Unable to open database /root/userdb: file is encrypted or is not a
database .

How can I open the database using sqlite command line? ]

Thank you very much.

Lloyd.




On Tue, 2006-10-24 at 11:02 +, [EMAIL PROTECTED] wrote:
 Lloyd [EMAIL PROTECTED] wrote:
  Hi List,
   Whether the data base which we create through the program will be in
  encrypted form? 
 
 The public-domain version of SQLite does not encrypt the data.
 But commerical extensions that encrypt the data are available.
 See, for example, http://www.hwaci.com/sw/sqlite/prosupport.html#crypto
 
  
  If yes, how can I see the result in sqlite? (How can use select
  statements on this database?)
  
  My application creates a database and to analyze the results in the
  database, it will be easy for me to use the interface provided by the
  sqlite. How can I open the database in SQLite ?
  
 
 When a database is encrypted you must supply the encryption key
 before reading or modifying the database.  You can do this in
 several ways.  There is a pragma:
 
PRAGMA key=?
 
 If the database is being loaded using an ATTACH statement then
 you specify the key in the USING clause of the ATTACH:
 
ATTACH DATABASE 'encrypted.db' AS e2 USING :key
 
 Or you can use the C/C++ API:
 
sqlite3_key(db, zKey);
 
 Once the key is established, the database content is automatically
 decrypted as it is read from the disk and reencrypted as it is
 written back to the disk.
 
 If you use the command-line client, there is a special option
 to specify the key:
 
sqlite3 -key 'hello' database.db

 
 After that the command-line client works just like it normally
 does.
 
 None of the above works in the public domain version of SQLite.
 You have to purchase a license for a version of SQLite that 
 supports encryption in order to use these features.
 
 --
 D. Richard Hipp  [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -
 


__
Scanned and protected by Email scanner

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



Re: [sqlite] encrypted file

2006-10-25 Thread Lloyd
Sorry for my mistake.

I was creating database using sqlite3 API and trying to open it with
sqlite command line client version 2.7

Thanks a lot.
Lloyd.

On Wed, 2006-10-25 at 11:51 +0530, Lloyd wrote:
 Thanks for your informative reply. 
 
 I would like to know, whether I can open a database which is created
 using the sqlite API from a program, using the sqlite command line
 client?
 
 [I tried it using sqlite db name with full path  and it shown the
 following error-
 
 Unable to open database /root/userdb: file is encrypted or is not a
 database .
 
 How can I open the database using sqlite command line? ]
 
 Thank you very much.
 
 Lloyd.
 
 
 
 
 On Tue, 2006-10-24 at 11:02 +, [EMAIL PROTECTED] wrote:
  Lloyd [EMAIL PROTECTED] wrote:
   Hi List,
Whether the data base which we create through the program will be in
   encrypted form? 
  
  The public-domain version of SQLite does not encrypt the data.
  But commerical extensions that encrypt the data are available.
  See, for example, http://www.hwaci.com/sw/sqlite/prosupport.html#crypto
  
   
   If yes, how can I see the result in sqlite? (How can use select
   statements on this database?)
   
   My application creates a database and to analyze the results in the
   database, it will be easy for me to use the interface provided by the
   sqlite. How can I open the database in SQLite ?
   
  
  When a database is encrypted you must supply the encryption key
  before reading or modifying the database.  You can do this in
  several ways.  There is a pragma:
  
 PRAGMA key=?
  
  If the database is being loaded using an ATTACH statement then
  you specify the key in the USING clause of the ATTACH:
  
 ATTACH DATABASE 'encrypted.db' AS e2 USING :key
  
  Or you can use the C/C++ API:
  
 sqlite3_key(db, zKey);
  
  Once the key is established, the database content is automatically
  decrypted as it is read from the disk and reencrypted as it is
  written back to the disk.
  
  If you use the command-line client, there is a special option
  to specify the key:
  
 sqlite3 -key 'hello' database.db
 
  
  After that the command-line client works just like it normally
  does.
  
  None of the above works in the public domain version of SQLite.
  You have to purchase a license for a version of SQLite that 
  supports encryption in order to use these features.
  
  --
  D. Richard Hipp  [EMAIL PROTECTED]
  
  
  -
  To unsubscribe, send email to [EMAIL PROTECTED]
  -
  


__
Scanned and protected by Email scanner

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



[sqlite] hexadecimal

2006-10-25 Thread Lloyd
Hi list,
  can I insert a hexadecimal value to an integer field? if yes How can
do that?

Thanks,
  Lloyd


__
Scanned and protected by Email scanner

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



[sqlite] number problem with 3.2.8

2006-10-25 Thread Lloyd Thomas
I am using sqlite 3.2.8 which is included in PHP5.1. I seem to be having a 
problem doing queries where with '' to search a number.
for instance if I do the following

select  ring_time fron calls where ring_time  '10';
I get the following results
3
6
3
6
3
6
2
3
3
3
2
etc.
Why? 
This row is varchar. Is 3.2.8 not able to work with numbers stored as varchar? 


Re: [sqlite] Re: number problem with 3.2.8

2006-10-25 Thread Lloyd Thomas
I did try number literal  10 but mad no difference. I will rebuild the 
database row as an integer.

Lloyd
- Original Message - 
From: Igor Tandetnik [EMAIL PROTECTED]

To: SQLite sqlite-users@sqlite.org
Sent: Thursday, October 26, 2006 12:21 AM
Subject: [sqlite] Re: number problem with 3.2.8



Lloyd Thomas
lloydie-t-d/OCxD/[EMAIL PROTECTED] wrote:

I am using sqlite 3.2.8 which is included in PHP5.1. I seem to be
having a problem doing queries where with '' to search a number.
for instance if I do the following

select  ring_time fron calls where ring_time  '10';
I get the following results
3
6
3
6
3
6
2
3
3
3
2
etc.
Why?
This row is varchar. Is 3.2.8 not able to work with numbers stored as
varchar?


I don't see any problem. '3' is indeed greater than '10' in alphabetic 
order. What did you expect?


If you want the values to compare as numbers, why do you store them in a 
string field, and why do you compare against a string literal '10' rather 
than numeric literal 10 ?


Igor Tandetnik

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




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



[sqlite] encrypted file

2006-10-24 Thread Lloyd
Hi List,
 Whether the data base which we create through the program will be in
encrypted form? 

If yes, how can I see the result in sqlite? (How can use select
statements on this database?)

My application creates a database and to analyze the results in the
database, it will be easy for me to use the interface provided by the
sqlite. How can I open the database in SQLite ?

Thanks,
  Lloyd.


__
Scanned and protected by Email scanner

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



[sqlite] insertion time

2006-10-23 Thread Lloyd
Hi,
  How much time it may take to insert or ignore into query for 30
lakhs times. It adds more than 130 sec overhead compared to the 20 sec
of execution time. All these are done inside a single transaction. And
these insertions are made on three tables (on each table 10 lakhs) with
a combined primary key of text and integer.

Is this the expected performance? Can I improve it anyway? (I am using
the wxSQLite wrapper class)

Thanks,
  Lloyd.


__
Scanned and protected by Email scanner

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



Re: [sqlite] insertion time

2006-10-23 Thread Lloyd
Hi,
  When this 3M inserts are performed, it takes 130 more seconds compared
to the actual application running time. The actual application run time
is 20 seconds but when this 3M inserts are performed it takes 150
seconds.

Is there any way to reduce the time ?

Thnaks,
  Lloyd.



On Mon, 2006-10-23 at 08:44 -0600, Dennis Cote wrote:
 Lloyd wrote:
  Hi,
How much time it may take to insert or ignore into query for 30
  lakhs times. It adds more than 130 sec overhead compared to the 20 sec
  of execution time. All these are done inside a single transaction. And
  these insertions are made on three tables (on each table 10 lakhs) with
  a combined primary key of text and integer.
 
  Is this the expected performance? Can I improve it anyway? (I am using
  the wxSQLite wrapper class)
 
  Thanks,
Lloyd.
 
 
  __

 All,
 
 FYI, a lakh is defined as:
 
 A lakh (also spelled lac or laksha) is a unit in a traditional number 
 system, still widely used in India and Bangladesh, equal to a hundred 
 thousand. A hundred lakhs make a crore.
 
 So Lloyd is doing 3M insert or ignores.
 
 Lloyd,
 
 What do you mean by 130 seconds of overhead?
 
 Dennis Cote
 
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



[sqlite] See table structure

2006-10-20 Thread Lloyd
Hi List,
  In SQLite, to see the table structure which command can I use? 
  (as in Oracle's desc table name )
Thanks,
  Lloyd



__
Scanned and protected by Email scanner

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



[sqlite] Inserting uniquely

2006-10-20 Thread Lloyd
Hi List,
  Is there is any easy way to insert a value to a table, if and only if
it is not existing ? 

For example.

If I have these values 1,2,3,4,1,2,3,4
when I insert these to a table

it must be 
1
2
3
4

[By using primary key or unique constraint, it will work. But I dont
want sqlite to throw error]

How can I get this done?

Thanks,
  Lloyd. 


__
Scanned and protected by Email scanner

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



[sqlite] wxSqlite- Long Insertion time

2006-10-10 Thread Lloyd
Hi All,
  I am using wxSqlite to develop my application. I have an insert query
in my application. It adds a 16 seconds overhead to my application,
otherwise it executes in 20 seconds. (Now it needs 36 seconds!). 

Where could be the problem? The insert query is executing only 1000
times.

Thanks,
  Lloyd.


__
Scanned and protected by Email scanner

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



Re: [sqlite] wxSqlite- Long Insertion time

2006-10-10 Thread Lloyd

 Are these inserts in 1 transaction or 1000?

Yes it is in 1000 transactions.

For me consistancy, atomicity...(ACID) are not a problem. But the speed
of operation is major constraint. How can I achieve speed in insertion
cases like this? 

Thanks for your informative reply.

Lloyd.

On Tue, 2006-10-10 at 12:51 +0100, Martin Jenkins wrote:
 Lloyd wrote:
  Where could be the problem? The insert query is executing only 1000 
  times.
 
 Are these inserts in 1 transaction or 1000? If the latter then it will 
 take a long time because sqlite has to wait 1000 times for the data to 
 be written to the disk. It's generally accepted that this takes about 2 
 revs of the disk - 2000 revs at 7200rpm is about 20 seconds.
 
 Martin
 
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



Re: [sqlite] Regarding sqlite3_exec

2006-10-06 Thread Lloyd
I think you are asking for this... This is the case when we use
wxSQLite3.


wxSQLite3ResultSet result = samp.ExecuteQuery(wxT(select name,age from
test));

  while (result.NextRow())
  {
   cout  (const char*)(result.GetString(0).mb_str())  result.GetInt
(1) endl;
  }

On Fri, 2006-10-06 at 17:07 +0530, Vivek R wrote:
 Hi List,
   If I use sqlite3_exec to query a database,
 How can I know that the results in the data base got over. For example If
 I am expecting a 10 results in some for loop and actually there are only
 five results , How can I get a notification or return value that the
 results completed or Is there any way I can get SQLITE_DONE through
 sqlite3_Exec.  What return value I will get If I query an empty table.
 
 
 Thanks and Regards,
   Vivek R


__
Scanned and protected by Email scanner

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



[sqlite] Installing Library

2006-10-03 Thread Lloyd
Hi All,
  I have downloaded the SQLite library (sqlite-3.3.7.so.gz) from the
homepage. But I don't know how to install it. Please help me. My Redhat
Enterprise Linux machine runs on i386 architecture. 

Thanks and Regards,
  Lloyd.



__
Scanned and protected by Email scanner

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



Re: [sqlite] SQLite under linux

2006-09-27 Thread Lloyd
Thanks everybody, I have downloaded the library RPM from
http://rpm.pbone.net/

and the library name is 

libsqlite-3.2.1-1.i386.rpm

It may be useful for newbie like me...

and did as what you said. And works fine...

Thanks, 
 Lloyd.


On Wed, 2006-09-27 at 10:08 +0200, Markus Hoenicka wrote:
 Lloyd [EMAIL PROTECTED] was heard to say:
 
  Unfortunately, I don't know how to install this library in my system.
  Please help me.. If I am dealing with the wrong file, please let me know
  from where I can get the needed installable library.
 
 
 Maybe you should tell us which system you run. Most Linux distributions offer
 SQLite as an easy-to-install package. E.g. on Debian you'd do something like:
 
 apt-get install libsqlite3-dev libsqlite3-0 sqlite3
 
 Once that is installed, you'll just have to insert the sqlite header file into
 your sources and add -lsqlite3 to your gcc command line in order to build an
 app that uses SQLite.
 
 regards,
 Markus
 


__
Scanned and protected by Email scanner

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



[sqlite] SQLite under linux

2006-09-26 Thread Lloyd
Hi all,
  I have been trying to use SQLite with Redhat EL 4. I dont know how to
link the object file. I have downloaded the sqlite-3.3.7.so. but I don't
know how to link my source file with this file. 

As mentioned in the quick start guide I have copied the example source
code for C.

though I could not find the sqlite3.h file, I downloaded the source code
file of the sqlite and executed the ../configure command. it worked file

then I tried to make  the file, but it failed,  any how I got the
necessary sqlite3.h file.

But still I don't know from where to download the sqlite library and how
to install it in my machine. Awaiting for your kind reply.

Thanks and regards,
  Lloyd.


__
Scanned and protected by Email scanner

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



Re: [sqlite] SQLite under linux

2006-09-26 Thread Lloyd Thomas

Hi Lloyd,
   I had exactly the same problem being new to C++. These are the 
steps I took. You may find that the library files may be in a folder where 
RH does not expect them to be. Try 'whereis libsqlite3.so' to locate. I 
can't remember where the default lib folder is. you will need to 
add -lsqlite3 in your Makefile or compile your code with -lsqlite3. You 
don't mention what errors you get when the make files. Some may be able to 
help you further if they have that information.


Lloyd T

- Original Message - 
From: Lloyd [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Tuesday, September 26, 2006 12:45 PM
Subject: [sqlite] SQLite under linux



Hi all,
 I have been trying to use SQLite with Redhat EL 4. I dont know how to
link the object file. I have downloaded the sqlite-3.3.7.so. but I don't
know how to link my source file with this file.

As mentioned in the quick start guide I have copied the example source
code for C.

though I could not find the sqlite3.h file, I downloaded the source code
file of the sqlite and executed the ../configure command. it worked file

then I tried to make  the file, but it failed,  any how I got the
necessary sqlite3.h file.

But still I don't know from where to download the sqlite library and how
to install it in my machine. Awaiting for your kind reply.

Thanks and regards,
 Lloyd.


__
Scanned and protected by Email scanner

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




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



Re: [sqlite] SQLite under linux

2006-09-26 Thread Lloyd
Hi,
  This too doesn't work. First of all I did not install the library,
instead I copied the sqlite-3.3.7.so file to the lib folder. Then ran
the ldconfig command. Then I compiled gcc sqlite.c -o sqlite -
l /usr/lib/sqlite-3.3.7

It is giving the error ld connot find the file
called /usr/lib/sqlite-3.3.7

How can I solve this? From where do I can get an installable copy if the
SQLite library for linux?

Thanks,
 Lloyd.

On Tue, 2006-09-26 at 13:17 +0100, Lloyd Thomas wrote:
 Hi Lloyd,
 I had exactly the same problem being new to C++. These are the 
 steps I took. You may find that the library files may be in a folder where 
 RH does not expect them to be. Try 'whereis libsqlite3.so' to locate. I 
 can't remember where the default lib folder is. you will need to 
 add -lsqlite3 in your Makefile or compile your code with -lsqlite3. You 
 don't mention what errors you get when the make files. Some may be able to 
 help you further if they have that information.
 
 Lloyd T
 
 - Original Message - 
 From: Lloyd [EMAIL PROTECTED]
 To: sqlite-users@sqlite.org
 Sent: Tuesday, September 26, 2006 12:45 PM
 Subject: [sqlite] SQLite under linux
 
 
  Hi all,
   I have been trying to use SQLite with Redhat EL 4. I dont know how to
  link the object file. I have downloaded the sqlite-3.3.7.so. but I don't
  know how to link my source file with this file.
 
  As mentioned in the quick start guide I have copied the example source
  code for C.
 
  though I could not find the sqlite3.h file, I downloaded the source code
  file of the sqlite and executed the ../configure command. it worked file
 
  then I tried to make  the file, but it failed,  any how I got the
  necessary sqlite3.h file.
 
  But still I don't know from where to download the sqlite library and how
  to install it in my machine. Awaiting for your kind reply.
 
  Thanks and regards,
   Lloyd.
 
 
  __
  Scanned and protected by Email scanner
 
  -
  To unsubscribe, send email to [EMAIL PROTECTED]
  -
  
 
 
 -
 To unsubscribe, send email to [EMAIL PROTECTED]
 -


__
Scanned and protected by Email scanner

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



[sqlite] SQLite under linux

2006-09-26 Thread Lloyd
: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type
.../src/tclsqlite.c:152: error: dereferencing pointer to incomplete type




and the error continues


How can I resole this. Please help me...

Can I use the library alone without recompiling the whole sqlite? (Thus
it will be easier for me to distribute my application along with sqlite)


Thanks and regards,
  Lloyd. 







On Tue, 2006-09-26 at 07:52 -0400, Mark Richards wrote:
 To use the library, either in shared or static mode, you must first 
 build it successfully and then install it,
 
 Please tell us your build procedure and any errors you got.
 
 /m
 
 Lloyd wrote:
  
  then I tried to make  the file, but it failed,  any how I got the
  necessary sqlite3.h file.
  
  But still I don't know from where to download the sqlite library and
how
  to install it in my machine. Awaiting for your kind reply.
  
 
 

-
 To unsubscribe, send email to [EMAIL PROTECTED]

-




__
Scanned and protected by Email scanner

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



Re: [sqlite] SQLite under linux

2006-09-26 Thread Lloyd
On Tue, 2006-09-26 at 19:18 +0100, Martin Jenkins wrote:
 If all you want to do is build an application using (some version of) 
 sqlite then just download the library and link against it - you don't 
 have to download the SQLite source and build it.
 

Thanks Martin, I too wanted the same only. But I don't know how to
download and install the library on my Linux. I went to the download
section of the SQLite site and found  a file called sqlite-3.3.7.so.gz.
I think this is the library which I want.

Unfortunately, I don't know how to install this library in my system.
Please help me.. If I am dealing with the wrong file, please let me know
from where I can get the needed installable library.

Thanks for your clear and patient reply.

Thanks,
  Lloyd. 




__
Scanned and protected by Email scanner

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



Re: [sqlite] Compiling PHP5 in order to use SQLite3

2006-09-15 Thread Lloyd Thomas
I far as i know you compile with php5-pdo-sqlite, but this was only tested 
on debian. Last time i looked this supports sqlite 3.2.8 and you have to use 
php's pdo functions and not the sqlite functions which only work with v2.


- Original Message - 
From: Michael Young [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Friday, September 15, 2006 10:42 PM
Subject: [sqlite] Compiling PHP5 in order to use SQLite3



I'm not a Unix programmer, but I would like to compile PHP5 so that
it will be able to read/write SQLite3 files on my Mac.

In particular, I have tried to follow the installation script
suggested at www.phpmac.com for Apache 2.2.2 and PHP 5.1.4. However,
this only results in a compilation that recognizes SQLite2 files.

If anyone can offer advice on compiling on Mac OS Tiger, I would be
most appreciative. Thanks in advance.

Here's the script (modified in bold from the one suggested at
www.phpmac.com) I have been using without success:

./configure --prefix=/apache2/php --with-zlib --enable-pdo=shared -- 
with-pdo-sqlite=shared --with-sqlite=shared --with-xml --with-ldap=/
usr --enable-cli --with-zlib-dir=/usr --enable-exif --enable-ftp -- 
enable-mbstring --enable-mbregex --enable-dbx --enable-sockets --with-

iodbc=/usr --with-curl=/usr --with-apxs2=/apache2/bin/apxs

Regards,
Mike







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



Re: Re[2]: [sqlite] A lillte help adding sqlite to a c program

2006-09-11 Thread Lloyd Thomas
I am still having some problems compiling my code. I suspect it maybe 
something to do with my app not linking (ld) with sqlite libraries, but I do 
not know how to do this or it could be something else.

Can you advise?
-
/usr/src/logger-1.2-beta3/src/logger.cpp:731: undefined reference to 
`sqlite3_open'
logger.o(.text+0xc99):/usr/src/logger-1.2-beta3/src/logger.cpp:732: 
undefined reference to `sqlite3_exec'
logger.o(.text+0xcae):/usr/src/logger-1.2-beta3/src/logger.cpp:735: 
undefined reference to `sqlite3_free'
logger.o(.text+0xcbf):/usr/src/logger-1.2-beta3/src/logger.cpp:737: 
undefined reference to `sqlite3_close'

collect2: ld returned 1 exit status
make: *** [logger] Error 1



- Original Message - 
From: [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Sunday, September 10, 2006 1:32 PM
Subject: Re: Re[2]: [sqlite] A lillte help adding sqlite to a c program


On Sun, 10 Sep 2006 13:02:58 +0100, you wrote:


Thanks Teg,
I have been trying to do using a basic example but still
running into problems. Can you expand a little more on your example below.
This is where I am so far.
I am getting a bit closer bit still getting some errors. clearly I am still
getting something wrong with the format of snprintf. any ideas?


Hello Lloydie

If you use a MS Compiler like VC++ 6 or VC++ 7 Net you can look at
my HP. There is a little Example and a Wrapperclass simple to
understand, desgined to handle small Databases.

http://www.thlu.de

Best Regards
Thomas


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


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



Re: Re[2]: [sqlite] A lillte help adding sqlite to a c program

2006-09-10 Thread Lloyd Thomas

Thanks Teg,
   I have been trying to do using a basic example but still 
running into problems. Can you expand a little more on your example below. 
This is where I am so far.
I am getting a bit closer bit still getting some errors. clearly I am still 
getting something wrong with the format of snprintf. any ideas?

errors:
logger.cpp: In function `void* start_one_channel(void*)':
logger.cpp:607: error: invalid conversion from `const char*' to `size_t'
logger.cpp:607: error:   initializing argument 2 of `int snprintf(char*, 
size_t, const char*, ...)'

logger.cpp:629: error: jump to case label
logger.cpp:603: error:   crosses initialization of `char*zErrMsg'
make: *** [logger.o] Error 1
---

code:-
char *zErrMsg = 0;
   char *sql;
   int rc;
   sqlite3 *db;
   snprintf(sql, insert into call_data (direction, call_time, dest, 
trunk_no, file_name)values(\'%s\',\'%s\',\'%s\',\'%s\',\'%s\'), 
details.inout, details.statime,details.cidn, 
details.channel,details.filename);//line 607
   rc = sqlite3_open(/var/tmp/logger/database/logger.db, db); //line 
608

   rc = sqlite3_exec(db, sql, NULL, 0, zErrMsg);
   if( rc!=SQLITE_OK ){
   //fprintf(stderr, SQL error: %s\n, zErrMsg);
   sqlite3_free(zErrMsg);
   }
   sqlite3_close(db);
---

Lloydie T


- Original Message - 
From: Teg [EMAIL PROTECTED]

To: Lloyd Thomas sqlite-users@sqlite.org
Sent: Sunday, September 10, 2006 12:47 AM
Subject: Re[2]: [sqlite] A lillte help adding sqlite to a c program



Hello Lloyd,

You need to escape the quotes. Remember in C and C++  means the
beginning or end of a literal string so, when you want to embed quotes
in a string you have to escape them. Probaby \.

You'd be better off using the paramaterized version of the SQL

std::string sql = insert into call_data (direction, call_time, dest, 
trunk_no,

file_name)values(?,?,?,?,?);;

Then bind the actual parameters after the fact.

C


Saturday, September 9, 2006, 7:02:43 PM, you wrote:

LT Jay, Thanks for your reply.
LT I gave it a try with and got a few errors. as follows
LT ---
LT logger.cpp:609: error: invalid operands of types `const char[80]' and
LT `char[4]' to binary `operator+'
LT logger.cpp:615: error: `t' was not declared in this scope
LT logger.cpp:615: warning: unused variable 't'
LT logger.cpp:634: error: jump to case label
LT logger.cpp:631: error:   crosses initialization of `std::string test2'
LT logger.cpp:628: error:   crosses initialization of `std::string test1'
LT logger.cpp:637: error: jump to case label
LT logger.cpp:631: error:   crosses initialization of `std::string test2'
LT logger.cpp:628: error:   crosses initialization of `std::string test1'
LT logger.cpp:638: error: jump to case label
LT logger.cpp:631: error:   crosses initialization of `std::string test2'
LT logger.cpp:628: error:   crosses initialization of `std::string test1'
LT logger.cpp:639: error: jump to case label
LT logger.cpp:631: error:   crosses initialization of `std::string test2'
LT logger.cpp:628: error:   crosses initialization of `std::string test1'
LT logger.cpp:641: error: `t' was not declared in this scope
LT logger.cpp:641: warning: unused variable 't'
LT logger.cpp:664: error: jump to case label
LT logger.cpp:621: error:   crosses initialization of `bool Loop'
LT logger.cpp:634: warning: destructor needed for `test2'
LT logger.cpp:634: warning: where case label appears here
LT logger.cpp:634: warning: (enclose actions of previous case statements
LT requiring destructors in their own scope.)
LT logger.cpp:637: warning: destructor needed for `test2'
LT logger.cpp:637: warning: where case label appears here
LT logger.cpp:638: warning: destructor needed for `test2'
LT logger.cpp:638: warning: where case label appears here
LT logger.cpp:639: warning: destructor needed for `test2'
LT logger.cpp:639: warning: where case label appears here
LT make: *** [logger.o] Error 1
LT --
LT line 609 =
LT sql = insert into call_data (direction, call_time, dest, trunk_no,
LT 
file_name)values('+details.inout+','+details.statime+','+details.cidn+'+details.channel+','+details.filename+');







LT - Original Message - 
LT From: Jay Sprenkle [EMAIL PROTECTED]

LT To: sqlite-users@sqlite.org
LT Sent: Saturday, September 09, 2006 11:16 PM
LT Subject: Re: [sqlite] A lillte help adding sqlite to a c program



On 9/9/06, Lloyd Thomas [EMAIL PROTECTED] wrote:

I know nothing of C++ and therefore need a lilte help editing a C++ app
to
insert some records into a database.


here's an example to read from a database.
If you build the sql like you're doing and you use it on the web you
leave yourself
open to sql injection attacks. Using the bind

Re: Re[2]: [sqlite] A lillte help adding sqlite to a c program

2006-09-10 Thread Lloyd Thomas

Nearly there just a couple of outstanding issues any help apreciated

Error:--
make: Warning: File `logger.cpp' has modification time 45 s in the future
g++  -c -Wall -O -g logger.cpp -o logger.o
logger.cpp: In function `void* start_one_channel(void*)':
logger.cpp:607: warning: format argument is not a pointer (arg 6)
logger.cpp:629: error: jump to case label
logger.cpp:603: error:   crosses initialization of `char*zErrMsg'
make: *** [logger.o] Error 1



code sample:---
char *zErrMsg = 0;
   char sql[200];
   int rc;
   sqlite3 *db;
   sprintf(sql, insert into call_data (direction, call_time, dest, 
trunk_no, file_name)values('%s','%s','%s','%s','%s'), details.inout, 
details.statime,details.cidn,channel,details.filename);

   rc = sqlite3_open(/var/tmp/logger/database/logger.db, db);
   rc = sqlite3_exec(db, sql, NULL, 0, zErrMsg);
   if( rc!=SQLITE_OK ){
   //fprintf(stderr, SQL error: %s\n, zErrMsg);
   sqlite3_free(zErrMsg);
   }
   sqlite3_close(db);
   LOGIT([%02d] sql string = %s\n,channel,sql);


 // Clear out details ready for next call
 details.inout[0] = 0;
 details.filename[0] = 0;
 details.statime[0] = 0;
 details.endtime[0] = 0;
 details.cidn[0] = 0;
 details.cidt[0] = 0;
 strcpy(details.term, );
   break;

default:  // Any thing else ??
 break;

}
break;
-


- Original Message - 
From: [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Sunday, September 10, 2006 1:32 PM
Subject: Re: Re[2]: [sqlite] A lillte help adding sqlite to a c program


On Sun, 10 Sep 2006 13:02:58 +0100, you wrote:


Thanks Teg,
I have been trying to do using a basic example but still
running into problems. Can you expand a little more on your example below.
This is where I am so far.
I am getting a bit closer bit still getting some errors. clearly I am still
getting something wrong with the format of snprintf. any ideas?


Hello Lloydie

If you use a MS Compiler like VC++ 6 or VC++ 7 Net you can look at
my HP. There is a little Example and a Wrapperclass simple to
understand, desgined to handle small Databases.

http://www.thlu.de

Best Regards
Thomas


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


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



[sqlite] A lillte help adding sqlite to a c program

2006-09-09 Thread Lloyd Thomas
I know nothing of C++ and therefore need a lilte help editing a C++ app to 
insert some records into a database.

This is where I am so far

#include sqlite.h

sqlite *db;


 //insert record into database
 db=sqlite_open(/var/tmp/logger/database/logger.db, 0, NULL);
 query = insert into call_data;
 query += (direction, call_time, dest, trunk_no, file_name)values(;
 query += 
'details.inout','details.statime','details.cidn','details.channel','details.filename;

 sqlite_exec(db, query, NULL, NULL, NULL);
   sqlite_close(db);
--

Can someone tell me if I am going in the right direction. Sorry for being so 
lazy,but I need to get something working quick.


Lloydie T 



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



Re: [sqlite] A lillte help adding sqlite to a c program

2006-09-09 Thread Lloyd Thomas

Jay, Thanks for your reply.
I gave it a try with and got a few errors. as follows
---
logger.cpp:609: error: invalid operands of types `const char[80]' and 
`char[4]' to binary `operator+'

logger.cpp:615: error: `t' was not declared in this scope
logger.cpp:615: warning: unused variable 't'
logger.cpp:634: error: jump to case label
logger.cpp:631: error:   crosses initialization of `std::string test2'
logger.cpp:628: error:   crosses initialization of `std::string test1'
logger.cpp:637: error: jump to case label
logger.cpp:631: error:   crosses initialization of `std::string test2'
logger.cpp:628: error:   crosses initialization of `std::string test1'
logger.cpp:638: error: jump to case label
logger.cpp:631: error:   crosses initialization of `std::string test2'
logger.cpp:628: error:   crosses initialization of `std::string test1'
logger.cpp:639: error: jump to case label
logger.cpp:631: error:   crosses initialization of `std::string test2'
logger.cpp:628: error:   crosses initialization of `std::string test1'
logger.cpp:641: error: `t' was not declared in this scope
logger.cpp:641: warning: unused variable 't'
logger.cpp:664: error: jump to case label
logger.cpp:621: error:   crosses initialization of `bool Loop'
logger.cpp:634: warning: destructor needed for `test2'
logger.cpp:634: warning: where case label appears here
logger.cpp:634: warning: (enclose actions of previous case statements 
requiring destructors in their own scope.)

logger.cpp:637: warning: destructor needed for `test2'
logger.cpp:637: warning: where case label appears here
logger.cpp:638: warning: destructor needed for `test2'
logger.cpp:638: warning: where case label appears here
logger.cpp:639: warning: destructor needed for `test2'
logger.cpp:639: warning: where case label appears here
make: *** [logger.o] Error 1
--
line 609 =
sql = insert into call_data (direction, call_time, dest, trunk_no, 
file_name)values('+details.inout+','+details.statime+','+details.cidn+'+details.channel+','+details.filename+');







- Original Message - 
From: Jay Sprenkle [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Saturday, September 09, 2006 11:16 PM
Subject: Re: [sqlite] A lillte help adding sqlite to a c program



On 9/9/06, Lloyd Thomas [EMAIL PROTECTED] wrote:
I know nothing of C++ and therefore need a lilte help editing a C++ app 
to

insert some records into a database.


here's an example to read from a database.
If you build the sql like you're doing and you use it on the web you
leave yourself
open to sql injection attacks. Using the bind() method eliminates that
vulnerability.
Something to consider.

Jay


Here's some example code:

sqlite3*db;

// connect to database
if ( sqlite3_open( test.db, db ) )
 throw Can't open database;

char* sql;

sql = SELECT one.test1, two.test2
 FROM one
 INNER JOIN two ON one.id = two.id
;
sqlite3_stmt*   pStmt;

if ( sqlite3_prepare( db, sql, strlen(sql), pStmt, NULL ) != SQLITE_OK )
 {
string str = Cannot prepare sql: ;
str += sql[t];
str += , Error: ;
str += sqlite3_errmsg(db);
throw str.c_str();
 }

bool Loop = true;
while ( Loop )
 switch ( sqlite3_step( pStmt ) )
{
   case SQLITE_ROW:
  // retrieve the results
  char* p = (char *) sqlite3_column_text( pStmt, 0 );
  string test1  = string( p ? p :  );

  p = (char *) sqlite3_column_text( pStmt, 1 );
  string test2 = string( p ? p :  );

  break;
   case SQLITE_DONE:
  Loop = false;
  break;
   case SQLITE_BUSY:
   case SQLITE_LOCKED:
   default:
  string str = Cannot execute sql: ;
  str += sql[t];
  str += , Error: ;
  str += sqlite3_errmsg(db);
  throw str.c_str();
  break;
}

// clean up when finished
sqlite3_finalize( pStmt );

sqlite3_close( db );



--
SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com

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




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



Re: Re[2]: [sqlite] A lillte help adding sqlite to a c program

2006-09-09 Thread Lloyd Thomas
if I could somehow create the following string as a char i cpuld probably 
get the code to work.
 sql = insert into call_data (direction, call_time, dest, 
trunk_no, file_name)values(';

 sql += details.inout;
 sql += ',';
 sql += details.statime;
 sql += ',';
 sql += details.cidn;
 sql += ';
 sql +=details.channel;
 sql += ',';
 sql += details.filename;
 sql += ');
I am getting stuck adding exist chars to the sql char


  defined chars

^^
sql = insert into call_data(direction, 
call_time)values('details.inout','details.statime)

Do you have any ideas?

Lloydie T


- Original Message - 
From: Teg [EMAIL PROTECTED]

To: Lloyd Thomas sqlite-users@sqlite.org
Sent: Sunday, September 10, 2006 12:47 AM
Subject: Re[2]: [sqlite] A lillte help adding sqlite to a c program



Hello Lloyd,

You need to escape the quotes. Remember in C and C++  means the
beginning or end of a literal string so, when you want to embed quotes
in a string you have to escape them. Probaby \.

You'd be better off using the paramaterized version of the SQL

std::string sql = insert into call_data (direction, call_time, dest, 
trunk_no,

file_name)values(?,?,?,?,?);;

Then bind the actual parameters after the fact.

C


Saturday, September 9, 2006, 7:02:43 PM, you wrote:

LT Jay, Thanks for your reply.
LT I gave it a try with and got a few errors. as follows
LT ---
LT logger.cpp:609: error: invalid operands of types `const char[80]' and
LT `char[4]' to binary `operator+'
LT logger.cpp:615: error: `t' was not declared in this scope
LT logger.cpp:615: warning: unused variable 't'
LT logger.cpp:634: error: jump to case label
LT logger.cpp:631: error:   crosses initialization of `std::string test2'
LT logger.cpp:628: error:   crosses initialization of `std::string test1'
LT logger.cpp:637: error: jump to case label
LT logger.cpp:631: error:   crosses initialization of `std::string test2'
LT logger.cpp:628: error:   crosses initialization of `std::string test1'
LT logger.cpp:638: error: jump to case label
LT logger.cpp:631: error:   crosses initialization of `std::string test2'
LT logger.cpp:628: error:   crosses initialization of `std::string test1'
LT logger.cpp:639: error: jump to case label
LT logger.cpp:631: error:   crosses initialization of `std::string test2'
LT logger.cpp:628: error:   crosses initialization of `std::string test1'
LT logger.cpp:641: error: `t' was not declared in this scope
LT logger.cpp:641: warning: unused variable 't'
LT logger.cpp:664: error: jump to case label
LT logger.cpp:621: error:   crosses initialization of `bool Loop'
LT logger.cpp:634: warning: destructor needed for `test2'
LT logger.cpp:634: warning: where case label appears here
LT logger.cpp:634: warning: (enclose actions of previous case statements
LT requiring destructors in their own scope.)
LT logger.cpp:637: warning: destructor needed for `test2'
LT logger.cpp:637: warning: where case label appears here
LT logger.cpp:638: warning: destructor needed for `test2'
LT logger.cpp:638: warning: where case label appears here
LT logger.cpp:639: warning: destructor needed for `test2'
LT logger.cpp:639: warning: where case label appears here
LT make: *** [logger.o] Error 1
LT --
LT line 609 =
LT sql = insert into call_data (direction, call_time, dest, trunk_no,
LT 
file_name)values('+details.inout+','+details.statime+','+details.cidn+'+details.channel+','+details.filename+');







LT - Original Message - 
LT From: Jay Sprenkle [EMAIL PROTECTED]

LT To: sqlite-users@sqlite.org
LT Sent: Saturday, September 09, 2006 11:16 PM
LT Subject: Re: [sqlite] A lillte help adding sqlite to a c program



On 9/9/06, Lloyd Thomas [EMAIL PROTECTED] wrote:

I know nothing of C++ and therefore need a lilte help editing a C++ app
to
insert some records into a database.


here's an example to read from a database.
If you build the sql like you're doing and you use it on the web you
leave yourself
open to sql injection attacks. Using the bind() method eliminates that
vulnerability.
Something to consider.

Jay


Here's some example code:

sqlite3*db;

// connect to database
if ( sqlite3_open( test.db, db ) )
 throw Can't open database;

char* sql;

sql = SELECT one.test1, two.test2
 FROM one
 INNER JOIN two ON one.id = two.id
;
sqlite3_stmt*   pStmt;

if ( sqlite3_prepare( db, sql, strlen(sql), pStmt, NULL ) != 
SQLITE_OK )

 {
string str = Cannot prepare sql: ;
str += sql[t];
str += , Error: ;
str += sqlite3_errmsg(db);
throw str.c_str();
 }

bool Loop = true;
while ( Loop )
 switch ( sqlite3_step( pStmt ) )
{
   case

[sqlite] Wierd between results

2006-03-25 Thread Lloyd Thomas
I am not sure if I am being crazy, but I seem to be getting a wierd result 
when using 'BETWEEN'.


if use
SELECT count(call_id) as num_rows WHERE ring_time BETWEEN 6 and 10;
I get 0 results
but if I do
SELECT count(call_id) as num_rows WHERE ring_time = 7;
I get 39 results

SELECT count(call_id) as num_rows WHERE ring_time  6 and ring_time 10;
Also gives 0 results.

Where am I going wrong?

sqlite 3.2.8
windows XP

Lloydie-T 



Re: [sqlite] Wierd between results

2006-03-25 Thread Lloyd Thomas

If i do
SELECT count(call_id) as num_rows WHERE ring_time BETWEEN 10 and 6;
I get 633 results.
Is that normal?

- Original Message - 
From: Lloyd Thomas [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Saturday, March 25, 2006 3:48 PM
Subject: [sqlite] Wierd between results


I am not sure if I am being crazy, but I seem to be getting a wierd result 
when using 'BETWEEN'.


if use
SELECT count(call_id) as num_rows WHERE ring_time BETWEEN 6 and 10;
I get 0 results
but if I do
SELECT count(call_id) as num_rows WHERE ring_time = 7;
I get 39 results

SELECT count(call_id) as num_rows WHERE ring_time  6 and ring_time 10;
Also gives 0 results.

Where am I going wrong?

sqlite 3.2.8
windows XP

Lloydie-T 




Re: [sqlite] Wierd between results

2006-03-25 Thread Lloyd Thomas
Go back to my original problem if I change 'between 6 and 10' to 'between 6 
and 9', I get the expected results.

SELECT count(call_id) as num_rows WHERE ring_time BETWEEN 6 and 9;
232

Am I finding a bug or is my syntax incorrect?

- Original Message - 
From: Lloyd Thomas [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Saturday, March 25, 2006 4:14 PM
Subject: Re: [sqlite] Wierd between results



If i do
SELECT count(call_id) as num_rows WHERE ring_time BETWEEN 10 and 6;
I get 633 results.
Is that normal?

- Original Message - 
From: Lloyd Thomas [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Saturday, March 25, 2006 3:48 PM
Subject: [sqlite] Wierd between results


I am not sure if I am being crazy, but I seem to be getting a wierd result 
when using 'BETWEEN'.


if use
SELECT count(call_id) as num_rows WHERE ring_time BETWEEN 6 and 10;
I get 0 results
but if I do
SELECT count(call_id) as num_rows WHERE ring_time = 7;
I get 39 results

SELECT count(call_id) as num_rows WHERE ring_time  6 and ring_time 10;
Also gives 0 results.

Where am I going wrong?

sqlite 3.2.8
windows XP

Lloydie-T






Re: [sqlite] Wierd between results

2006-03-25 Thread Lloyd Thomas

Yeah I did. sorry about the rushed typing.
DRH managed to sort it out for me. I had imported a ver 2 database to 
version 3 and changed a time values to integers, but forgot to change the 
column to integer.


Lloydie-T

- Original Message - 
From: Kurt Welgehausen [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Saturday, March 25, 2006 5:39 PM
Subject: Re: [sqlite] Wierd between results



Lloyd Thomas [EMAIL PROTECTED] wrote:


if use
SELECT count(call_id) as num_rows WHERE ring_time BETWEEN 6 and 10;
I get 0 results


You DID specify a table in your actual queries, didn't you?

select * from tbl;
t   x   y
--  --  --
1   100 101
2   100 102
3   100 103
4   100 103
5   200 210
6   200 220
7   200 230
8   300 199

select count(t) from tbl where y=103;
count(t)
--
2

select count(t) from tbl where y between 102 and 210;
count(t)
--
5


Regards 




[sqlite] Help with multiple join

2006-02-11 Thread Lloyd Thomas
As you can tell I am no sql guru. Is there anyway I could do the following 
without 'group by'.


query:
SELECT C.call_id, C.extn_no, C.dest, U.group_name
FROM call_data AS C, grp_user AS G, user_grp AS U
LEFT JOIN user_grp ON G.group_id = U.group_id
LEFT JOIN grp_user ON C.extn_no = G.extn_no
WHERE C.direction = 'Out'
AND C.extn_no IN (select extn_no FROM grp_user)
GROUP BY C.call_id, C.extn_no, C.dest, U.group_name


table data

call_data table
call_id |extn_no|dest |
1 |201 |012087562978|
2 |201 |079087562879|
3 |200 |018657562072|
4 |203 |018693263202|

user_grp table
group_id|group_name |
1 |ideal CT |

grp_user table
group_id|extn_no|
1 |200 |
1 |201 |

Lloydie T 



Re: [sqlite] Building sqlite 3.2.8 on redhat 9 (off list)

2006-01-03 Thread Lloyd Thomas

Thanks Kimball
   Your right about having a little experience. I am 
just running into error after error installing apps, but I'm learnoing 
slowly. Anyway, I was trying to install the sqlite support for another 
application I want to use and as a side issue it seems to have installed 
sqlite 3.2.8 correctly for me. It would be good if I could type sqlite3 at 
the prompt and it would just start.


Lloyd


- Original Message - 
From: Arjen Markus [EMAIL PROTECTED]

To: [EMAIL PROTECTED]
Sent: Tuesday, January 03, 2006 7:51 AM
Subject: Re: [sqlite] Building sqlite 3.2.8 on redhat 9 (off list)



Lloyd Thomas wrote:


There does not seem to be a library file in /usr/lib/  called
libsqlite3.so.0. would that be the problem. Please bear with me I am a 
linux

newbie.



Hello Lloyd,

my reply may be a bit too detailed, but I assume you have very little
experience with Linux/UNIX. So bare with me if the explanations are
too basic.

What about /usr/local/lib? That is the usual place for
packages/libraries that
are not part of the operating system.

You can print the current setting of LD_LIBRARY_PATH by typing:

echo $LD_LIBRARY_PATH

on the prompt.

It is a list of directories that the loader/linker will look at in
search
of shared objects. The sqlite3 library must be contained in any of
these.

If you find it in a different directory not listed there, you need to
set LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=/your/new/directory:$LD_LIBRARY_PATH

or:

setenv LD_LIBRARY_PATH /your/new/directory:$LD_LIBRARY_PATH

(Presumably the first, the second form is specific to the C-shell, and
you probably have bash.)

What directory (the prefix option) did you use for installing
SQLite? That is the directory where the library will live in (or in
the subdirectory lib of that directory).

Hope this helps.

Regards,

Arjen





Re: [sqlite] Building sqlite 3.2.8 on redhat 9 (off list)

2006-01-03 Thread Lloyd Thomas
The precompiled version did work. I was just trying to compile it myself to 
get experience building a linux box.


Lloyd

- Original Message - 
From: [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Tuesday, January 03, 2006 1:29 PM
Subject: Re: [sqlite] Building sqlite 3.2.8 on redhat 9 (off list)


Lloyd Thomas [EMAIL PROTECTED] wrote:

Thanks Kimball
Your right about having a little experience. I am
just running into error after error installing apps, but I'm learnoing
slowly. Anyway, I was trying to install the sqlite support for another
application I want to use and as a side issue it seems to have installed
sqlite 3.2.8 correctly for me. It would be good if I could type sqlite3 at
the prompt and it would just start.



Did the precompiled binary on the website not work for you?
http://www.sqlite.org/download.html

--
D. Richard Hipp [EMAIL PROTECTED]



Re: [sqlite] Building sqlite 3.2.8 on redhat 9

2006-01-02 Thread Lloyd Thomas
I have compilted tcl, but had a problem with tk. having compiled sqlite3 I 
get a new error trying to run sqlite3 =
'sqlite3: error while loading shared libraries: libsqlite3.so.0: cannot open 
shared object file: No such file or diretory'


Any Ideas?

Lloyd

- Original Message - 
From: Dan Kennedy [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Monday, January 02, 2006 5:37 AM
Subject: Re: [sqlite] Building sqlite 3.2.8 on redhat 9



If possible, the easiest way around this is to install Active-tcl.
Or compile the tcl library yourself. For a long time the stock tcl
install in redhat was problematic.

http://www.activestate.com/Products/ActiveTcl/




--- Lloyd Thomas [EMAIL PROTECTED] wrote:

I am having a problem building sqlite on my redhat 9 box. There seems to 
be
a problem with TCL. I am no linux guru, so it some one can poinjt me in 
the

right direction that would be great.

here is as far as I get


[EMAIL PROTECTED] sqlite-3.2.8]# make
./libtool --mode=compile

cc -g -O2 -DOS_UNIX=1 -DHAVE_USLEEP=1 -I. -I./src -DNDEBUG  -DTHREADSAFE=0
-DSQLITE_OMIT_CURSOR -c ./src/tclsqlite.c
 gcc -g -O2 -DOS_UNIX=1 -DHAVE_USLEEP=1 -I. -I./src -DNDEBUG -DTHREADSAFE=0
-DSQLITE_OMIT_CURSOR -c ./src/tclsqlite.c  -fPIC -DPIC -o 
.libs/tclsqlite.o

src/tclsqlite.c: In function `tclSqlFunc':
src/tclsqlite.c:372: warning: passing arg 1 of `Tcl_NewByteArrayObj'
discards qualifiers from pointer target type
src/tclsqlite.c:380: warning: assignment makes pointer from integer 
without

a cast
src/tclsqlite.c:438: `Tcl_WideInt' undeclared (first use in this 
function)

src/tclsqlite.c:438: (Each undeclared identifier is reported only once
src/tclsqlite.c:438: for each function it appears in.)
src/tclsqlite.c:438: parse error before v
src/tclsqlite.c:439: `v' undeclared (first use in this function)
src/tclsqlite.c: In function `DbObjCmd':
src/tclsqlite.c:636: warning: passing arg 3 of `Tcl_GetIndexFromObj' from
incompatible pointer type
src/tclsqlite.c:1252: warning: passing arg 2 of `Tcl_GetVar2Ex' discards
qualifiers from pointer target type
src/tclsqlite.c:1274: `Tcl_WideInt' undeclared (first use in this 
function)

src/tclsqlite.c:1274: parse error before v
src/tclsqlite.c:1275: `v' undeclared (first use in this function)
src/tclsqlite.c:1325: warning: passing arg 1 of `Tcl_NewByteArrayObj'
discards qualifiers from pointer target type
src/tclsqlite.c:1333: warning: assignment makes pointer from integer 
without

a cast
src/tclsqlite.c:1773: warning: passing arg 3 of `Tcl_GetIndexFromObj' 
from

incompatible pointer type
src/tclsqlite.c: In function `DbMain':
src/tclsqlite.c:1918: warning: passing arg 2 of `Tcl_CreateObjCommand'
discards qualifiers from pointer target type
make: *** [tclsqlite.lo] Error 1
--








__
Yahoo! for Good - Make a difference this year.
http://brand.yahoo.com/cybergivingweek2005/ 




Re: [sqlite] Building sqlite 3.2.8 on redhat 9

2006-01-02 Thread Lloyd Thomas
There does not seem to be a library file in /usr/lib/  called 
libsqlite3.so.0. would that be the problem. Please bear with me I am a linux 
newbie.


Lloyd
- Original Message - 
From: Arjen Markus [EMAIL PROTECTED]

To: sqlite-users@sqlite.org
Sent: Monday, January 02, 2006 12:13 PM
Subject: Re: [sqlite] Building sqlite 3.2.8 on redhat 9



Lloyd Thomas wrote:


I have compilted tcl, but had a problem with tk. having compiled sqlite3 
I

get a new error trying to run sqlite3 =
'sqlite3: error while loading shared libraries: libsqlite3.so.0: cannot 
open

shared object file: No such file or diretory'



That seems a common problem with shared objects/libraries ... they have
to
be in the path of the dynamic linker/loader. Have you set
LD_LIBRARY_PATH
properly?

Regards,

Arjen





[sqlite] Building sqlite 3.2.8 on redhat 9

2006-01-01 Thread Lloyd Thomas
I am having a problem building sqlite on my redhat 9 box. There seems to be 
a problem with TCL. I am no linux guru, so it some one can poinjt me in the 
right direction that would be great.


here is as far as I get


[EMAIL PROTECTED] sqlite-3.2.8]# make
./libtool --mode=compile 
gcc -g -O2 -DOS_UNIX=1 -DHAVE_USLEEP=1 -I. -I./src -DNDEBUG  -DTHREADSAFE=0  
-DSQLITE_OMIT_CURSOR -c ./src/tclsqlite.c
gcc -g -O2 -DOS_UNIX=1 -DHAVE_USLEEP=1 -I. -I./src -DNDEBUG -DTHREADSAFE=0  
-DSQLITE_OMIT_CURSOR -c ./src/tclsqlite.c  -fPIC -DPIC -o .libs/tclsqlite.o

src/tclsqlite.c: In function `tclSqlFunc':
src/tclsqlite.c:372: warning: passing arg 1 of `Tcl_NewByteArrayObj' 
discards qualifiers from pointer target type
src/tclsqlite.c:380: warning: assignment makes pointer from integer without 
a cast

src/tclsqlite.c:438: `Tcl_WideInt' undeclared (first use in this function)
src/tclsqlite.c:438: (Each undeclared identifier is reported only once
src/tclsqlite.c:438: for each function it appears in.)
src/tclsqlite.c:438: parse error before v
src/tclsqlite.c:439: `v' undeclared (first use in this function)
src/tclsqlite.c: In function `DbObjCmd':
src/tclsqlite.c:636: warning: passing arg 3 of `Tcl_GetIndexFromObj' from 
incompatible pointer type
src/tclsqlite.c:1252: warning: passing arg 2 of `Tcl_GetVar2Ex' discards 
qualifiers from pointer target type

src/tclsqlite.c:1274: `Tcl_WideInt' undeclared (first use in this function)
src/tclsqlite.c:1274: parse error before v
src/tclsqlite.c:1275: `v' undeclared (first use in this function)
src/tclsqlite.c:1325: warning: passing arg 1 of `Tcl_NewByteArrayObj' 
discards qualifiers from pointer target type
src/tclsqlite.c:1333: warning: assignment makes pointer from integer without 
a cast
src/tclsqlite.c:1773: warning: passing arg 3 of `Tcl_GetIndexFromObj' from 
incompatible pointer type

src/tclsqlite.c: In function `DbMain':
src/tclsqlite.c:1918: warning: passing arg 2 of `Tcl_CreateObjCommand' 
discards qualifiers from pointer target type

make: *** [tclsqlite.lo] Error 1
--



[sqlite] built-in functrion suggestion: size of blob

2005-10-23 Thread Lloyd Dupont
I look into the build in function of SQLite and saw there is a function to know 
the length of a string (in a record).
Great!

But to my disbelief there is (apparently) no way to get the size of a blob 
(other than loading it :-()
And no, length() doesn't work on Blob.

I think it would be a worthy addition!

Or is there already an (undocumented) such addition?

  1   2   >