[sqlite] How can I get the first 10 rows in sqlite db

2010-10-15 Thread Kavita Raghunathan
Hello, I’ve been adding and deleting rows from the sqlite database. Now the primary ID is non-sequential. 1. How do I get the nth entry in the database 2. AND, How do I get the first n rows from the database ? Thanks, Kavita ___ sqlite-users

Re: [sqlite] What happens when PK reaches max integer

2010-10-14 Thread Kavita Raghunathan
Thank you Eric and Jay. Your replies address my concerns. I mean, I'm no longer concerned :) Thanks, Kavita On 10/14/10 1:20 PM, "Jay A. Kreibich" <j...@kreibi.ch> wrote: > On Thu, Oct 14, 2010 at 12:33:11PM -0500, Kavita Raghunathan scratched on the > wall: >>

[sqlite] What happens when PK reaches max integer

2010-10-14 Thread Kavita Raghunathan
Hello, My Primary Key is an integer. In the lifetime of a product, it may increase to the maximum possible value of an integer. Our processor will make it overflow into a very large negative number and so on. My specific question is, if overflow occurs, how does sqlite deal with it? 1. What

Re: [sqlite] Nth row of on sqlite DB

2010-10-14 Thread Kavita Raghunathan
wing about occurance and having to use order by. Will do. Kavita On 10/14/10 12:10 PM, "Alan Chandler" <a...@chandlerfamily.org.uk> wrote: > On 14/10/10 17:26, Kavita Raghunathan wrote: >> I found an example: >> Select * from order by ID where limit 1 of

Re: [sqlite] Nth row of on sqlite DB

2010-10-14 Thread Kavita Raghunathan
I found an example: Select * from order by ID where limit 1 offset n-1 Will retreive the nth row. In this case order by ID is probably not necessary as its already ordered with a few missing rows. Thank you! Kavita On 10/14/10 11:15 AM, "Kavita Raghunathan" <kavita.raghunat...

Re: [sqlite] Nth row of on sqlite DB

2010-10-14 Thread Kavita Raghunathan
Please see comment On 10/14/10 11:02 AM, "P Kishor" wrote: >> Hello, >> I¹ve been adding and deleting rows from the sqlite database. Now the primary >> ID is non-sequential. >> >> >>  1.  How do I get the nth entry in the database >>  2.  AND, How do I get the first n

Re: [sqlite] Nth row of on sqlite DB

2010-10-14 Thread Kavita Raghunathan
3. How can I make my primary ID remain sequential even after a delete of row. Can sqlite somehow realign the indices after a row in the middle is deleted ? On 10/14/10 10:53 AM, "Kavita Raghunathan" <kavita.raghunat...@skyfiber.com> wrote: Hello, I’ve been adding and de

[sqlite] Nth row of on sqlite DB

2010-10-14 Thread Kavita Raghunathan
Hello, I’ve been adding and deleting rows from the sqlite database. Now the primary ID is non-sequential. 1. How do I get the nth entry in the database 2. AND, How do I get the first n rows from the database ? Thanks, Kavita ___ sqlite-users

Re: [sqlite] Null character problem

2010-07-09 Thread Kavita Raghunathan
I'm apologise for the reminder, but I think I have become a victim of "thread takeover". Would someone please kindly answer my questions ? Kavita On 7/9/10 11:41 AM, "Kavita Raghunathan" <kavita.raghunat...@skyfiber.com> wrote: > Thanks. Sounds like I have to us

[sqlite] Null character problem

2010-07-09 Thread Kavita Raghunathan
Hello, I’m storing encrypted passwords in the sqlite database. The encryption algorithm generates “null” character, and therefore the password strings can have nulls in them. 1. Is this an issue for storing in database ? If strcpy is used anywhere, it would be a problem 2. I’m using

[sqlite] Encryption of sqlite DB

2010-05-04 Thread Kavita Raghunathan
Hi, What’s the simplest way to encrypt only certain rows in an sqlite DB? If there is no way to do this (for storing passwords etc), I would like to know the best way to encrypt the whole sqlite DB. (Prefer only encrypting some rows, but if this introduces complexity, I’m willing to encrypt the

Re: [sqlite] The character "'" not liked by sqlite?

2010-03-02 Thread Kavita Raghunathan
On 3/2/10 12:56 PM, "Simon Slavin" <slav...@bigfraud.org> wrote: > > On 2 Mar 2010, at 6:51pm, Kavita Raghunathan wrote: > >> I notice that when I try to insert the character ³¹² as part of a string into >> the sqlite database, my updates don¹t

[sqlite] The character "'" not liked by sqlite?

2010-03-02 Thread Kavita Raghunathan
I notice that when I try to insert the character “’” as part of a string into the sqlite database, my updates don’t work. Any ideas why? The same string without the “’” character works. I have not debugged to see where exactly in sqlite it fails. I’m inserting a text like this: “Rootuser’s

Re: [sqlite] Crash inside sqlite3_step

2010-01-26 Thread Kavita Raghunathan
I found that you are correct. I wasn't reading the valgrind log properly. Thank you. Kavita On 1/25/10 10:26 PM, "Dan Kennedy" <danielk1...@gmail.com> wrote: > > On Jan 26, 2010, at 6:16 AM, Kavita Raghunathan wrote: > >> Following Sql query crashes in alloca

[sqlite] Crash inside sqlite3_step

2010-01-25 Thread Kavita Raghunathan
Following Sql query crashes in allocateCursor inside of sqlite3_step INSERT INTO EntityTbl (AttrName, AttrEnum, AttrType, AttrValue, ReadWrite, Entity_id) VALUES(‘image_crc’, 6008, 16, ‘0’, 1, 34013184); I’m not able to get an understanding of what I might be doing wrong. Please note: 1. I

Re: [sqlite] Using sqlite3: Excess memory consumed ?

2009-12-17 Thread Kavita Raghunathan
Good answer. Thanks, we may have more questions for you. Kavita On 12/17/09 10:46 AM, "Simon Slavin" <slav...@bigfraud.org> wrote: > > On 17 Dec 2009, at 4:38pm, Kavita Raghunathan wrote: > >> It is an option to merge tables, but the concern there is th

Re: [sqlite] Using sqlite3: Excess memory consumed ?

2009-12-17 Thread Kavita Raghunathan
7/09 10:24 AM, "Simon Slavin" <slav...@bigfraud.org> wrote: > > On 17 Dec 2009, at 3:44pm, Kavita Raghunathan wrote: > >> We have a pressing need to reduce memory consumption. Your help is >> appreciated. >> >> We have a database 672 tables, all

Re: [sqlite] Using sqlite3: Excess memory consumed ?

2009-12-17 Thread Kavita Raghunathan
ges as free. > Correct me if I'm wrong. > > Kurt > > -Original Message- > From: sqlite-users-boun...@sqlite.org > [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Kavita Raghunathan > Sent: Thursday, December 17, 2009 10:44 AM > To: Discussion of SQLite D

[sqlite] Using sqlite3: Excess memory consumed ?

2009-12-17 Thread Kavita Raghunathan
Hi, We have a pressing need to reduce memory consumption. Your help is appreciated. We have a database 672 tables, all with the same layout: 2 columns of 4 bytes each and 186 rows. Theoretically, the memory consumed should be: 672 * (2 *4 * 186) = 36 Bytes ~= 1.0 MB However, the actual

Re: [sqlite] Local data structures vs sqlite

2009-11-05 Thread Kavita Raghunathan
gt; On Thu, Nov 5, 2009 at 4:43 PM, Kavita Raghunathan > <kavita.raghunat...@skyfiber.com> wrote: >> >> I saw a presentation on sqlite by Dr Hipp that mentioned that anytime I'm >> storing data in structures or tables, I should be thinking about using >> sql

[sqlite] Local data structures vs sqlite

2009-11-05 Thread Kavita Raghunathan
I saw a presentation on sqlite by Dr Hipp that mentioned that anytime I'm storing data in structures or tables, I should be thinking about using sqlite instead. Would it be more efficient to use the sqlite database to store a table that Looks like this: where lets say I'm looking for the word

Re: [sqlite] Crash on freeing mutex in sqlite3.c

2009-10-20 Thread Kavita Raghunathan
will show you those types of errors. So go ahead and do it. Pavel On Tue, Oct 20, 2009 at 4:18 PM, Kavita Raghunathan <kavita.raghunat...@skyfiber.com> wrote: > I'm using ddd, its the GUI version of gdb. > > Are you saying that the file pathname is wrong ? When you say >  &q

Re: [sqlite] Crash on freeing mutex in sqlite3.c

2009-10-20 Thread Kavita Raghunathan
w you memory access errors in your program (I heard totalview can do something like that but I didn't try that). But if you run your program under valgrind it will show you those types of errors. So go ahead and do it. Pavel On Tue, Oct 20, 2009 at 4:18 PM, Kavita Raghunathan <kavita.raghunat

Re: [sqlite] Crash on freeing mutex in sqlite3.c

2009-10-20 Thread Kavita Raghunathan
t;can have a mutex" so that it will lead to crash of your process. The problem is that your application corrupts memory. Run it under valgrind and see where the problem is. Pavel On Tue, Oct 20, 2009 at 3:25 PM, Kavita Raghunathan <kavita.raghunat...@skyfiber.com> wrote: > Although i

[sqlite] Crash on freeing mutex in sqlite3.c

2009-10-20 Thread Kavita Raghunathan
Although i have successfully opened the database several times, today I'm seeing crashes on this line when I use sqlite3_open_v2: sqlite3_mutex_free(sqlite3GlobalConfig.pInitMutex); Any ideas what I could be doing wrong to cause this crash ? Here is the exact way I'm using this C wrapper:

Re: [sqlite] Replacing a table

2009-10-15 Thread Kavita Raghunathan
It doesn't require you to loop through all rows although DBMS will iterate all of them for you. Pavel On Thu, Oct 15, 2009 at 11:22 AM, Kavita Raghunathan <kavita.raghunat...@skyfiber.com> wrote: > Thanks Pavel and Owen. This is very useful information. > > Also how can we chang

Re: [sqlite] Replacing a table

2009-10-15 Thread Kavita Raghunathan
rformance depending on whether your journal settings are to truncate or delete or pad etc. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Kavita Raghunathan Sent: Thursday, October 15, 2009 3:51 PM To: General Discussi

[sqlite] Replacing a table

2009-10-15 Thread Kavita Raghunathan
Hi, Is there a way to use the sqlite wrappers to "replace" or delete a table completely ? (without looping through and deleting each row and column) The number of columns and rows of the new table is identical to the number of columns and rows of the old table being replaced. Is there a quick

[sqlite] cannot add data to sql tables

2009-09-22 Thread Kavita Raghunathan
Hi, I successfully did the following using C wrappers: 1) created a .db file 2) Added the tables 3) Try to insert data into the tables created. When I try to 3) insert data into the tables, all the routines pass (Prepare, Step, Finalize) without errors. But when I run my .db file

Re: [sqlite] Prepare Error from sqlite

2009-09-21 Thread Kavita Raghunathan
tring you're missing closing parenthesis at the end and apparently you also miss comma before AttrType. Pavel On Mon, Sep 21, 2009 at 12:22 PM, Kavita Raghunathan <kavita.raghunat...@skyfiber.com> wrote: > > I just put in my sqlite wrappers and started testing. > > I get

Re: [sqlite] Prepare Error from sqlite

2009-09-21 Thread Kavita Raghunathan
Correction: The error seems to be set in sqlite3VdbeSetSql because that was the last executed statement. - Original Message - From: "Kavita Raghunathan" <kavita.raghunat...@skyfiber.com> To: "sqlite-users" <sqlite-users@sqlite.org> Sent: Monday, September

[sqlite] Prepare Error from sqlite

2009-09-21 Thread Kavita Raghunathan
I just put in my sqlite wrappers and started testing. I get the following error and when I stepped into the sqlite code, its when sqlite3VdbeFinalize is called: "prepare error: near ",": syntax error" I was trying to do a "sqlite3_prepare_v2" and was using the following sqlstring and the

[sqlite] About the "EnterCriticalSection" call in sample C code

2009-09-17 Thread Kavita Raghunathan
Marcus, Question about the Sample C code you wrote on sqlite.org. Could you tell me if I need the "EnterCriticalSection" over the fprintf for this to work in multiple "linux" not windows threads ? Currently I am using your sample C code as reference for my C++ wrappers around Sqlite. We use

Re: [sqlite] Schema and database layout

2009-09-16 Thread Kavita Raghunathan
10 tables? Do you have only 10 "table > types"? > >> Maybe I need to think this through, even as I write this:-) > > That definitely will help. :-) > > > Pavel > > On Tue, Sep 15, 2009 at 6:01 PM, Kavita Raghunathan > <kavita.raghunat...@skyfiber.com

Re: [sqlite] Schema and database layout

2009-09-16 Thread Kavita Raghunathan
es of the same type but why? And what's the difference between tables of different types? Does this mean that you have more than 10 tables? Do you have only 10 "table types"? > Maybe I need to think this through, even as I write this:-) That definitely will help. :-) Pavel

Re: [sqlite] Schema and database layout

2009-09-15 Thread Kavita Raghunathan
> multiple threads can easily operate at the same time ? It depends on how your threads will operate, how often they will issue sql statements, what type of sql statements and all other details about your application functionality. KR: Different threads are going to access different tables of th

[sqlite] Schema and database layout

2009-09-15 Thread Kavita Raghunathan
All, I have a couple of questions: I've been studying the C/C++ interface, and 1) dont see a way to reuse schemas. In other words, I have say 10 tables with the same schema. How would I prevent doing 10 CREATE table commands ? Would there be a way I can pass the schema as well as data into

Re: [sqlite] Question on converting objects into relational db

2009-09-10 Thread Kavita Raghunathan
ite and this collection. -Shaun -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Kavita Raghunathan Sent: Thursday, September 10, 2009 12:02 PM To: kennethinbox-sql...@yahoo.com; General Discussion of SQLite Database Subject: Re:

Re: [sqlite] Question on converting objects into relational db

2009-09-10 Thread Kavita Raghunathan
then maybe simple dump of memory used by all entities into a file will be enough... Pavel On Thu, Sep 10, 2009 at 12:01 PM, Kavita Raghunathan <kavita.raghunat...@skyfiber.com> wrote: > The entity consists of an entity ID, and an attribute list. The attribute > list could >

Re: [sqlite] Question on converting objects into relational db

2009-09-10 Thread Kavita Raghunathan
var arg... --- On Thu, 9/10/09, Kavita Raghunathan <kavita.raghunat...@skyfiber.com> wrote: > From: Kavita Raghunathan <kavita.raghunat...@skyfiber.com> > Subject: [sqlite] Question on converting objects into relational db > To: "sqlite-users" <sqlite-users@sqlite

[sqlite] Question on converting objects into relational db

2009-09-10 Thread Kavita Raghunathan
I have a very high level question, not dealing with bits and bytes of sqlite: I currently have an object called entity_list, that has a list of all entities on the system. While thinking about it, it sounds like a list of entities is like having a database. Would it be possible to transfer

[sqlite] Importing data into sqlite

2009-09-10 Thread Kavita Raghunathan
Hi All, I'm still investigating the most effective way to import the db into sqlite that we are using as our embedded database. Of the following options, which one do you think works best, and is most extensible and future-proof? 1) Make a tab/csv delimited file with database, and install it

Re: [sqlite] Importing data into SQLite

2009-09-08 Thread Kavita Raghunathan
: "Kavita Raghunathan" <kavita.raghunat...@skyfiber.com> To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org> Sent: Tuesday, September 8, 2009 11:47:38 AM GMT -08:00 US/Canada Pacific Subject: Re: [sqlite] Importing data into SQLite Yes, this works. Mus

Re: [sqlite] Importing data into SQLite

2009-09-08 Thread Kavita Raghunathan
ion of SQLite Database" <sqlite-users@sqlite.org> Sent: Monday, September 7, 2009 9:08:41 AM GMT -08:00 US/Canada Pacific Subject: Re: [sqlite] Importing data into SQLite On Sun, Sep 6, 2009 at 9:32 PM, Kavita Raghunathan<kavita.raghunat...@skyfiber.com> wrote: > Timothy and a

Re: [sqlite] Importing data into SQLite

2009-09-07 Thread Kavita Raghunathan
Discussion of SQLite Database" <sqlite-users@sqlite.org> Sent: Monday, September 7, 2009 11:08:41 AM GMT -06:00 US/Canada Central Subject: Re: [sqlite] Importing data into SQLite On Sun, Sep 6, 2009 at 9:32 PM, Kavita Raghunathan<kavita.raghunat...@skyfiber.com> wrote: > Timot

Re: [sqlite] Importing data into SQLite

2009-09-06 Thread Kavita Raghunathan
excellent job of importing data, it might be better to use the latter option if you want more control over the data. It's not a difficult job to do. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Kavita Raghunathan Sent: Monday,

Re: [sqlite] Importing data into SQLite

2009-08-31 Thread Kavita Raghunathan
more control over the data. It's not a difficult job to do. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Kavita Raghunathan Sent: Monday, August 31, 2009 10:02 AM To: sqlite-users@sqlite.org Subject: [sqlite] Importing data into SQ

[sqlite] Importing data into SQLite

2009-08-31 Thread Kavita Raghunathan
Hi, I'm evaluating SQLite to be used as a small embedded database in a linux environment for Skyfiber Inc. What is the best way to import data into it ? I have a bunch of entities and attributes in an excel spreadsheet. Could I import CSV ? What should be the columns (where can I read about