Re: [sqlite] last N records

2007-04-09 Thread Eric S. Johansson
Dennis Cote wrote: Eric S. Johansson wrote: what is the easiest way to hold on to the last N records and delete all older? I can't figure out the right where expression. --- eric Eric, I posted some sample code to use a table as FIFO (last N records) to the list a while ago. See

Re: [sqlite] SQLite and nested transactions

2007-04-09 Thread drh
"Igor Tandetnik" <[EMAIL PROTECTED]> wrote: > > I'd still like some limited notion of a savepoint to be implemented, to > support enlisting a SQLite node into a distributed transaction. You see, > three-phase distributed commit protocol requires the possibility of a > "roll-forward" state. In

[sqlite] Re: SQLite and nested transactions

2007-04-09 Thread Igor Tandetnik
Darren Duncan <[EMAIL PROTECTED]> wrote: The whole point of being implemented as separate transactions rather than "save points" is that any particular block of code or SQL that needs to be atomic doesn't have to special case how it is defined depending on whether it is a main or child

Re: [sqlite] SQLite and nested transactions

2007-04-09 Thread Raymond Hurst
This is all good stuff but I'm getting a little lost. The gist of it all is that SQLite needs to be modified to support nested transactions with a journal per transaction scheme. Correct? The counter idea was good but it didn't support Igor's example. Hope I am correct here. Ray [EMAIL

RE: [sqlite] Passing Arguments to SQLite3 from C++

2007-04-09 Thread James Dennett
It's worth briefly, for the record, mentioning that the code using += is what often causes SQL injection security issues, and that prepared statements using parameters are the way to avoid that. -- James > -Original Message- > From: nshaw [mailto:[EMAIL PROTECTED] > Sent: Monday, April

Re: [sqlite] Passing Arguments to SQLite3 from C++

2007-04-09 Thread nshaw
Thanks, Ted. I'll give this a shot. Regards, Nick. Teg wrote: > > Hello nshaw, > > std::string m_sSQL = "CREATE TABLE IF NOT EXISTS "; > m_sSQL += g_pszTableName; > m_sSQL += "(" ; > m_sSQL += "AR_FilenameTEXT PRIMARY KEY," > ; >

[sqlite] Re: SQLite and nested transactions

2007-04-09 Thread Igor Tandetnik
Griggs, Donald <[EMAIL PROTECTED]> wrote: Regarding: "...As Igor pointed out this does not resemble a full implementation of transactions, as nested transactions can be committed and rolled back independently of the outer parent transaction." Nonetheless, it would seem, just from the couple

Re: [sqlite] sqlite3BtreeMoveto broke between 3.3.12->3.3.14/15

2007-04-09 Thread pompomJuice
mmm... this is very embarrassing. I will implement the sql again then. Clearly I messed up big time. Thanks for the help. drh wrote: > > pompomJuice <[EMAIL PROTECTED]> wrote: >> I could get a maximum of 300-400 lookups per second using >> a conventional "select * from table where column =

Re: [sqlite] Version 3.3.15

2007-04-09 Thread Alexey Tourbin
On Mon, Apr 09, 2007 at 08:31:48PM +, [EMAIL PROTECTED] wrote: > > corrupt3-1.3...*** stack smashing detected ***: ./testfixture terminated > > make: *** [test] Aborted > > http://www.sqlite.org/cvstrac/chngview?cn=3832 Thanks. pgphnce3I6sXZ.pgp Description: PGP signature

Re: AW: AW: AW: [sqlite] Function Language

2007-04-09 Thread John Stanton
Thankyou for the links. AppWeb has a different paradigm from what I am building but makes an interesting study. on Scully wrote: AppWeb might be suitable for what you need: http://www.appwebserver.org/ http://www.appwebserver.org/products/appWeb/doc/api/gen/appweb/esp_8js.html

Re: [sqlite] Version 3.3.15

2007-04-09 Thread drh
Alexey Tourbin <[EMAIL PROTECTED]> wrote: > On Mon, Apr 09, 2007 at 02:07:24PM +, [EMAIL PROTECTED] wrote: > > SQLite version 3.3.15 is now available on the website > > corrupt3-1.3...*** stack smashing detected ***: ./testfixture terminated > make: *** [test] Aborted

Re: AW: AW: AW: [sqlite] Function Language

2007-04-09 Thread Jon Scully
AppWeb might be suitable for what you need: http://www.appwebserver.org/ http://www.appwebserver.org/products/appWeb/doc/api/gen/appweb/esp_8js.html http://www.appwebserver.org/products/appWeb/doc/api/gen/appweb/c-api.html It's small-footprint, extensible through modules or compile-time (C or

[sqlite] Re: SQLite and nested transactions

2007-04-09 Thread Darren Duncan
At 12:33 PM -0400 4/9/07, Igor Tandetnik wrote: Dennis Cote <[EMAIL PROTECTED]> wrote: Darren Duncan wrote: I will clarify that child transactions are just an elegant way of partitioning a larger task, and that parent transactions always overrule children; even if a child transaction commits

Re: [sqlite] Version 3.3.15

2007-04-09 Thread Alexey Tourbin
On Mon, Apr 09, 2007 at 02:07:24PM +, [EMAIL PROTECTED] wrote: > SQLite version 3.3.15 is now available on the website corrupt3-1.3...*** stack smashing detected ***: ./testfixture terminated make: *** [test] Aborted pgpdiEyWVpdsH.pgp Description: PGP signature

Re: [sqlite] Re: FTS does not support REPLACE

2007-04-09 Thread Scott Hess
Thanks for the concise report. I'm going to take a look at this today, to see if it's an fts1/2 problem. If it's _not_, I'll still look at it, but perhaps with less eventual success :-). -scott On 4/9/07, Paul Quinn <[EMAIL PROTECTED]> wrote: Very simple to replicate: CREATE VIRTUAL

AW: [sqlite] SQLite and nested transactions

2007-04-09 Thread Michael Ruck
That Sybase and MS SQL match on their behavior is no surprise considering their common heritage ;) I suppose MS (and sybase for that matter) hasn't done anything on the transaction support since they've split their code bases. -Ursprüngliche Nachricht- Von: Griggs, Donald [mailto:[EMAIL

[sqlite] Re: FTS does not support REPLACE

2007-04-09 Thread Paul Quinn
Very simple to replicate: CREATE VIRTUAL TABLE fts_table USING fts2(text); INSERT OR REPLACE INTO fts_table (rowid, text) VALUES (1, 'text1'); INSERT OR REAPLCE INTO fts_table (rowid, text) VALUES (1, 'text2'); The first insert succeeds, the second fails. Is FTS not supposed to

Re: [sqlite] Passing Arguments to SQLite3 from C++

2007-04-09 Thread John Stanton
nshaw wrote: Help! I've done everything I can think of to pass arguments to SQLite and nothing is working. If anyone has information on how to do it, I'd appreciate it. Here's a code segment: #include #include #include #include "util.h"

Re: [sqlite] Version 3.3.15

2007-04-09 Thread Clark Christensen
The sqlite3.def file is included in the Zip archive with the precompiled Windows DLL (http://www.sqlite.org/sqlitedll-3_3_15.zip). For me, it's a minor annoyance to have to download the precompiled DLL when I'm making the DLL from source. I've been meaning to ask to have sqlite3.def included

Re: [sqlite] Passing Arguments to SQLite3 from C++

2007-04-09 Thread Teg
Hello nshaw, std::string m_sSQL = "CREATE TABLE IF NOT EXISTS "; m_sSQL += g_pszTableName; m_sSQL += "(" ; m_sSQL += "AR_FilenameTEXT PRIMARY KEY," ; m_sSQL += "AR_Subject TEXT ," ; m_sSQL +=

[sqlite] Re: Some questions on hierarchical data (nested set model)

2007-04-09 Thread A. Pagaltzis
Hi Jef, * Jef Driesen <[EMAIL PROTECTED]> [2007-04-06 11:20]: > Q1. Which is more efficient? Two simple queries or one self > join? > > I have seen two different types of queries to retrieve a tree. > The first one uses two very simple queries: > > SELECT lft, rgt FROM tree WHERE name = @name;

RE: [sqlite] SQLite and nested transactions

2007-04-09 Thread Griggs, Donald
Regarding: "...As Igor pointed out this does not resemble a full implementation of transactions, as nested transactions can be committed and rolled back independently of the outer parent transaction." Nonetheless, it would seem, just from the couple of pages below, that some DB vendors find the

RE: [sqlite] Master table with child FTS table

2007-04-09 Thread Samuel R. Neff
Then perhaps an insert into a VIEW with an INSTEAD OF trigger would be appropriate? Best regards, Sam --- We're Hiring! Seeking a passionate developer to join our team building products. Position is in the Washington D.C. metro area. If interested

Re: [sqlite] Version 3.3.15

2007-04-09 Thread Gunnar Roth
[EMAIL PROTECTED] schrieb: SQLite version 3.3.15 is now available on the website http://www.sqlite.org/ This release fixes a problem introduced in 3.3.14 which causes the database connection to become wedged if you attempt to ROLLBACK a CREATE TEMP TABLE statement. Hello Mr. Hipp. Is

AW: [sqlite] SQLite and nested transactions

2007-04-09 Thread Michael Ruck
Yes, but this violates ACID principles. As Igor pointed out this does not resemble a full implementation of transactions, as nested transactions can be commited and rolled back independently of the outer parent transaction. Mike -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED]

RE: [sqlite] Passing Arguments to SQLite3 from C++

2007-04-09 Thread James Dennett
nshaw writes: > Help! > > I've done everything I can think of to pass arguments to SQLite and > nothing > is working. If anyone has information on how to do it, I'd appreciate it. > Here's a code segment: [edited to remove SQL3-related material] > int main (int argc, char **argv) > { >

[sqlite] Passing Arguments to SQLite3 from C++

2007-04-09 Thread nshaw
Help! I've done everything I can think of to pass arguments to SQLite and nothing is working. If anyone has information on how to do it, I'd appreciate it. Here's a code segment: #include #include #include #include "util.h"

[sqlite] Possibly OT: Looking for a query analyzer-type tool with indentation support

2007-04-09 Thread PeteL
Hi. I've tried out a few SQLite tools (both freeware and shareware) and, while several of them seem pretty decent, none that I've found seem to support indentation (either that or I'm retarded). In other words, I want to use/map a keystroke (e.g., tab) to indent/unindent a single line or even a

Re: [sqlite] Master table with child FTS table

2007-04-09 Thread Paul Quinn
I've worked this issue with FTS1 and FTS2 and they both have the same problem. For the trigger, the data is not available in the trigger because the data that would be inserted into the FTS on the trigger is not part of the insert for the master table. Thus it is not available on the trigger.

Re: [sqlite] SQLite and nested transactions

2007-04-09 Thread rhurst2
So. If i read this code right. * The transaction_level keeps track of how many nested transactions have occurred. * Only the parent transaction allows the commit. In this case, only a single journal is required (the parent journal). Thanks, Ray Dennis Cote <[EMAIL PROTECTED]> wrote: >

[sqlite] Re: SQLite and nested transactions

2007-04-09 Thread Igor Tandetnik
Dennis Cote <[EMAIL PROTECTED]> wrote: Darren Duncan wrote: I will clarify that child transactions are just an elegant way of partitioning a larger task, and that parent transactions always overrule children; even if a child transaction commits successfully, a rollback of its parent means

Re: [sqlite] Possible database corruption?

2007-04-09 Thread pa_ng
Yes, it turns out that synchronous=OFF was set, AND the machine/OS is crashing daily. Not a good combination. Will correct the synchronous setting. Thanks Doug > > From: [EMAIL PROTECTED] > Date: 2007/04/09 Mon AM 11:52:17 EDT > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Possible

Re: [sqlite] sqlite3BtreeMoveto broke between 3.3.12->3.3.14/15

2007-04-09 Thread drh
pompomJuice <[EMAIL PROTECTED]> wrote: > I could get a maximum of 300-400 lookups per second using > a conventional "select * from table where column = key" type query. I would guess, then, that either (1) table.column is not indexed or else (2) you are running on very, very slow hardware (a

Re: [sqlite] Possible database corruption?

2007-04-09 Thread drh
<[EMAIL PROTECTED]> wrote: > > I'm _guessing_ this is a file corruption issue (trying to find > out if there was a power outage, etc). I _think_ (still verifying) > that "PRAGMA synchronous = OFF;" was set, so if it is corrupted, > I'll have to accept that it was my fault. > > Is there

Re: [sqlite] sqlite3_create_module()

2007-04-09 Thread Dennis Cote
Mike Johnston wrote: Hi, The docs for "CREATE VIRTUAL TABLE" refer to this function (in subject line) but I can't seem to see find it anywhere. I see the full text search uses modules but some docs would be helpful on how to create my own module. Mike, See

Re: [sqlite] sqlite3BtreeMoveto broke between 3.3.12->3.3.14/15

2007-04-09 Thread pompomJuice
Here is some additional examples of the weirdness I get. Firstly lets show the contents of the table: select * from dv_routing_zones; 8200|1|1152530317|5 8300|4|1152530318|1 8400|5|1152530321|1 8500|11|1152530325|1 If I now set INC key = 1 just before the call to sqlite3BtreeMoveto I get

Re: [sqlite] last N records

2007-04-09 Thread Dennis Cote
Eric S. Johansson wrote: what is the easiest way to hold on to the last N records and delete all older? I can't figure out the right where expression. --- eric Eric, I posted some sample code to use a table as FIFO (last N records) to the list a while ago. See

[sqlite] sqlite3BtreeMoveto broke between 3.3.12->3.3.14/15

2007-04-09 Thread pompomJuice
Hi. I am using sqlite in an unusual way. I’m using it as a lookup table which failed miserably when I realized upon implementation that I could get a maximum of 300-400 lookups per second using a conventional "select * from table where column = key" type query. Clearly there was overhead

Re: [sqlite] sqlite3.exe .import command

2007-04-09 Thread Dennis Cote
[EMAIL PROTECTED] wrote: I could find no documentation on format expectations of the .import command. I would appreciate help on this particular problem and also a URL for any documentation of the sqlite3.exe program. Jaime, It's open source code, the source code is the documentation. ;-)

[sqlite] Possible database corruption?

2007-04-09 Thread pa_ng
I seem to have a database that has been corrupted. I'm trying to figure out what I did wrong and how to keep it from happening again. This is with SQLite 3.3.x. There is a simple table as follows: CREATE TABLE Statistic ( StatID INTEGER PRIMARY KEY, OwnerType INTEGER NON

Re: [sqlite] Some questions on hierarchical data (nested set model)

2007-04-09 Thread Dennis Cote
Jef Driesen wrote: I want to store a tree in an sqlite database. My first choice was the adjacency list model: CREATE TABLE tree ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, parent_id INTEGER ); But this method requires multiple queries to display the entire tree (or a

Re: [sqlite] SQLite and nested transactions

2007-04-09 Thread Dennis Cote
Darren Duncan wrote: I will clarify that child transactions are just an elegant way of partitioning a larger task, and that parent transactions always overrule children; even if a child transaction commits successfully, a rollback of its parent means there are no lasting changes. Darren,

Re: [sqlite] What would you suggest?

2007-04-09 Thread Jay Sprenkle
To make a good choice you must consider many things. How are you going to query the data? Do you need sql to perform searches? Do you need sqlite's ACID features? On 4/8/07, Lloyd <[EMAIL PROTECTED]> wrote: Hi, I want to store and retrieve sorted integer (these integers are file offsets). So

RE: [sqlite] Re: Nested SELECT : Alternative syntax please ?

2007-04-09 Thread Jaime Castells
This works, but its still a nested query. I wonder which syntax provides the best performance, or if there is even a difference. I think Yannick's real-world problem might be a stronger example. Performing an aggregate function on the results of a UNION would require nesting, right? jaime