Re: [sqlite] sqlite3_close( ) error

2011-03-23 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/23/2011 08:06 PM, Zaryab M. Munir wrote: > I am consistently observing this error in Linux envrionment. > Wondering what can be wrong. By far the best thing to do is use valgrind. You'll immediately see who allocates and frees memory and

Re: [sqlite] detect a flaw

2011-03-23 Thread Shalom Elkin
Sorry - it doesn't work. sqlite3_exec with the pragma directive returns no error, but the program still agrees to insert a record that violates foreign_key constraint. Here is the tables creation == CREATE TABLE people( id integer, nm text); INSERT INTO "people"

Re: [sqlite] detect a flaw

2011-03-23 Thread Shalom Elkin
All, I have done exactly like BareFeetWare suggested. The referential integrity "feature" is a no brainer for "serious" systems, where you do care about your data consistency. SQL doesn't have clauses where you declare where do you want Erroneous records to go. This is usually mandated to tools

Re: [sqlite] sqlite3_close( ) error

2011-03-23 Thread Simon Slavin
On 24 Mar 2011, at 3:06am, Zaryab M. Munir wrote: > Also, I must mention that if I call a different callback function which > doesn't do many calloc() etc. I don't see this error. Very good diagnostic. Can you compare your code with the C example on this page:

[sqlite] sqlite3_close( ) error

2011-03-23 Thread Zaryab M. Munir
Hi, I am consistently observing this error in Linux envrionment. I have sqlite3 library linked with my DLL. The program links/loads my DLL as well as a second DLL which includes the code to open and close db connections. Wondering what can be wrong. Below is description: sqlite3 *db; 1)

Re: [sqlite] detect a flaw

2011-03-23 Thread BareFeetWare
On 24/03/2011, at 2:50 AM, Shalom Elkin wrote: > I appreciate the input. Some of the advice comes obviously from very good > and talented people who find a challenge at doing things WITHOUT reverting > to code writing. Doing as much (or most often, all) of the logic in SQL (instead of

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread Jean-Christophe Deschamps
At 18:46 23/03/2011, you wrote: >Current US national debt is 16 digits. Nothing less? That's where the bug lies. OK, OK, I'm out ;-) ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread Igor Tandetnik
On 3/23/2011 3:52 PM, Black, Michael (IS) wrote: > Get rid of the pennies and you can get $1.8 quintillion > > Is there a use for tracking 1/1000th's of a dollar at these amounts? That's why I said you can trade range for accuracy, and vice versa. > Newer gcc's have 128-bit ints for 64-bit

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread Black, Michael (IS)
Hmmm...according to my math... Max 64-bit unsigned integer is 18446744073709551615 Drop the last digit as it can't hold 0-9 1844674407370955161 Make two decimal positions 18446744073709551.61 Now some commas so we can see better 18,446,744,073,709,551.61 That' $18 quadrillion dollars by my

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread Nico Williams
On Wed, Mar 23, 2011 at 1:30 PM, Igor Tandetnik wrote: > On 3/23/2011 1:46 PM, TR Shaw wrote: >> Current US national debt is 16 digits. > > A 64-bit unsigned integer can represent about $18 trillion, in > millionths of a dollar. This should have both range and accuracy to >

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread Igor Tandetnik
On 3/23/2011 1:46 PM, TR Shaw wrote: > On Mar 23, 2011, at 1:25 PM, Igor Tandetnik wrote: >> Billing/accounting is best done in integers - say, in millionths of a >> dollar. > > Current US national debt is 16 digits. A 64-bit unsigned integer can represent about $18 trillion, in millionths of a

Re: [sqlite] adding/dropping foreign key to existing table

2011-03-23 Thread Sam Carleton
On Wed, Mar 23, 2011 at 2:00 PM, Nico Williams wrote: > Also, just to be clear, making the schema writable and then making any > updates to sqlite_master is completely unsupported, and should be. > This is good, very good, IMHO. Which is also why I won't do it:) hehehehe

Re: [sqlite] adding/dropping foreign key to existing table

2011-03-23 Thread Nico Williams
Also, just to be clear, making the schema writable and then making any updates to sqlite_master is completely unsupported, and should be. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread Jonathan Allin
FYI a while ago I wrote a Java application using the logistic equation and big integers (it's still googleable). It didn't take many iterations before differences in the 16th significant figure showed up. But a bit off-topic ;o) From: sqlite-users-boun...@sqlite.org

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread TR Shaw
On Mar 23, 2011, at 1:25 PM, Igor Tandetnik wrote: > On 3/23/2011 12:58 PM, Eugene N wrote: >> I find the discussion very interesting. Apart from billing/accounting every >> good (scientific) application soones or later is bound to requare >> multiprecision library. > > Which scientific

Re: [sqlite] adding/dropping foreign key to existing table

2011-03-23 Thread Sam Carleton
On Wed, Mar 23, 2011 at 12:20 PM, Nico Williams wrote: > I do think that SQLite3 will eventually need to grow ALTER support for > altering constraints. This whole copy-the-table thing is not really a > scalable solution. Without such ALTER functionality users will often >

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread Igor Tandetnik
On 3/23/2011 12:58 PM, Eugene N wrote: > I find the discussion very interesting. Apart from billing/accounting every > good (scientific) application soones or later is bound to requare > multiprecision library. Which scientific instrument can measure which physical quantity with an accuracy

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread Eugene N
Hi I find the discussion very interesting. Apart from billing/accounting every good (scientific) application soones or later is bound to requare multiprecision library. The best way, as was stated above, would be to use blobs, as it would allow to dispance with all in/out converting (in case of

Re: [sqlite] adding/dropping foreign key to existing table

2011-03-23 Thread Nico Williams
I do think that SQLite3 will eventually need to grow ALTER support for altering constraints. This whole copy-the-table thing is not really a scalable solution. Without such ALTER functionality users will often have to implement all constraints as triggers and/or unique indexes instead of using

Re: [sqlite] detect a flaw

2011-03-23 Thread Igor Tandetnik
On 3/23/2011 11:50 AM, Shalom Elkin wrote: > what is the API equivalent of > > PRAGMA foreign_keys = ON; It's a SQL statement like any other. You can run it with sqlite3_exec, for example -- Igor Tandetnik ___ sqlite-users mailing list

Re: [sqlite] detect a flaw

2011-03-23 Thread Shalom Elkin
All, I appreciate the input. Some of the advice comes obviously from very good and talented people who find a challenge at doing things WITHOUT reverting to code writing. I did a small program. Current show -stopper : what is the API equivalent of PRAGMA foreign_keys = ON; If I can not turn

Re: [sqlite] detect a flaw

2011-03-23 Thread BareFeetWare
On 23/03/2011, at 9:03 PM, Shalom Elkin wrote: > I am new to SQLITE. Here's the challenge: > > sqlite> .dump > BEGIN TRANSACTION; > CREATE TABLE people( >id integer, >nm text); > INSERT INTO "people" VALUES(1,'Jack'); > INSERT INTO "people" VALUES(2,'Jill'); > CREATE TABLE

Re: [sqlite] detect a flaw

2011-03-23 Thread Shalom Elkin
Thanks, guys. i was afraid of the "Do it yourself". Im doing a small specialized version, to be generalized later ... Shalom On Wed, Mar 23, 2011 at 3:41 PM, Igor Tandetnik wrote: > On 3/23/2011 8:42 AM, Simon Slavin wrote: > > On 23 Mar 2011, at 11:27am, Igor Tandetnik

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread Pavel Ivanov
> Yes, but I can not affect column type ... FreePascal SQLite3 connector must > be able to work with any user database. If your goal is to work with any user database created outside of your FreePascal connector then chances are that user will use the same database outside of your FreePascal

Re: [sqlite] detect a flaw

2011-03-23 Thread Igor Tandetnik
On 3/23/2011 8:42 AM, Simon Slavin wrote: > On 23 Mar 2011, at 11:27am, Igor Tandetnik wrote: >> Shalom Elkin wrote: >>> id 3 doesn't exist, the insertion fails. Now, this was easy. what if >>> ac.inhad millions of rows? I am looking for some way to get a message >>> like

Re: [sqlite] Sorting of Korean Language Characters

2011-03-23 Thread ashish yadav
Hi Simon , Yes , i try .but got mix result of sorted strings. I have one sorted stings sequence base on Hangul Jamo like : 1. 서산 2. 서울 3. 수원 4. 순천 But this same sequence , i not got when i use : SELECT icu_load_collation('ko_KR', 'KOREAN'); So that why i can't say if ICU support

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread LacaK
And...no conversion is performed if you declare the field as text and insert as text. Yes, but I can not affect column type ... FreePascal SQLite3 connector must be able to work with any user database. And when user defines column like NUMERIC or DECIMAL ... so with NUMERIC column affinity,

Re: [sqlite] Sorting of Korean Language Characters

2011-03-23 Thread Simon Slavin
On 23 Mar 2011, at 10:07am, ashish yadav wrote: > I think , Korean sorting base on Jamo(Hangul Jamo) is not supported by ICU. > May be i am wrong . > I have gone through ICU user guide & its locale but not find any Hangul > Jamo support by ICU Collation service. Let's get this straight. Have

Re: [sqlite] detect a flaw

2011-03-23 Thread Simon Slavin
On 23 Mar 2011, at 11:27am, Igor Tandetnik wrote: > Shalom Elkin wrote: >> id 3 doesn't exist, the insertion fails. Now, this was easy. what if >> ac.inhad millions of rows? I am looking for some way to get a message >> like "error >> in line 3: foreign key mismatch". >

Re: [sqlite] adding/dropping foreign key to existing table

2011-03-23 Thread Simon Slavin
On 23 Mar 2011, at 11:39am, Sam Carleton wrote: > My goal in adding foreign keys (FK) is simple: Implement referential > integrity (RI) at the database level, that way I don't shoot myself in the > foot later (I am the only developer at this time). [snip] That's fine. > So what I am wondering

Re: [sqlite] Reg: Link error while using sqlite 3

2011-03-23 Thread Black, Michael (IS)
Unless you're running multiple SQLite apps you don't gain anything by using a DLL. Plus, is your Pocket PC a i386 CPU? So try downloading the amalgamation and include sqlite3.c and sqlite3.h in your project. http://www.sqlite.org/sqlite-amalgamation-3070500.zip You'll also find the code will

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread Black, Michael (IS)
Blob may be better if you need speed -- then no conversion is necessary inside your Pascal code to/from a string. But if you want to be able to see and understand your database text is better (or you have to write a special Pascal program to decode your database to look at any problems).

Re: [sqlite] Link error while using sqlite 3

2011-03-23 Thread Igor Tandetnik
Ota Durai wrote: > I am working on a project in vs2008 with an pocket pc. > I have downloaded the sqlite3.dll and sqlite3.h files from the amalgation & > dll > of sqlite site. > i have created the lib file from this def file using the command "lib > /machine:i386

Re: [sqlite] adding/dropping foreign key to existing table

2011-03-23 Thread Sam Carleton
On Tue, Mar 22, 2011 at 10:55 PM, BareFeetWare wrote: > > You have to drop the old table and create a new one with the changed > foreign keys. This is a bummer. Is there any desire/plan to add an alter feature, in the future? > > Also, from a performance

Re: [sqlite] detect a flaw

2011-03-23 Thread Igor Tandetnik
Shalom Elkin wrote: > id 3 doesn't exist, the insertion fails. Now, this was easy. what if > ac.inhad millions of rows? I am looking for some way to get a message > like "error > in line 3: foreign key mismatch". Write a program that parses the file, runs INSERT statement

[sqlite] PRAGMA cache_size problem

2011-03-23 Thread Jaco Breitenbach
Dear all, I have compiled sqlite-autoconf-3070500 on a RedHat Linux machine. My application is written in C, so uses the SQLite C interface. At startup I connect to an admin datafile, and then attach 20 more datafiles to the connection. After creating the initial connection (before attaching

[sqlite] Reg: Link error while using sqlite 3

2011-03-23 Thread Ota Durai
--- On Tue, 3/22/11, Ota Durai wrote: From: Ota Durai Subject: Reg: Link error while using sqlite 3 To: sqlite-users@sqlite.org Date: Tuesday, March 22, 2011, 10:25 AM Dear Sir/Madam,   I am working on a project in vs2008 with an pocket pc. I

Re: [sqlite] In-memory database with persistent storage

2011-03-23 Thread Amit Chaudhuri
..representation of a decent sized real world network.. On Tue, Mar 22, 2011 at 10:59 AM, Bart Smissaert wrote: > > through a version of dijkstra's routing algorithm > > Just out of interest, what data is this working on? > > RBS > > On Tue, Mar 22, 2011 at 7:25 AM,

[sqlite] Reg: Link error while using sqlite 3

2011-03-23 Thread Ota Durai
Dear Sir/Madam, I am working on a project in vs2008 with an pocket pc. I have downloaded the sqlite3.dll and sqlite3.h files from the amalgation & dll of sqlite site. i have created the lib file from this def file using the command "lib /machine:i386 /def:sqlite3.def". and i have linked it to

Re: [sqlite] Sorting of Korean Language Characters

2011-03-23 Thread ashish yadav
Hi Jean , I think , Korean sorting base on Jamo(Hangul Jamo) is not supported by ICU. May be i am wrong . I have gone through ICU user guide & its locale but not find any Hangul Jamo support by ICU Collation service. Yes, i got your mail ... Thanks for info... But I am working on Linux

[sqlite] detect a flaw

2011-03-23 Thread Shalom Elkin
All, I am new to SQLITE. Here's the challenge: sqlite> .dump BEGIN TRANSACTION; CREATE TABLE people( id integer, nm text); INSERT INTO "people" VALUES(1,'Jack'); INSERT INTO "people" VALUES(2,'Jill'); CREATE TABLE activity( aid integer, act text, foreign

Re: [sqlite] PRAGMA cache_size problem

2011-03-23 Thread Jaco Breitenbach
Hi Dan, That fixed the problem for me. Thanks a lot, much appreciated! Best regards, Jaco On 23 March 2011 09:10, Dan Kennedy wrote: > On 03/23/2011 03:26 PM, Jaco Breitenbach wrote: > > Dear experts, > > > > I have compiled sqlite-autoconf-3070500 on a RedHat Linux

Re: [sqlite] Sorting of Korean Language Characters

2011-03-23 Thread Jean-Christophe Deschamps
At 09:43 23/03/2011, you wrote: >I am working on one application which require sorting for Korean Language. > >The Korean Characters sort by Jamo(Hangul Jamo) ie based on KSX1001 >character code. > >Does sqlite3 or any other package support this type of sorting ? >If not , then any clue to carry

Re: [sqlite] PRAGMA cache_size problem

2011-03-23 Thread Dan Kennedy
On 03/23/2011 03:26 PM, Jaco Breitenbach wrote: > Dear experts, > > I have compiled sqlite-autoconf-3070500 on a RedHat Linux machine. My > application is written in C, so uses the SQLite C interface. > > At startup I connect to an admin datafile, and then attach 20 more datafiles > to the

[sqlite] Sorting of Korean Language Characters

2011-03-23 Thread ashish yadav
Hi , I am working on one application which require sorting for Korean Language. The Korean Characters sort by Jamo(Hangul Jamo) ie based on KSX1001 character code. Does sqlite3 or any other package support this type of sorting ? If not , then any clue to carry out this type of sorting ? Thanks

[sqlite] PRAGMA cache_size problem

2011-03-23 Thread Jaco Breitenbach
Dear experts, I have compiled sqlite-autoconf-3070500 on a RedHat Linux machine. My application is written in C, so uses the SQLite C interface. At startup I connect to an admin datafile, and then attach 20 more datafiles to the connection. After creating the initial connection (before

Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

2011-03-23 Thread LacaK
Here are two options which will let you get the contents back to the original precision: A) Store the values as BLOBs. B) Store the value as TEXT, but add a non-digit to the beginning of each number value, for example X24395734857634756.92384729847239842398423964294298473927 Both