Re: [sqlite] how to compose the sql sentence?

2009-06-03 Thread liubin liu
Thank you a lot! I created a table: CREATE TABLE data ( num INTEGER, di CHAR(4), data CHAR(12), time1 INTEGER, time2 INTEGER, format CHAR(1) ); and create a index: CREATE INDEX i_data ON data (num, di, time1); I want to do: first tell whether there is a record in the table "data" according to

Re: [sqlite] Perticular Field encription in sqlite3 database

2009-06-03 Thread Jay A. Kreibich
On Tue, Jun 02, 2009 at 11:04:05PM -0700, Roger Binns scratched on the wall: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Sambasivarao Vemula wrote: > > I want to encrypt a perticular field in sqlite3 database. > > You can use the SQLite Encryption Extension which will encrypt the wh

Re: [sqlite] how can we solve IF EXIST in SQLite

2009-06-03 Thread Harold Wood & Meyuni Gani
Hmm, I have a view, its strictly a bunch of bit columns. Default value is 0=false, this view has a huge trigger on it. I use the different columns to activate particular sections of the trigger code, within those I do inserts, deletes, updates etc. It was a design around not having stored pr

Re: [sqlite] Getting last inserted rowid?

2009-06-03 Thread Harold Wood & Meyuni Gani
If you are inserting in order then selecting the max value from an indexed column should work. Harold Wood -Original Message- From: Nikolaus Rath Sent: Wednesday, June 03, 2009 3:22 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Getting last inserted rowid? Nuno Lucas writes:

Re: [sqlite] sqlite programmed in C++ ...

2009-06-03 Thread Sylvain Pointeau
Hi, I also like C very much even if I prefer C++ Please note that I was asking to introduce C++ not to re-write (which would be a total non-sense) I just repeat that I use sqlite every days, and I find it awesome, I love it. C or C++? at the end : who cares? I strongly believe that the persons ar

Re: [sqlite] Getting last inserted rowid?

2009-06-03 Thread John Machin
On 4/06/2009 12:57 PM, Nikolaus Rath wrote: > John Machin writes: >> On 4/06/2009 8:22 AM, Nikolaus Rath wrote: >>> Nuno Lucas writes: On Wed, Jun 3, 2009 at 2:41 AM, Nikolaus Rath wrote: > Nuno Lucas writes: >> On Tue, May 26, 2009 at 5:17 PM, Nikolaus Rath wrote: >>> Hello,

Re: [sqlite] sqlite programmed in C++

2009-06-03 Thread Rajesh Nair
Excellent. I posted a question of development of sqlite in C++ long before. But this discussion benefited me and I think all those who depends upon C++ may have got a good direction. I am using sqlite with my own C++ wrapper since I am using VC++ to develop applications for last 5 years. Thanks,

Re: [sqlite] Getting last inserted rowid?

2009-06-03 Thread Nikolaus Rath
John Machin writes: > On 4/06/2009 8:22 AM, Nikolaus Rath wrote: >> Nuno Lucas writes: >>> On Wed, Jun 3, 2009 at 2:41 AM, Nikolaus Rath wrote: Nuno Lucas writes: > On Tue, May 26, 2009 at 5:17 PM, Nikolaus Rath wrote: >> Hello, >> >> How can I determine the rowid of the l

Re: [sqlite] Db design question (so. like a tree)

2009-06-03 Thread Dennis Cote
Jay A. Kreibich wrote: > > You can't with just SQL. This is the whole issue with adjacency lists. > Most basic operations, like finding ancestor lists, counting tree depths, > finding a list of all children or descendants, etc., require some > kind of loop. > > I have posted about the

Re: [sqlite] how can we solve IF EXIST in SQLite

2009-06-03 Thread BareFeet
Hi Dennis, > When I saw this I though "What language is this? It's certainly not > English." :-) > > It seems to me that robinsmathew should investigate the shift key, > and the spell check functions in his email client. Agreed. There were also missing characters from the "English" and SQL.

Re: [sqlite] how can we solve IF EXIST in SQLite

2009-06-03 Thread Dennis Cote
robinsmathew wrote: > hey thanx for the reply... u leave the things happening inside.. wat i jus > wanna do is i wanna insert a new row to a table > the table will be like this > stock_id PKproduct_id FK quantitystock_date > 1 100010

Re: [sqlite] how can we solve IF EXIST in SQLite

2009-06-03 Thread BareFeet
Hi Harold, > SQL does have branching logic. > > (SELECT CASE > WHEN ((SELECT StoreId From History WHERE ItemId = NEW.ID LIMIT > 1) IS NULL) > THEN > 0 > ELSE > (SELECT StoreId FROM History WHERE ItemId = NEW.ID AND > UnitPrice = (SELECT MIN(UnitPrice) FROM HISTORY WHERE I

Re: [sqlite] Types for strings, non-expert question

2009-06-03 Thread Dennis Cote
Roger Binns wrote: > I assume you are talking about a major release (ie SQLite v4 not 3.7). > Yes, that's what I'm talking about. I would expect v3 and v4 to be maintained in parallel until most users have updated their code to work with v4. Of course users could continue to use v3 indefinitel

Re: [sqlite] how can we solve IF EXIST in SQLite

2009-06-03 Thread Harold Wood
SQL does have branching logic.   (SELECT CASE WHEN ((SELECT StoreId From History WHERE ItemId = NEW.ID LIMIT 1) IS NULL) THEN  0 ELSE  (SELECT StoreId FROM History WHERE ItemId = NEW.ID AND UnitPrice = (SELECT MIN(UnitPrice) FROM HISTORY WHERE ItemId = NEW.ID)) END); i us

Re: [sqlite] how can we solve IF EXIST in SQLite

2009-06-03 Thread BareFeet
Hi Mathew, > hi am new to SQLite can anybody please tell me how this query can be > solved > in SQLite? > > IF EXISTS (SELECT prod_batch_code FROM stock_tab WHERE > prod_batch_code=1000) >UPDATE stock_tab >SET stock_qty=stock_qty+(SELECT purchase_qty ROM purchase_tab > WHERE

Re: [sqlite] Getting last inserted rowid?

2009-06-03 Thread John Machin
On 4/06/2009 8:22 AM, Nikolaus Rath wrote: > Nuno Lucas writes: >> On Wed, Jun 3, 2009 at 2:41 AM, Nikolaus Rath wrote: >>> Nuno Lucas writes: On Tue, May 26, 2009 at 5:17 PM, Nikolaus Rath wrote: > Hello, > > How can I determine the rowid of the last insert if I am accessing t

Re: [sqlite] Getting last inserted rowid?

2009-06-03 Thread Nikolaus Rath
Nuno Lucas writes: > On Wed, Jun 3, 2009 at 2:41 AM, Nikolaus Rath wrote: >> Nuno Lucas writes: >>> On Tue, May 26, 2009 at 5:17 PM, Nikolaus Rath wrote: Hello, How can I determine the rowid of the last insert if I am accessing the db from different threads? If I understand

Re: [sqlite] sqlite programmed in C++ ...

2009-06-03 Thread Rob Sciuk
John Stanton wrote: > This is something of a digression but is pertinent. Colleagues who > worked with Bjarne Thorstrup (inventer of C++) tell me that Bjarne was > disillusioned with C++ and its wide deployment and would encourage > people not to use it unless there were clear advantages. > > In

Re: [sqlite] Schema design and/or SELECT construction

2009-06-03 Thread Craig Smith
Chris and Jay: Thank you both very much for your comments; that solves it. I am not a trained database designer, but I have resources on normalization; I simply neglected to consult them, thinking that this was a SELECT problem, not a design problem. Your input was just what I was hoping

Re: [sqlite] Db design question (so. like a tree)

2009-06-03 Thread Jay A. Kreibich
On Wed, Jun 03, 2009 at 09:11:23PM +0200, Jan scratched on the wall: > I thought about the adjacency lists. The columns would basically look > like this I guess: > > animal_id (PK), animal_id (father), aninmal_id (mother) > > Since I cant do a loop in sql how could I build a trigger securing, th

Re: [sqlite] How to change the default values option when build SQLite 3.6.14

2009-06-03 Thread Joanne Pham
Thanks a lot Pavel. JP From: Pavel Ivanov To: General Discussion of SQLite Database Sent: Wednesday, June 3, 2009 12:59:28 PM Subject: Re: [sqlite] How to change the default values option when build SQLite 3.6.14 You can do during configuration: ../sqlite/c

Re: [sqlite] sqlite programmed in C++

2009-06-03 Thread Sylvain Pointeau
if I had to do a library, I would probably choose C++,at least the subset C with classes. I will then export the main function as "C" many libraries are done like that now. for example http://www.ode.org/ is mostly written in C++ but has an interface in C I also use Qt because it has a clean API

Re: [sqlite] How to change the default values option when build SQLite 3.6.14

2009-06-03 Thread Pavel Ivanov
You can do during configuration: ../sqlite/configure -DSQLITE_THREADSAFE=2 Pavel On Wed, Jun 3, 2009 at 2:27 PM, Joanne Pham wrote: > Hi All, > I would like to build the SQLite 3.6.14 to following the steps as mentioned > in the document >     tar xzf sqlite.tar.gz ;# Unpack the source tree i

Re: [sqlite] Db design question (so. like a tree)

2009-06-03 Thread Jay A. Kreibich
On Wed, Jun 03, 2009 at 10:51:52AM -0700, Harold Wood scratched on the wall: > just curious. why not a table for stricty for the linkages > ? > structure similar to > ? > create table Linkages > ( > ??? Parent_Id int, > ??? Child_Id? int > ??? PRIMARY KEY (Parent_Id, Child_Id)) > ? > This would a

Re: [sqlite] how can we solve IF EXIST in SQLite

2009-06-03 Thread Harold Wood
Select case    when ((Select stock_id from Table where Stock_Id = ?)  IS NULL)  then     insert into Table   else    update Table end; --- On Wed, 6/3/09, Kees Nuyt wrote: From: Kees Nuyt Subject:

[sqlite] Add to mailing list

2009-06-03 Thread Mohey Eldin Hamdy
___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Db design question (so. like a tree)

2009-06-03 Thread Jan
I thought about the adjacency lists. The columns would basically look like this I guess: animal_id (PK), animal_id (father), aninmal_id (mother) Since I cant do a loop in sql how could I build a trigger securing, that no child is e.g a father of it's own father (or grand-father and so on)? To

[sqlite] How to change the default values option when build SQLite 3.6.14

2009-06-03 Thread Joanne Pham
Hi All, I would like to build the SQLite 3.6.14 to following the steps as mentioned in the document     tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite"     mkdir bld ;# Build will occur in a sibling directory     cd bld ;# Change to the build directory     ../sqlite/configure ;# Run

Re: [sqlite] how can we solve IF EXIST in SQLite

2009-06-03 Thread Kees Nuyt
On Wed, 3 Jun 2009 00:42:53 -0700 (PDT), Harold Wood wrote: >you should use the insert or replace statement, >it inserts if the row doesnt exist, if the row >does exists then it updates the row. No, that doesn't fulfil the requirement, because quantity isn't incremented. >--- On Wed, 6/3/09, r

Re: [sqlite] Db design question (so. like a tree)

2009-06-03 Thread Harold Wood
just curious. why not a table for stricty for the linkages   structure similar to   create table Linkages (     Parent_Id int,     Child_Id  int     PRIMARY KEY (Parent_Id, Child_Id))   This would allow a lot of flexability in the parenting, you could have (A:B), (A:C), (B:D), (B:E), (B:F), (E:G

Re: [sqlite] Db design question (so. like a tree)

2009-06-03 Thread Jay A. Kreibich
On Wed, Jun 03, 2009 at 12:25:14AM +0200, Jan scratched on the wall: > Hi, > > If you don't want to update, but you do want to query for entire > > subtrees, do give nested sets more consideration. > > But as Jay pointed out: Nested sets only work with one parent. Do they? You can think of nest

Re: [sqlite] how to compose the sql sentence?

2009-06-03 Thread Simon Slavin
On 3 Jun 2009, at 7:05am, liubin liu wrote: > the first step is to tell if there is the data in the table. > if the answer is not, I want to insert a row of data into the table > if the answer is yes, I need to update the row of data acccording to > the > data inputting from me. INSERT OR REPL

Re: [sqlite] Schema design and/or SELECT construction

2009-06-03 Thread Jay A. Kreibich
On Mon, Jun 01, 2009 at 09:21:40PM -0700, Craig Smith scratched on the wall: > Hello: > > I have about 3000 electronic images that I am preparing to distribute > to my family members. They use a variety of operating systems, so I > am providing the images on remote hard drives, with the image

Re: [sqlite] sqlite programmed in C++

2009-06-03 Thread John Stanton
Indeed. Very good reply. > To Sylvain, once again: speculating on what went into the minds of the > developers, when they set out to develop SQLite, they chose the best, > most concise, most portable, most universally compilable, mother of > almost all languages. Once they developed something that

Re: [sqlite] [OT] Basic Netbeans project won't run on SQLite [SOLVED]

2009-06-03 Thread Nuno Magalhães
Eh... even though i chose an SQLite database, Netbeans doesn't include the sqlite.jar ... -- ()  ascii ribbon campaign - against html e-mail /\  ascii-rubanda kampajno - kontraŭ html-a retpoŝto ___ sqlite-users mailing list sqlite-users@sqlite.org http:/

Re: [sqlite] sqlite programmed in C++

2009-06-03 Thread Fred Williams
Well said! C++ provides the average programmer "automated" Object Orientation, or better stated, good programming practices, at a price. A good C programmer can equal and most times exceed the results of a C++ programming project. As previously stated C is really just a lazy man's Assembler, and

[sqlite] [OT] Basic Netbeans project won't run on SQLite

2009-06-03 Thread Nuno Magalhães
Greetings, i'm trying to use SQLite for an academic project, with Netbeans (has to be java). I followed "new desktop application » database" and chose SQLite (after installing said plugin). But even for a test run, it gives me this error: Jun 3, 2009 2:49:12 PM org.jdesktop.application.Applicatio

Re: [sqlite] Schema design and/or SELECT construction

2009-06-03 Thread Chris Peachment
What's wrong with a properly normalised schema like this: create table main (id, name,...); create table keyword (id, label); create table crossref (id_main, id_keyword); The concept of core and other keywords is a bit arbitrary. What is important (i.e. core) today might not be so tomorrow. Pa

Re: [sqlite] Getting last inserted rowid?

2009-06-03 Thread Nuno Lucas
On Wed, Jun 3, 2009 at 2:41 AM, Nikolaus Rath wrote: > Nuno Lucas writes: >> On Tue, May 26, 2009 at 5:17 PM, Nikolaus Rath wrote: >>> Hello, >>> >>> How can I determine the rowid of the last insert if I am accessing the >>> db from different threads? If I understand correctly, >>> last_insert_r

Re: [sqlite] sqlite programmed in C++

2009-06-03 Thread Ibrahim A
Hi all, I'd like to comment this topic as well. I think C is a very good choice for projects like sqlite. The point is that C is in contrary to C++ very easily portable. If you have the bad luck that you have to port a programm on a new plattform for which no compiler suites exist than the cho

Re: [sqlite] SQLite command line interpreter vs DLL

2009-06-03 Thread Ibrahim A
Fam. Sera schrieb: > Is there a reason why the command line interpreter supports more functions > while the dll does not? > > I would like to create an application using SQLite with and in memory > database. I have some big text files (csv), which can be imported nicely by > the command line int

Re: [sqlite] sqlite programmed in C++

2009-06-03 Thread Sylvain Pointeau
yes true, case closed then ! Many thanks for all of your answers. Cheers, Sylvain On Wed, Jun 3, 2009 at 12:17 PM, P Kishor wrote: > On Wed, Jun 3, 2009 at 5:02 AM, Hamish Allan wrote: > > On Wed, Jun 3, 2009 at 8:59 AM, Sylvain Pointeau > > wrote: > > > >> I can perfectly understand the dec

Re: [sqlite] SQLite command line interpreter vs DLL

2009-06-03 Thread P Kishor
On Wed, Jun 3, 2009 at 2:22 AM, Fam. Sera wrote: > > Is there a reason why the command line interpreter supports more functions > while the dll does not? > > I would like to create an application using SQLite with and in memory > database. I have some big text files (csv), which can be imported

Re: [sqlite] sqlite programmed in C++

2009-06-03 Thread P Kishor
On Wed, Jun 3, 2009 at 5:02 AM, Hamish Allan wrote: > On Wed, Jun 3, 2009 at 8:59 AM, Sylvain Pointeau > wrote: > >> I can perfectly understand the decision made few years ago,and the result is >> splendid, I use SQLite every days. >> >> I am just wondering why not introducing C++? for better mem

Re: [sqlite] Perticular Field encription in sqlite3 database

2009-06-03 Thread P Kishor
On Wed, Jun 3, 2009 at 1:04 AM, Roger Binns wrote: > But wait, there is more.  If rows store the same password then they will > have the same hash which means if either user sees the file they can > compromise the other user.  In addition crackers have generated tables > mapping all letter and num

Re: [sqlite] sqlite programmed in C++

2009-06-03 Thread Hamish Allan
On Wed, Jun 3, 2009 at 8:59 AM, Sylvain Pointeau wrote: > I can perfectly understand the decision made few years ago,and the result is > splendid, I use SQLite every days. > > I am just wondering why not introducing C++? for better memory management > for example (RAII) > > I am just wondering, d

[sqlite] Schema design and/or SELECT construction

2009-06-03 Thread Craig Smith
Hello: I have about 3000 electronic images that I am preparing to distribute to my family members. They use a variety of operating systems, so I am providing the images on remote hard drives, with the images divided into folders based on years the images were created. All images were obt

Re: [sqlite] how can we solve IF EXIST in SQLite

2009-06-03 Thread John Machin
On 3/06/2009 5:15 PM, robinsmathew wrote: > its showing an error near "if": syntax error "it", my crystal ball tells me, is an SQL processor, behaving much as expected when fed what looks like an "if" statement in some other language ... > Kees Nuyt wrote: >> Pseudocode: google("pseudocode")

Re: [sqlite] sqlite programmed in C++

2009-06-03 Thread Sylvain Pointeau
I can perfectly understand the decision made few years ago,and the result is splendid, I use SQLite every days. I am just wondering why not introducing C++? for better memory management for example (RAII) I am just wondering, don't reply aggressively please ... Cheers, Sylvain On Wed, Jun 3, 20

Re: [sqlite] how can we solve IF EXIST in SQLite

2009-06-03 Thread Harold Wood
you should use the insert or replace statement, it inserts if the row doesnt exist, if teh row does exists then it updates the row. --- On Wed, 6/3/09, robinsmathew wrote: From: robinsmathew Subject: Re: [sqlite] how can we solve IF EXIST in SQLite To: sqlite-users@sqlite.org Date: Wednesday,

[sqlite] SQLite command line interpreter vs DLL

2009-06-03 Thread Fam. Sera
Is there a reason why the command line interpreter supports more functions while the dll does not? I would like to create an application using SQLite with and in memory database. I have some big text files (csv), which can be imported nicely by the command line interpreter using the .import co

Re: [sqlite] how can we solve IF EXIST in SQLite

2009-06-03 Thread robinsmathew
its showing an error near "if": syntax error Kees Nuyt wrote: > > On Tue, 2 Jun 2009 03:36:46 -0700 (PDT), robinsmathew > wrote: > >> >>hey thanx for the reply... u leave the things happening inside.. wat i jus >>wanna do is i wanna insert a new row to a table >>the table will be like this >>