Re: [sqlite] (no subject)

2011-05-19 Thread Jean-Christophe Deschamps

>Ah, there is a way to write it so that you can have at most one of
>those constraints where only one makes sense, and not require a
>specific order of constraints, but it'd require listing all the
>possible orderings, which would be impractical.
>
>So if one wanted to enforce that there's at most one of such
>constraints then the best pace to do it in in sqlite3AddDefaultValue()
>and friends, rather than in the grammar.  But really, is it worth it?

No, certainly not. SQLite parser is fine like it is, no reason to bloat 
it with much fat just to flag ill constructs, particularily in this cas 
where there's no harm done.

Thanks Nico for looking and for your detailed explanation.

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


[sqlite] Interop DLL question

2011-05-19 Thread Michael Yeaney
For the 1.0.72.0 (3.7.6+) package (x64), is there a stand-alone (mixed
mode) DLL offered anymore that does not require the interop library
(much like the 1.0.66.0 version?  I'm using SQLite successfully in a
few Microsoft Azure deployments, but with the new version, the servers
are not able to locate the "SQLite.Interop.dll" library, as it is not
in any search paths on the cloud machines. The goal here is simple
xcopy deployment (in other words _not_ requiring GAC registration).

Ideas? I'm assuming I'm missing something...but I just can't find it.

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


[sqlite] Unable to load dll "SQLite.Interop.dll"

2011-05-19 Thread Anderson Laécio G . Trindade
Ops...
I was dealing with [Unable to load dll "SQLite.Interop.dll"] error when I was 
running my software on other computers. Finally I figured out that the 
dependency msvcr100.dll was missing on those computers. This can be helpful for 
other users.


Regards,

Anderson Laécio Galindo Trindade



___
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


[sqlite] SQLite.Interop.dll cannot be found

2011-05-19 Thread Anderson Laécio G . Trindade
Hello,

I was dealing with "SQLite.Interop.dll cannot be found" error when I was 
running my software on other computers. Finally I figured out that the 
dependency msvcr100.dll was missing on those computers. This can be helpful for 
other users.


Regards,


Anderson Laécio Galindo Trindade



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


Re: [sqlite] handling SQLITE_LOCKED same as SQLITE_BUSY

2011-05-19 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 05/19/2011 07:13 PM, Sam Carleton wrote:
> I have some code that
> responds to SQLITE_BUSY by sleeping for 50 mills and retrying 4 times:

In that case just use the default busy handler.  Set a maximum timeout and
it will be used.  Behind the scenes it also does sleeps and retries but
starts with far shorter ones and then backs off.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk3V3EMACgkQmOOfHg372QQqLACgxlOMzL8DCoeMu7mW9VZ7ALjz
PDIAn3MIvkaKq+HpjB9oMBRZlZ9JsMhr
=vuBc
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] problems on importing quoted csv files

2011-05-19 Thread Thomas Mittelstaedt
Am Dienstag, den 17.05.2011, 13:53 +0800 schrieb jiajianying:
> Hello,
> 
> I'm using sqlite to process some csv files. It is very disappointing 
> that sqlite's csv mode doesn't support quoted csv format. I tried 
> spatialite which can only strip quote marks but can't parse it correctly.
> 
> Is there any suitable modules or tools for importing quoted csv files?
> 
> Thanks
> 
> Justin
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Have you tried to use a tab ('\t') as the field delimiter? I tried that
when exporting a calendar from gnome evolution to a csv file and
importing it into an OpenOffice spreadsheet.

 
-- 
thomas


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


[sqlite] handling SQLITE_LOCKED same as SQLITE_BUSY

2011-05-19 Thread Sam Carleton
I just did a quick load test on my little web app that is using SQLite
in C code.  Pretty quick it ran into a SQLITE_LOCKED while a
connection/user was logging in to the site.  I have some code that
responds to SQLITE_BUSY by sleeping for 50 mills and retrying 4 times:

int rc = FullLoginProcess(responseDTO);
while(rc == SQLITE_BUSY && retry < 4)
{
Sleep(50 * ++retry);
rc = FullLoginProcess(responseDTO);
}

Is it safe to handle the SQLITE_LOCKED the same way, aka simply make
the while look for either return code?

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


[sqlite] Bug in test/uri.test?

2011-05-19 Thread Nico Williams
foreach {tn uri file} {
  1  test.db  test.db
...
  14 file:test%00.db%00extra  test

  15 test.db?mork=1#boris test.db?mork=1#boris
  16 file://localhostPWD/test.db%3Fhello  test.db?hello
} {

  if {$tcl_platform(platform)=="windows"} {
if {$tn>14} break
set uri  [string map [list PWD /[pwd]] $uri]
  } else {
set uri  [string map [list PWD [pwd]] $uri]
  }

  forcedelete $file
  do_test 1.$tn.1 { file exists $file } 0
  set DB [sqlite3_open $uri]
  do_test 1.$tn.2 { file exists $file } 1
  sqlite3_close $DB
  forcedelete $file
...

Well, this results in the test directory being removed, which causes
make *test to break at utf16align.test.  Row 14 is clearly a problem.
I recommend using a filename other than test there...

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


Re: [sqlite] Question: Performing Arithmetic Operations on Date Fields

2011-05-19 Thread Simon Slavin

On 20 May 2011, at 1:09am, Igor Tandetnik wrote:

> insert into event values ('Christmas', '2011-12-25');

Why not actually store the Julian days ?  After all, the inserting can happen 
slowly but you're going to want the searches and subtraction to be fast.

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


Re: [sqlite] Question: Performing Arithmetic Operations on Date Fields

2011-05-19 Thread Richard Hipp
On Thu, May 19, 2011 at 7:54 PM, Sandy Bottom  wrote:

> My objective is a query which lists events and calculates the number of
> days
> to the event e.g:
>
>
> Name Days to Event
> --
> Christmas 40
>
>
I don't know how to solve your problem in general because different dates
are computed in different ways.  How do you compute the date of Easter for
the Eastern Orthodox Chruch, for example?  When does Yom Kippur fall this
year?  It can be a hard problem.

Christmas is easier.  The Christmas day for the current year is:

 SELECT strftime('%Y-12-25','now');

The easiest way to compute the number of days difference between two dates
is to subtract the julian day numbers:

 SELECT julianday(strftime('%Y-12-25','now')) - julianday(date('now'));

219 is the answer, as I type this.  Note however the the calculation is done
for Greenwich.  If it is already tomorrow in Greenwich while it is still the
previous day locally (which happens to be the case as I type this - it is
now 00:31 in Greenwich and 20:31 local) then you should add:

 SELECT julianday(strftime('%Y-12-25','now','localtime')) -
julianday(date('now','localtime'));

Which comes out to 220.





>
> The event table might look something like:
>
> create table event (
>  name varchar (50),
>  when text (20));
>
>
> (Regarding storing date values in a text field, I will use whatever
> datatype
> best facilitates the calculation.)
>
>
> What would an 'insert' statement for this table look like? E.g.
>
> insert into event values ('Christmas', ... );
>
>
> What would the select statement which calculates the 'Days to Event' column
> look like? E.g.
>
> select name, ... from event;
>
>
> I expect the answer probably involves using 'now' along with converting a
> string of the form MMDD to another form, then possibly converting it
> back.  To-date my attempts have been unsuccessful.
>
> Hoping someone can help.
>
> Tony
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


Re: [sqlite] Question: Performing Arithmetic Operations on Date Fields

2011-05-19 Thread Igor Tandetnik
On 5/19/2011 7:54 PM, Sandy Bottom wrote:
> My objective is a query which lists events and calculates the number of days
> to the event e.g:
>
>
> Name Days to Event
> --
> Christmas 40
>
>
> The event table might look something like:
>
> create table event (
>name varchar (50),
>when text (20));
>
>
> (Regarding storing date values in a text field, I will use whatever datatype
> best facilitates the calculation.)
>
>
> What would an 'insert' statement for this table look like? E.g.
>
> insert into event values ('Christmas', ... );

insert into event values ('Christmas', '2011-12-25');

> What would the select statement which calculates the 'Days to Event' column
> look like? E.g.
>
> select name, ... from event;

select name, julianday(when) - julianday('now', 'start of day') from event;

See http://sqlite.org/lang_datefunc.html
-- 
Igor Tandetnik

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


[sqlite] Question: Performing Arithmetic Operations on Date Fields

2011-05-19 Thread Sandy Bottom
My objective is a query which lists events and calculates the number of days
to the event e.g:


Name Days to Event
--
Christmas 40


The event table might look something like:

create table event (
  name varchar (50),
  when text (20));


(Regarding storing date values in a text field, I will use whatever datatype
best facilitates the calculation.)


What would an 'insert' statement for this table look like? E.g.

insert into event values ('Christmas', ... );


What would the select statement which calculates the 'Days to Event' column
look like? E.g.

select name, ... from event;


I expect the answer probably involves using 'now' along with converting a
string of the form MMDD to another form, then possibly converting it
back.  To-date my attempts have been unsuccessful.

Hoping someone can help.

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


[sqlite] compartmentalizing FTS4 searches

2011-05-19 Thread Mr. Puneet Kishor
My program stores a bunch of text in an FTS4 table and makes it available for 
search. The wrinkle is, there are conceptually different projects for which the 
search has to be compartmentalized.

CREATE TABLE projects (project_id INTEGER PRIMARY KEY, project_name TEXT);
CREATE TABLE documents (document_id INTEGER PRIMARY KEY, document_name TEXT .., 
project_id INTEGER);
CREATE VIRTUAL TABLE fts_docs USING fts4 (document_id, content);

Now, when I search for terms, I would like to target only the content for a 
particular project. Would something like the following work --

SELECT Snippet(fts_docs), f.document_id 
FROM fts_docs f JOIN 
 documents d ON f.document_id = d.document_id JOIN 
 projects p ON p.project_id = d.project_id 
WHERE fts_docs MATCH ? AND p.project_name = 'this old project';

or, is there some other way to restrict the MATCH search to only certain rows 
in the fts table?

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


[sqlite] Invitation to connect on LinkedIn

2011-05-19 Thread Matt Young via LinkedIn
LinkedIn
Matt Young requested to add you as a connection on LinkedIn:
--

Zarko,

I'd like to add you to my professional network on LinkedIn.

- Matt

Accept invitation from Matt Young
http://www.linkedin.com/e/-62mihx-gnwac06i-14/BuxMMT0h2nypvIvNsoWseeA2ULM8vQLhJFCC/blk/I46045398_60/pmpxnSRJrSdvj4R5fnhv9ClRsDgZp6lQs6lzoQ5AomZIpn8_c3pve3APdjgMdzh9bTp9dQpfoStjbPAMcPgPcP0Qej8LrCBxbOYWrSlI/EML_comm_afe/

View invitation from Matt Young
http://www.linkedin.com/e/-62mihx-gnwac06i-14/BuxMMT0h2nypvIvNsoWseeA2ULM8vQLhJFCC/blk/I46045398_60/0MdBYUejcRd30Sd4ALqnpPbOYWrSlI/svi/
--

DID YOU KNOW you can be the first to know when a trusted member of your network 
changes jobs? With Network Updates on your LinkedIn home page, you'll be 
notified as members of your network change their current position. Be the first 
to know and reach out!
http://www.linkedin.com/

 
-- 
(c) 2011, LinkedIn Corporation
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] apple-osx branch

2011-05-19 Thread Richard Hipp
On Thu, May 19, 2011 at 5:49 PM, James Berry  wrote:

> Richard,
>
> Looking at the development timeline, apple-osx branch jumps out recently,
> and raises some questions for me:
>
>  (1) If we're building sqlite for delivery on os-x, should we be using code
> from that branch, rather than the regular distribution?
>

I use the standard SQLite when I build for Mac.  I don't think the case for
sqlite-osx is compelling.  But, obviously, the engineers at Apple see things
differently and they generally do good work, so you should pay attention.


>
>  (2) If yes to 1, then does that also apply to iOS?
>

Unclear.


>
>  (3) Can you characterize what's different about apple-osx branch?
>

The apple-osx branch contains:

(A) Some extra debugging and tracing logic that Apple engineers find useful
but which we the SQLite developers are unwilling to put on trunk.

(B) Modifications to the memory allocator to use Apple's zone allocator.

(C) Some code changes to work around bugs in LLVM.

(D) Various other minor tweaks.

The 100% branch test coverage testing that we do on SQLite is on the trunk.
Apple manages their own testing, so presumably the apple-osx branch is
tested just as carefully.  But you'll have to seek confirmation of that from
them.




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



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


[sqlite] apple-osx branch

2011-05-19 Thread James Berry
Richard,

Looking at the development timeline, apple-osx branch jumps out recently, and 
raises some questions for me:

 (1) If we're building sqlite for delivery on os-x, should we be using code 
from that branch, rather than the regular distribution?

 (2) If yes to 1, then does that also apply to iOS?

 (3) Can you characterize what's different about apple-osx branch?

Thanks,

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


Re: [sqlite] (no subject)

2011-05-19 Thread Nico Williams
On Thu, May 19, 2011 at 4:28 PM, Nico Williams  wrote:
> However, I'm not sure how to write this such that there can be only
> one of those constraints of which there should be just one but without
> then imposing ordering on those constraints.  IMO there's no need to
> fix this.

Ah, there is a way to write it so that you can have at most one of
those constraints where only one makes sense, and not require a
specific order of constraints, but it'd require listing all the
possible orderings, which would be impractical.

So if one wanted to enforce that there's at most one of such
constraints then the best pace to do it in in sqlite3AddDefaultValue()
and friends, rather than in the grammar.  But really, is it worth it?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to test or create sqlite database on iPad.

2011-05-19 Thread irfan khan
thanks a lot Jean-Denis

On Thu, May 19, 2011 at 12:49 PM, Jean-Denis Muys wrote:

>
> On 19 mai 2011, at 11:21, irfan khan wrote:
>
> Hi,
>
> We got a new iPad and have to test sqllite database.
> Could you please guide me to test.
> Basically I want to create database, create tables insert some
> records, and fetch records from iPad itself.
> Is there any way to create database on iPad for preinstalled sqlite.
>
> SQLite is a C library.
>
> On the iPad as on any other machine, you create an SQLite database using
> that library. Here is the routine in my iPad application that creates a
> database:
>
> - (MyClass *) initWithObject:(MyObject*) objectToManage
> {
> if ((self = (MyClass*)[super initWithObject: objectToManage])) {
>
> NSString *dirPath = objectToManage.absoluteDirPath;
> NSString *sourceFilePath = [dirPath stringByAppendingPathComponent:
> objectToManage.fileName];
> NSString *basePath = [sourceFilePath stringByDeletingPathExtension];
> NSString *tilePath = [basePath stringByAppendingPathExtension:@"SQL"];
> NSLog(@"Opening SQLite file %@", tilePath);
>
> sqlite3 *db;
> int rc = sqlite3_open([tilePath cStringUsingEncoding:NSUTF8StringEncoding],
> &db);
> if (rc != SQLITE_OK) {
> NSLog(@"Can't open database: %s", sqlite3_errmsg(db));
> sqlite3_close(db);
> [self release];
> return nil;
> }
> self.db = db;
>
> [self createTablesIfNeeded];
>
>
> sqlite3_stmt *compiledStatement = NULL;
> rc = sqlite3_prepare_v2(db, "select max(thoroughness) from Table;", -1,
> &compiledStatement, NULL);
> rc = sqlite3_step(compiledStatement);
> self.levelsOfThoroughness = sqlite3_column_int(compiledStatement, 0);
>
> NSLog(@"This file has %d levels of thoroughness",
> self.levelsOfThoroughness);
> }
> return self;
> }
>
> In there you can see:
> - how to open a database
> - how to close a database
> - how to execute a SQL statement
> - how to check for error
>
> Which should be a good start.
>
> Jean-Denis Muys
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 



Thanks & Regards

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


Re: [sqlite] (no subject)

2011-05-19 Thread Nico Williams
On Thu, May 19, 2011 at 4:22 PM, Pavel Ivanov  wrote:
>> Is there a rationale for allowing such statements or is that an effect
>> of the 'Lite' nature?  (Note: I'm not complaining, just asking.)
>
> I believe that's an effect of the "typeless" design. As SQLite doesn't
> have strict type names for columns it accepts pretty much anything for
> that. So in your case it thinks that type of first column is "CHAR
> COLLATE NOCASE" and for second "INTEGER DEFAULT 1". What do those type
> names mean is up to you. :)

Not really, it seems to be an effect of the way the column constraint
grammar rules are written:

carg ::= CONSTRAINT nm ccons.
carg ::= ccons.
ccons ::= DEFAULT term(X).{sqlite3AddDefaultValue(pParse,&X);}
ccons ::= DEFAULT LP expr(X) RP.  {sqlite3AddDefaultValue(pParse,&X);}
ccons ::= DEFAULT PLUS term(X).   {sqlite3AddDefaultValue(pParse,&X);}
ccons ::= DEFAULT MINUS(A) term(X).  {
...
}
ccons ::= DEFAULT id(X).  {
...
}
...
ccons ::= NULL onconf.
ccons ::= NOT NULL onconf(R).{sqlite3AddNotNull(pParse, R);}
ccons ::= PRIMARY KEY sortorder(Z) onconf(R) autoinc(I).
 {sqlite3AddPrimaryKey(pParse,0,R,I,Z);}
ccons ::= UNIQUE onconf(R).  {sqlite3CreateIndex(pParse,0,0,0,0,R,0,0,0,0);}
ccons ::= CHECK LP expr(X) RP.   {sqlite3AddCheckConstraint(pParse,X.pExpr);}
ccons ::= REFERENCES nm(T) idxlist_opt(TA) refargs(R).
 {sqlite3CreateForeignKey(pParse,0,&T,TA,R);}
ccons ::= defer_subclause(D).{sqlite3DeferForeignKey(pParse,D);}
ccons ::= COLLATE ids(C).{sqlite3AddCollateType(pParse, &C);}


However, I'm not sure how to write this such that there can be only
one of those constraints of which there should be just one but without
then imposing ordering on those constraints.  IMO there's no need to
fix this.

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


Re: [sqlite] (no subject)

2011-05-19 Thread Pavel Ivanov
> Is there a rationale for allowing such statements or is that an effect
> of the 'Lite' nature?  (Note: I'm not complaining, just asking.)

I believe that's an effect of the "typeless" design. As SQLite doesn't
have strict type names for columns it accepts pretty much anything for
that. So in your case it thinks that type of first column is "CHAR
COLLATE NOCASE" and for second "INTEGER DEFAULT 1". What do those type
names mean is up to you. :)


Pavel


On Thu, May 19, 2011 at 4:40 PM, Jean-Christophe Deschamps
 wrote:
> Anoher (silly) question about what SQLite considers valid input, again
> out of mere curiosity.
>
> A statement like:
>
> CREATE TABLE a (a CHAR COLLATE NOCASE COLLATE BINARY, b INTEGER DEFAULT
> 1 DEFAULT 2);
>
> doesn't cause any error: SQLite applies only the last constraint of
> each type, namely COLLATE BINARY and DEFAULT 2 in this case.
>
> Is there a rationale for allowing such statements or is that an effect
> of the 'Lite' nature?  (Note: I'm not complaining, just asking.)
>
> Is it OK to ignore all but the last constraint of each type when
> parsing that statement, just like SQLite currently does?
>
> ___
> 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


Re: [sqlite] Usefulness of FKs to multiple tables

2011-05-19 Thread Darren Duncan
Jean-Christophe Deschamps wrote:
> Let me ask this by mere curiosity.
> 
> SQLite will accept and process the following:
> 
> CREATE TABLE x (a CHAR PRIMARY KEY);
> CREATE TABLE y (a CHAR PRIMARY KEY);
> CREATE TABLE z (a CHAR REFERENCES x(a) REFERENCES y(a));
> 
> I didn't check if the last FK is even valid normative SQL and that 
> isn't the heart of my question.
> 
> Does anyone see a use for such construct, or even uses such contruct in 
> real world?  That seems weird to me.

There's nothing wrong with what you did from a design standpoint.  You're just 
saying that you can only have a z record when you have both corresponding x and 
y records.  I'm sure there are various business rules that this would 
effectively model. -- Darren Duncan
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] (no subject)

2011-05-19 Thread Jean-Christophe Deschamps
Anoher (silly) question about what SQLite considers valid input, again 
out of mere curiosity.

A statement like:

CREATE TABLE a (a CHAR COLLATE NOCASE COLLATE BINARY, b INTEGER DEFAULT 
1 DEFAULT 2);

doesn't cause any error: SQLite applies only the last constraint of 
each type, namely COLLATE BINARY and DEFAULT 2 in this case.

Is there a rationale for allowing such statements or is that an effect 
of the 'Lite' nature?  (Note: I'm not complaining, just asking.)

Is it OK to ignore all but the last constraint of each type when 
parsing that statement, just like SQLite currently does?

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


[sqlite] Usefulness of FKs to multiple tables

2011-05-19 Thread Jean-Christophe Deschamps
Let me ask this by mere curiosity.

SQLite will accept and process the following:

CREATE TABLE x (a CHAR PRIMARY KEY);
CREATE TABLE y (a CHAR PRIMARY KEY);
CREATE TABLE z (a CHAR REFERENCES x(a) REFERENCES y(a));

I didn't check if the last FK is even valid normative SQL and that 
isn't the heart of my question.

Does anyone see a use for such construct, or even uses such contruct in 
real world?  That seems weird to me.

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


Re: [sqlite] Query efficiency

2011-05-19 Thread Pavel Ivanov
> sqlite> select * from aa where a_id1 in (select distinct a_id1 from ab
> where ab.a_id2 = 1 and ab.b_id = 1) and a_id2 in (select distinct a_id1
> from ab where ab.a_id2 = 1 and ab.b_id = 1) ;

With your schema this can be transformed the same way:

select aa.*
from aa, ab ab1, ab ab2
where aa.a_id1 = ab1.a_id1
and ab1.a_id2 = 1
and ab1.b_id = 1
and aa.a_id2 = ab2.a_id1
and ab2.a_id2 = 1
and ab2.b_id = 1;


Pavel


On Thu, May 19, 2011 at 1:33 PM, Matthew Jones  wrote:
> First of all I couldn't for the life of we work out why that new query
> would work but I'm sure that's just a limit of my knowledge. I then
> realised that the database definition I had used was really very
> different from what I was trying to do so I've had another go and then
> tried to use the query with the new schema. Unfortunately, I have failed
> miserably so here's the schema I'm working with now.
>
> Note that table b isn't used by I've created it to show that table ab is
> a list of references of a records to b records and b records contain an a_id
>
> sqlite> create table a (a_id int primary key);
> sqlite> create table b (a_id int, b_id int, primary key(a_id, b_id));
> sqlite> insert into a values(1);
> sqlite> insert into a values(2);
> sqlite> create table aa (a_id1 int, a_id2 int, primary key(a_id1, a_id2));
> sqlite> insert into aa values (1, 1);
> sqlite> insert into aa values (1, 2);
> sqlite> insert into aa values (2, 1);
> sqlite> insert into aa values (3, 1);
> sqlite> insert into aa values (1, 3);
> sqlite> select * from aa;
> 1|1
> 1|2
> 2|1
> 3|1
> 1|3
> sqlite> create table ab (a_id1 int, a_id2 int, b_id int, primary
> key(a_id1, a_id2, b_id));
> sqlite> insert into ab values(1, 1, 1);
> sqlite> insert into ab values(2, 1, 1);
> sqlite> select * from aa where a_id1 in (select distinct a_id1 from ab
> where ab.a_id2 = 1 and ab.b_id = 1) and a_id2 in (select distinct a_id1
> from ab where ab.a_id2 = 1 and ab.b_id = 1) ;
> 1|1
> 1|2
> 2|1
> sqlite> select aa.* from aa ar, ab ab1, ab ab2;
> Error: no such table: aa
> sqlite> select aa.* from aa as ar, ab ab1, ab ab2;
> Error: no such table: aa
> sqlite>
>
> At this point I got confused but realised I had asked about a very
> different schema and obviously must be doing something wrong as this
> failed before adding any sort of where clause.
>
>
>> From: Pavel Ivanov
>> Subject: Re: [sqlite] Query efficiency
>>
>>> >  That is, is leaving it to the
>>> >  query optimiser to figure out that I only need the sub select once the
>>> >  best thing to do?
>> AFAIK, SQLite's optimizer is not that smart to collapse two identical
>> sub-queries and reuse once generated result.
>>
>>> >  Is the select I'm doing where both a_id1&  2 are "in" the exact same
>>> >  select the most efficient way to do this?
>> I'd say that the following query will work faster in this particular
>> case (with this set of tables and indexes):
>>
>> select ar.*
>> from a_relation ar, ab ab1, ab ab2
>> where ar.a_id1 = ab1.a_id
>> and ab1.b_id = 1
>> and ar.a_id2 = ab2.a_id
>> and ab2.b_id = 1;
>>
>> But this query could be not transformable to your real case. Also
>> performance in real schema could be different.
>>
>>
>> Pavel
>>
>>
>> On Tue, May 17, 2011 at 5:29 AM, Matthew Jones  wrote:
>>> >  O.k. So this is a very cut down example but it illustrates the question:
>>> >
>>> >  sqlite>  create table a (a_id int primary key);
>>> >  sqlite>  create table b (b_id int primary key);
>>> >  sqlite>  create table ab (a_id int, b_id int, primary key(a_id, b_id));
>>> >  sqlite>  create table a_relation (a_id1 int, a_id2, primary key(a_id1,
>>> >  a_id2));
>>> >  sqlite>  select * from a_relation where
>>> >  ? ?...>  a_id1 in (select a_id from ab where b_id = 1) and
>>> >  ? ?...>  a_id2 in (select a_id from ab where b_id = 1);
>>> >
>>> >  Is the select I'm doing where both a_id1&  2 are "in" the exact same
>>> >  select the most efficient way to do this? That is, is leaving it to the
>>> >  query optimiser to figure out that I only need the sub select once the
>>> >  best thing to do?
>>> >
>>> >  (The actual tables in question are a little more complicated and I have
>>> >  versions to cope with but this effectively what I'm doing in C++ [so I'm
>>> >  preparing and binding etc.]. The actual sub select have a group by a_id
>>> >  to cope with multiple entries with different versions.)
>>> >
>>> >  Thanks
>>> >
>>> >  --
>>> >  Matthew Jones
>>> >  Hewlett-Packard Ltd
>>> >
>
> Thanks
>
> --
> Matthew Jones
> Hewlett-Packard Ltd
> ___
> 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


Re: [sqlite] SQL Statement Help(selecting days).

2011-05-19 Thread Jean-Christophe Deschamps

> > Since we use recursive triggers, set recursive_triggers pragma
> > beforehand if not yet done.
>
>Cunning. A bit of a Rube Goldberg apparatus though, no?

Huh? Still way more flexible than having to modify C source of a vtable 
module, should you have to adapt anything.

Yeah, it's kind of convoluted as you seem to say (I had to look up what 
that meant to a Yank ;-)) but it has the great advantage to require no 
line of code, just any SQLite manager to install, change or discard in 
seconds.

Look 'Ma: no compiler!


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


Re: [sqlite] Fossil bugs?

2011-05-19 Thread Richard Hipp
On Thu, May 19, 2011 at 1:40 PM, Nico Williams wrote:

> On Thu, May 19, 2011 at 12:37 PM, Richard Hipp  wrote:
> > On Thu, May 19, 2011 at 1:23 PM, Nico Williams  >wrote:
> > Everything is protected by multiple cryptographic hashes, both SHA1 and
> > MD5.  On-the-wire corruption is not a realistic possibility.
>
> Excellent.
>
> > Is that normal?  The missing whitespace between '{*}' and '$result'
> >> causes make test failures.
> >
> > There is not suppose to be a space between the {*} and the $.  The
> {*}$var
> > is a relatively new construct in TCL that means to expand the variable as
> > one or more space-separated arguments.  It is a safer alternative to the
> old
> > "eval" command.
>
> So I need a new version of Tcl?  I'm using 8.4.  What version do I need?
>

I think 8.5 is sufficient.  But if you are upgrading, you might as well go
with the very latest 8.6 beta.


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



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


Re: [sqlite] Query efficiency

2011-05-19 Thread Jim Morris
You must use the alias if specified:

select ar.* from aa ar, ab ab1, ab ab2;
rather than
select aa.* from aa ar, ab ab1, ab ab2;




On 5/19/2011 10:33 AM, Matthew Jones wrote:
> select aa.* from aa ar, ab ab1, ab ab2;
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Fossil bugs?

2011-05-19 Thread Nico Williams
On Thu, May 19, 2011 at 12:37 PM, Richard Hipp  wrote:
> On Thu, May 19, 2011 at 1:23 PM, Nico Williams wrote:
> Everything is protected by multiple cryptographic hashes, both SHA1 and
> MD5.  On-the-wire corruption is not a realistic possibility.

Excellent.

> Is that normal?  The missing whitespace between '{*}' and '$result'
>> causes make test failures.
>
> There is not suppose to be a space between the {*} and the $.  The {*}$var
> is a relatively new construct in TCL that means to expand the variable as
> one or more space-separated arguments.  It is a safer alternative to the old
> "eval" command.

So I need a new version of Tcl?  I'm using 8.4.  What version do I need?

Thanks,

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


Re: [sqlite] Fossil bugs?

2011-05-19 Thread Richard Hipp
On Thu, May 19, 2011 at 1:23 PM, Nico Williams wrote:

> On Thu, May 19, 2011 at 12:01 PM, Richard Hipp  wrote:
> > Anythings possible.  But we've been using Fossil heavily, daily, for 4
> years
> > now without any hints of these kinds of problems.  So fundamental bugs
> like
> > what you propose seem improbable.  I'm thinking something else is going
> on.
>
> Is TLS used?  If not, is data sent over HTTP integrity protected in
> any way (e.g., with hashes)?  If not, then the tcl script errors are
> probably due to on-the-wire corruption.
>

Everything is protected by multiple cryptographic hashes, both SHA1 and
MD5.  On-the-wire corruption is not a realistic possibility.

Is that normal?  The missing whitespace between '{*}' and '$result'
> causes make test failures.
>

There is not suppose to be a space between the {*} and the $.  The {*}$var
is a relatively new construct in TCL that means to expand the variable as
one or more space-separated arguments.  It is a safer alternative to the old
"eval" command.

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


Re: [sqlite] Query efficiency

2011-05-19 Thread Matthew Jones
First of all I couldn't for the life of we work out why that new query 
would work but I'm sure that's just a limit of my knowledge. I then 
realised that the database definition I had used was really very 
different from what I was trying to do so I've had another go and then 
tried to use the query with the new schema. Unfortunately, I have failed 
miserably so here's the schema I'm working with now.

Note that table b isn't used by I've created it to show that table ab is 
a list of references of a records to b records and b records contain an a_id

sqlite> create table a (a_id int primary key);
sqlite> create table b (a_id int, b_id int, primary key(a_id, b_id));
sqlite> insert into a values(1);
sqlite> insert into a values(2);
sqlite> create table aa (a_id1 int, a_id2 int, primary key(a_id1, a_id2));
sqlite> insert into aa values (1, 1);
sqlite> insert into aa values (1, 2);
sqlite> insert into aa values (2, 1);
sqlite> insert into aa values (3, 1);
sqlite> insert into aa values (1, 3);
sqlite> select * from aa;
1|1
1|2
2|1
3|1
1|3
sqlite> create table ab (a_id1 int, a_id2 int, b_id int, primary 
key(a_id1, a_id2, b_id));
sqlite> insert into ab values(1, 1, 1);
sqlite> insert into ab values(2, 1, 1);
sqlite> select * from aa where a_id1 in (select distinct a_id1 from ab 
where ab.a_id2 = 1 and ab.b_id = 1) and a_id2 in (select distinct a_id1 
from ab where ab.a_id2 = 1 and ab.b_id = 1) ;
1|1
1|2
2|1
sqlite> select aa.* from aa ar, ab ab1, ab ab2;
Error: no such table: aa
sqlite> select aa.* from aa as ar, ab ab1, ab ab2;
Error: no such table: aa
sqlite>

At this point I got confused but realised I had asked about a very 
different schema and obviously must be doing something wrong as this 
failed before adding any sort of where clause.


> From: Pavel Ivanov
> Subject: Re: [sqlite] Query efficiency
>
>> >  That is, is leaving it to the
>> >  query optimiser to figure out that I only need the sub select once the
>> >  best thing to do?
> AFAIK, SQLite's optimizer is not that smart to collapse two identical
> sub-queries and reuse once generated result.
>
>> >  Is the select I'm doing where both a_id1&  2 are "in" the exact same
>> >  select the most efficient way to do this?
> I'd say that the following query will work faster in this particular
> case (with this set of tables and indexes):
>
> select ar.*
> from a_relation ar, ab ab1, ab ab2
> where ar.a_id1 = ab1.a_id
> and ab1.b_id = 1
> and ar.a_id2 = ab2.a_id
> and ab2.b_id = 1;
>
> But this query could be not transformable to your real case. Also
> performance in real schema could be different.
>
>
> Pavel
>
>
> On Tue, May 17, 2011 at 5:29 AM, Matthew Jones  wrote:
>> >  O.k. So this is a very cut down example but it illustrates the question:
>> >
>> >  sqlite>  create table a (a_id int primary key);
>> >  sqlite>  create table b (b_id int primary key);
>> >  sqlite>  create table ab (a_id int, b_id int, primary key(a_id, b_id));
>> >  sqlite>  create table a_relation (a_id1 int, a_id2, primary key(a_id1,
>> >  a_id2));
>> >  sqlite>  select * from a_relation where
>> >  ? ?...>  a_id1 in (select a_id from ab where b_id = 1) and
>> >  ? ?...>  a_id2 in (select a_id from ab where b_id = 1);
>> >
>> >  Is the select I'm doing where both a_id1&  2 are "in" the exact same
>> >  select the most efficient way to do this? That is, is leaving it to the
>> >  query optimiser to figure out that I only need the sub select once the
>> >  best thing to do?
>> >
>> >  (The actual tables in question are a little more complicated and I have
>> >  versions to cope with but this effectively what I'm doing in C++ [so I'm
>> >  preparing and binding etc.]. The actual sub select have a group by a_id
>> >  to cope with multiple entries with different versions.)
>> >
>> >  Thanks
>> >
>> >  --
>> >  Matthew Jones
>> >  Hewlett-Packard Ltd
>> >

Thanks

-- 
Matthew Jones
Hewlett-Packard Ltd
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL Statement Help(selecting days).

2011-05-19 Thread Petite Abeille

On May 19, 2011, at 11:44 AM, Jean-Christophe Deschamps wrote:

> Since we use recursive triggers, set recursive_triggers pragma 
> beforehand if not yet done. 

Cunning. A bit of a Rube Goldberg apparatus though, no?

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


Re: [sqlite] Fossil bugs?

2011-05-19 Thread Nico Williams
On Thu, May 19, 2011 at 12:01 PM, Richard Hipp  wrote:
> Anythings possible.  But we've been using Fossil heavily, daily, for 4 years
> now without any hints of these kinds of problems.  So fundamental bugs like
> what you propose seem improbable.  I'm thinking something else is going on.

Is TLS used?  If not, is data sent over HTTP integrity protected in
any way (e.g., with hashes)?  If not, then the tcl script errors are
probably due to on-the-wire corruption.

However, I just checked the tarball for 3.7.6.2 and it also has those
missing whitespaces in Tcl files, like this:

proc do_select_test {name sql result} {
  uplevel [list doPassiveTest 0 $name $sql [list 0 [list {*}$result]]]
}

which I think rules out corruption on the network (I'd almost
certainly not get the same corruption twice, once in a tarball and
once in Fossil clone).

Is that normal?  The missing whitespace between '{*}' and '$result'
causes make test failures.

> Like maybe your text editor is automatically converting space into tabs?

I hadn't edited any of these files, so, no.

> What platform did you say you were running on?  Our 4-years of experience is
> mostly confined to Linux/Mac/Windows.  Are you doing this on Solaris or
> something?  Maybe you have an NFS-mounted home directory?  Something else
> out of the ordinary?

Ubuntu 10.1, in a local directory.  But inside a Virtual Box VM -- but
I've not noticed corruption problems before.  I'm also using wifi (see
comments above about integrity protection.

I did a new "fossil open" of my clone of sqlite3docs and this time I
got a copy of Makefile checked out.  In my previous workspace I
removed the Makefile, did a fossil commit --latest --force, and now
everything looks good.  I don't know what caused the problem I had
with the Makefile -- let's blame it on user error until it happens
again.

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


Re: [sqlite] Fossil bugs?

2011-05-19 Thread Richard Hipp
On Thu, May 19, 2011 at 11:58 AM, Nico Williams wrote:

> I installed Fossil using aptitude, but I'm thinking I should have
> built and installed it from source.  I'm seeing a few issues with the
> version I'm using ([15cb835736] 2010-06-17 18:39:10 UTC):
>
>  - The Makefile from the SQLite3 docs repository doesn't get checked
> out -- I thought there wasn't any, but "fossil diff" shows changes to
> it, and "fossil undo" and "fossil revert" do not restore the original.
>  This strikes me as almost certainly a bug.
>
>  - In the SQLite3 repository I had to make a bunch of changes like this
> one:
>
> -  uplevel do_test ${prefix}.$tn [list $tclquery] [list [list {*}$res]]
> +  uplevel do_test ${prefix}.$tn [list $tclquery] [list [list {*}
> $res]]
>
>   I worry that the missing whitespace may be a result of a bug in Fossil.
>

Anythings possible.  But we've been using Fossil heavily, daily, for 4 years
now without any hints of these kinds of problems.  So fundamental bugs like
what you propose seem improbable.  I'm thinking something else is going on.
Like maybe your text editor is automatically converting space into tabs?
What platform did you say you were running on?  Our 4-years of experience is
mostly confined to Linux/Mac/Windows.  Are you doing this on Solaris or
something?  Maybe you have an NFS-mounted home directory?  Something else
out of the ordinary?



>
> I will try a newer version of Fossil.
>
> Nico
> --
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


[sqlite] SQLite version 3.7.6.3

2011-05-19 Thread D . Richard Hipp
SQLite version 3.7.6.3 is now available on the SQLite website

http://www.sqlite.org/
http://www.sqlite.org/download.html

Version 3.7.6.3 is a patch release that fixes an obscure but nasty bug in 
WAL-mode.  Upgrading is recommended for all users.  The bug is present in all 
prior releases of SQLite that support WAL.

In prior releases of SQLite, if you set PRAGMA journal_mode=WAL, and if you set 
PRAGMA cache_size=N where N is very small (less than 10) and if you do a 
multi-statement transaction where the last SQLite statement prior to COMMIT is 
a SELECT statement that requires all of your cache memory to complete, then 
your COMMIT might be silently converted into a ROLLBACK.  The database does not 
corrupt, but any changes you made to the database during the transaction will 
be lost.

Since cache_size defaults to 2000, applications that never mess with cache_size 
(which is to say, the vast majority of applications) should never have a 
problem.  But sometimes developers working on low-memory devices try to crank 
down cache_size in an effort to save memory.  If you are one of those 
developers, you should probably think seriously about upgrading.

Additional information:

http://www.sqlite.org/src/info/2d1a5c67df
http://www.sqlite.org/news.html

The patch needed to fix this problem in any 3.7.x release of SQLite can be seen 
here:

http://www.sqlite.org/src/fdiff?v1=b7fe4b8e51d51a06&v2=4b2358556c88660a

Please respond to the sqlite-users mailing list (sqlite-users@sqlite.org) or 
directly to me if you encounter any problems.  Thanks.

D. Richard Hipp
d...@hwaci.com



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


[sqlite] Fossil bugs?

2011-05-19 Thread Nico Williams
I installed Fossil using aptitude, but I'm thinking I should have
built and installed it from source.  I'm seeing a few issues with the
version I'm using ([15cb835736] 2010-06-17 18:39:10 UTC):

 - The Makefile from the SQLite3 docs repository doesn't get checked
out -- I thought there wasn't any, but "fossil diff" shows changes to
it, and "fossil undo" and "fossil revert" do not restore the original.
 This strikes me as almost certainly a bug.

 - In the SQLite3 repository I had to make a bunch of changes like this one:

-      uplevel do_test ${prefix}.$tn [list $tclquery] [list [list {*}$res]]
+      uplevel do_test ${prefix}.$tn [list $tclquery] [list [list {*} $res]]

  I worry that the missing whitespace may be a result of a bug in Fossil.

I will try a newer version of Fossil.

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


Re: [sqlite] About Fossil usage

2011-05-19 Thread Nico Williams
I suppose one could use the "shunned artifacts" feature, then rebuild
the repository as a way to collapse deltas, but that sounds like a lot
of work.  I'll just not collapse deltas.

Also, I like the git format-patch feature - it's basically a diff with
a header slapped on, but still, it's quite useful.

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


Re: [sqlite] About Fossil usage

2011-05-19 Thread Nico Williams
On Thu, May 19, 2011 at 3:08 AM, Stephan Beal  wrote:
> On Thu, May 19, 2011 at 7:03 AM, Nico Williams wrote:
>> How does one remove changesets?  How does one collapse deltas?
>
> Fossil doesn't allow one to remove changesets (and i'm not sure what
> collapsing deltas means, unless it means to compound multiple changes into
> one delta, in which case fossil can't do that). Once its in a fossil db, its
> "fossilized" - there forever. Fossil offers a "shun" feature to "disable"
> unwanted artifacts, but has (by design) no way to remove them.

Back when I worked for Sun Microsystems (then acquired by Oracle) we
used to collapse deltas _prior_ to pushing them from personal
repositories to project or product repositories.  The reason for this
is that one might commit N deltas during development that are of no
interest to anyone else.  Obviously no deltas were deleted or
collapsed in the trunk.  I think that's a very good policy.  We did
that with Teamware, Mercurial, and git (and probably other VCSs, but
those are the three I used most at Sun).

> Regarding the autosync feature Richard mentioned: if you work on more than
> one machine on the same repo then i highly recommend leaving autosync on (at
> least most of the time). If it is turned off and you forget to manually
> push/pull from one of your machines, it can easily lead to an unintentional
> fork (been there, done that many times).

I agree that it seems useful, but since I was cloning the SQLite3 tree
and since I don't have committer access, it seemed odd that Fossil
would attempt to push my commits.

Thanks,

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


Re: [sqlite] System.Data.SQLite INT vs INTEGER

2011-05-19 Thread Joe D
On 2011-05-19 01:16, Xavier Naval wrote:
> You can take a look at http://sqlite.phxsoftware.com/forums/t/31.aspx
> where you can find the DataType mappings for the .NET provider.
>
> Be careful also with
>
> DOUBLE ->  DbType.Double
> FLOAT ->  DbType.Double
> REAL ->  DbType.Single

Ah, so it is by design then.  OK, I can live with that.

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


Re: [sqlite] OSX building in xcode leading to crashing lib.

2011-05-19 Thread Richard Hipp
On Wed, May 18, 2011 at 6:52 PM, Chris Dillman <
chris.dill...@zenimaxonline.com> wrote:

> Im having a lot of trouble getting a working build up and running.
>

You are building from the canonical source code, consisting of about 100
separate source files?  Why?  The SQLite amalgamation would probably better
serve your purpose.  It's just two files:  sqlite3.c and sqlite3.h.  There
is no configure script or makefile. No parameters to set.  Nothing to go
wrong.  You just add sqlite3.[ch] to your application and compile.



>
> I have tried make etc to see if Im missing some flags
>
> Right now we have auto generation code using premake to gen projects on
> Windows, linux, mac.
>
> The resulting libs work fine on win, linux but always have crashing issues
> on OSX
>
> Using the current code base and vales from the make file...
>
> // I ASSUME THESE would be in the config.h if configure made one?
>
> #define PACKAGE_NAME "sqlite"
> #define PACKAGE_TARNAME "sqlite"
> #define PACKAGE_VERSION "3.7.6.2"
> #define PACKAGE_STRING "sqlite 3.7.6.2"
> #define PACKAGE_BUGREPORT "http://www.sqlite.org";
> #define PACKAGE "sqlite"
> #define VERSION "3.7.6.2"
> #define STDC_HEADERS 1
> #define HAVE_SYS_TYPES_H 1
> #define HAVE_SYS_STAT_H 1
> #define HAVE_STDLIB_H 1
> #define HAVE_STRING_H 1
> #define HAVE_MEMORY_H 1
> #define HAVE_STRINGS_H 1
> #define HAVE_INTTYPES_H 1
> #define HAVE_STDINT_H 1
> #define HAVE_UNISTD_H 1
> #define HAVE_DLFCN_H 1
> #define HAVE_FDATASYNC 1
> #define HAVE_USLEEP 1
> #define HAVE_LOCALTIME_R 1
> #define HAVE_GMTIME_R 1
> #define HAVE_DECL_STRERROR_R 1
> #define HAVE_STRERROR_R 1
> #define HAVE_READLINE 1
>
> #define DSQLITE_ENABLE_RTREE
> #define SQLITE_ENABLE_FTS3
> #define SQLITE_THREADSAFE 1
> #define _REENTRANT 1
>
>
>
> // Stack Trace of crash.
>
> #0 0x02577f17 in pthreadMutexAlloc at sqlite3.c:17158
> #1 0x02577dcd in sqlite3MutexAlloc at sqlite3.c:16484
> #2 0x0257ec33 in unixEnterMutex at sqlite3.c:24640
> #3 0x02582bd2 in findReusableFd at sqlite3.c:28907
> #4 0x02582f84 in unixOpen at sqlite3.c:29079
> #5 0x0257751a in sqlite3OsOpen at sqlite3.c:14093
> #6 0x0258cb1e in sqlite3PagerOpen at sqlite3.c:40780
> #7 0x02595004 in sqlite3BtreeOpen at sqlite3.c:48836
> #8 0x025bf2de in attachFunc at sqlite3.c:76066
> #9 0x025aaee0 in sqlite3VdbeExec at sqlite3.c:63618
> #10 0x025a75da in sqlite3Step at sqlite3.c:60644
> #11 0x025a77ca in sqlite3_step at sqlite3.c:60709
> #12 0x025d0835 in sqlite3_exec at sqlite3.c:86281
> #13 0x0256fefe in ZoSqliteDb::RunSql at ZoSqliteDb.cpp:155
>
> Any ideas?
>
> I have has apple specific locking issues when I tried older builds of
> SQLlite also.
> Like other users have reported.
>
> Those could be related to the current issues...
>
>
>
>
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


Re: [sqlite] rtree+ trigger + update cause incorrect result for the select statement

2011-05-19 Thread Simon Slavin

On 18 May 2011, at 1:10pm, Андрей Евгеньевич Осипов wrote:

> The problem appears if I have a select statement and update statement which 
> changes the current record of the select statement.

Don't do that.  You shouldn't make any changes which will change the results of 
the SELECT statement until you're done with the SELECT.  This means that until 
you've read the last row, don't change any of the values used in the selection 
criteria, and don't change any of the values which will be returned.  This is 
not specific to SQLite, it's a general problem with SQL.

If you find yourself doing this, use your programming language to execute the 
entire SELECT statement and store the results in an array, then inspect the 
array and make all your changes.

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


Re: [sqlite] rtree+ trigger + update cause incorrect result for theselect statement

2011-05-19 Thread Igor Tandetnik
Андрей Евгеньевич Осипов  wrote:
> Pseudocode:
> 
> 1.   Query1.CreateAndExecute( "SELECT ... FROM TestTable INNER JOIN 
> TestTableRTree ON ... WHERE (...)") // This query should
> return one and only record 
> 
> 2.   Query2.Create( "UPDATE TestTable SET () WHERE (...) // Trying to 
> update currect record of the Query1, this cause
> execution trigger that changes record in the TestTableRTree 
> 
> 3.   Query2.Execute();
> 
> 4.   Query1.MoveNext(); // This call is finished with code SQLITE_ROW, 
> not SQLITE_DONE. It is error

Modifying a table just as you are iterating over it exhibits undefined 
behavior. Some rows could be visited more than once, others skipped; you could 
observe stale values, or even values from now-deleted rows; WHERE and ORDER BY 
conditions might be violated. That it sometimes appears to work is purely by 
accident.
-- 
Igor Tandetnik

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


Re: [sqlite] Table PARTITION

2011-05-19 Thread Igor Tandetnik
Isaac Eliassi  wrote:
> Does the SQLite support table (row) partition?

With SQLite, the whole database is in one physical file. You can create 
multiple databases, each in its own file, and use ATTACH statement to allow one 
connection to run statements across several databases: 
http://sqlite.org/lang_attach.html . That's probably as close as you can get to 
the notion of a partition.
-- 
Igor Tandetnik

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


[sqlite] OSX building in xcode leading to crashing lib.

2011-05-19 Thread Chris Dillman
Im having a lot of trouble getting a working build up and running.

I have tried make etc to see if Im missing some flags

Right now we have auto generation code using premake to gen projects on
Windows, linux, mac.

The resulting libs work fine on win, linux but always have crashing issues
on OSX

Using the current code base and vales from the make file...

// I ASSUME THESE would be in the config.h if configure made one?

#define PACKAGE_NAME "sqlite"
#define PACKAGE_TARNAME "sqlite"
#define PACKAGE_VERSION "3.7.6.2"
#define PACKAGE_STRING "sqlite 3.7.6.2"
#define PACKAGE_BUGREPORT "http://www.sqlite.org";
#define PACKAGE "sqlite"
#define VERSION "3.7.6.2"
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_DLFCN_H 1
#define HAVE_FDATASYNC 1
#define HAVE_USLEEP 1
#define HAVE_LOCALTIME_R 1
#define HAVE_GMTIME_R 1
#define HAVE_DECL_STRERROR_R 1
#define HAVE_STRERROR_R 1
#define HAVE_READLINE 1

#define DSQLITE_ENABLE_RTREE
#define SQLITE_ENABLE_FTS3
#define SQLITE_THREADSAFE 1
#define _REENTRANT 1



// Stack Trace of crash.

#0 0x02577f17 in pthreadMutexAlloc at sqlite3.c:17158
#1 0x02577dcd in sqlite3MutexAlloc at sqlite3.c:16484
#2 0x0257ec33 in unixEnterMutex at sqlite3.c:24640
#3 0x02582bd2 in findReusableFd at sqlite3.c:28907
#4 0x02582f84 in unixOpen at sqlite3.c:29079
#5 0x0257751a in sqlite3OsOpen at sqlite3.c:14093
#6 0x0258cb1e in sqlite3PagerOpen at sqlite3.c:40780
#7 0x02595004 in sqlite3BtreeOpen at sqlite3.c:48836
#8 0x025bf2de in attachFunc at sqlite3.c:76066
#9 0x025aaee0 in sqlite3VdbeExec at sqlite3.c:63618
#10 0x025a75da in sqlite3Step at sqlite3.c:60644
#11 0x025a77ca in sqlite3_step at sqlite3.c:60709
#12 0x025d0835 in sqlite3_exec at sqlite3.c:86281
#13 0x0256fefe in ZoSqliteDb::RunSql at ZoSqliteDb.cpp:155

Any ideas?

I have has apple specific locking issues when I tried older builds of
SQLlite also.
Like other users have reported.

Those could be related to the current issues...







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


[sqlite] Table PARTITION

2011-05-19 Thread Isaac Eliassi
Hi,

Does the SQLite support table (row) partition?
In case that it does, where can I read about how it is done?

Best regards
Isaac Eliassi
Embedded Software Engineer
Loggers Team
R&D Server Infrastructure Group
System & Recording
NICE Systems. Israel
(T) + 972-9-7753982
(F) + 972-9-7753982
(M) + 972-54-4608201
isaac.elia...@nice.com 
www.nice.com
---
NICE - Insight from Interactions
P Before you print think about the ENVIRONMENT

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


[sqlite] rtree+ trigger + update cause incorrect result for the select statement

2011-05-19 Thread Андрей Евгеньевич Осипов
Hello.

 

It seems to me I've found a bug in the Sqlite.

I have database with two tables. TestTable is ordinary table, TestTableRTree is 
virtual rtree table. Each table has two records. Also database has after update 
trigger for table TestTable, this trigger updates corresponding record in the 
table TestTableRTree.

 

The problem appears if I have a select statement and update statement which 
changes the current record of the select statement. After execution update 
statement sqlite3_step returns SQLITE_ROW instead of  SQLITE_DONE for the 
select statement. RowID of the current row of the select statement does not 
change after this sqlite3_step.

 

Pseudocode:

1.   Query1.CreateAndExecute( "SELECT ... FROM TestTable INNER JOIN 
TestTableRTree ON ... WHERE (...)")   // This query should return one 
and only record

2.   Query2.Create( "UPDATE TestTable SET () WHERE (...) 
//    Trying to update currect record of the Query1, this cause 
execution trigger that changes record in the TestTableRTree

3.   Query2.Execute();

4.   Query1.MoveNext(); // This call is finished with code SQLITE_ROW, not 
SQLITE_DONE. It is error

 

The bug is not reproduced if:

1.   Query1 has no inner join, in other words if Query1 is query to 
TestTable only

or

2.   There is no after update trigger in the table TestTable

or

3.   There is no update execution on stage 3

 

C++ code( SQLITE_ENABLE_RTREE should be defined! ):

 

int Test(bool bPerformUpdate)

{

   const char szFileName[]="c:/test.db3";

   DeleteFile( szFileName );

 

   sqlite3* db=0;

   int nValue=sqlite3_open( szFileName, &db );

   if ( SQLITE_OK != nValue || !db )

   {

 std::cout<<"sqlite3_open returned "< x;

   int nBytes=sqlite3_column_bytes( select_stmt, 2 );

   if ( nBytes<0 )

   {

 std::cout<<"sqlite3_column_bytes returned "

Re: [sqlite] Unknown parameter for prepare_v2

2011-05-19 Thread Simon Slavin

On 19 May 2011, at 9:35am, Dev_lex wrote:

> I need to prepare the statement before to know the name of the table, but
> I'll find an other way..
>> 
>>> 
>>> I would like to do this :
>>> 
>>>   const char   *zSql = "INSERT INTO ?(ID, MyData) VALUES('1',?)";

Instead of using a const, use a C string, or select one of a few different 
consts.

But what your problem is really telling you is that those tables are actually 
all one big table.  The thing you think of as a table name is really just 
another column.

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


Re: [sqlite] How to test or create sqlite database on iPad.

2011-05-19 Thread Jean-Denis Muys

On 19 mai 2011, at 11:21, irfan khan wrote:

Hi,

We got a new iPad and have to test sqllite database.
Could you please guide me to test.
Basically I want to create database, create tables insert some
records, and fetch records from iPad itself.
Is there any way to create database on iPad for preinstalled sqlite.

SQLite is a C library.

On the iPad as on any other machine, you create an SQLite database using that 
library. Here is the routine in my iPad application that creates a database:

- (MyClass *) initWithObject:(MyObject*) objectToManage
{
if ((self = (MyClass*)[super initWithObject: objectToManage])) {

NSString *dirPath = objectToManage.absoluteDirPath;
NSString *sourceFilePath = [dirPath stringByAppendingPathComponent: 
objectToManage.fileName];
NSString *basePath = [sourceFilePath stringByDeletingPathExtension];
NSString *tilePath = [basePath stringByAppendingPathExtension:@"SQL"];
NSLog(@"Opening SQLite file %@", tilePath);

 sqlite3 *db;
int rc = sqlite3_open([tilePath cStringUsingEncoding:NSUTF8StringEncoding], 
&db);
if (rc != SQLITE_OK) {
NSLog(@"Can't open database: %s", sqlite3_errmsg(db));
sqlite3_close(db);
[self release];
return nil;
}
self.db = db;

[self createTablesIfNeeded];


sqlite3_stmt *compiledStatement = NULL;
rc = sqlite3_prepare_v2(db, "select max(thoroughness) from Table;", -1, 
&compiledStatement, NULL);
rc = sqlite3_step(compiledStatement);
self.levelsOfThoroughness = sqlite3_column_int(compiledStatement, 0);

NSLog(@"This file has %d levels of thoroughness", self.levelsOfThoroughness);
}
return self;
}

In there you can see:
- how to open a database
- how to close a database
- how to execute a SQL statement
- how to check for error

Which should be a good start.

Jean-Denis Muys

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


Re: [sqlite] SQL Statement Help(selecting days).

2011-05-19 Thread Jean-Christophe Deschamps

>On Wed, May 18, 2011 at 4:10 PM, Petite Abeille
> wrote:
> > On May 18, 2011, at 10:50 PM, Danilo Cicerone wrote:
> >> How can I simulate a
> >> calendar table(maybe using the strftime funtion)?
> >
> > Well, you have two broad options:
> >
> > (1) materialize the calendar as a table
> > (2) virtualize the calendar as a generator
> >
> > The first option is brutal, but simple. E.g. create a table with, 
> say, all the julian date from 2101 to 21001231 (2451544 to 
> 2488433 JD, about 36,889 records for a century worth of date)
> >
> > The second option is a bit more involved, but you could have a 
> virtual calendar table that generate the relevant date span on demand:
> >
> > http://www.sqlite.org/vtab.html
> >
> > Unfortunately, there is no direct way to generate rows in SQLite as 
> there is, for example, in Oracle or such:
>
>I have a virtual table that allows you to split strings and count
>numbers, which could be used as a row generator.  I really want to
>polish it off and even, some day, add syntactic sugar (calling this
>"table functions"), but lack for time.  Would it help if I posted this
>somewhere?
>
>Nico

A vtable for that may be a bit of a caterpillar unless you look for top 
efficiency or large ranges and, yes, SQLite perfectly allows such range 
of values to be created within SQLite's SQL.

I regularly use such constructs to keep generating (reasonably small) 
sequences or date ranges entirely within SQLite:


CREATE TABLE "Dates" (
   "jDate" INTEGER PRIMARY KEY,
   "sDate" CHAR);

CREATE TABLE "Sequence" (
   "N" INTEGER PRIMARY KEY AUTOINCREMENT);

CREATE TABLE "Counts" (
   "jStartDate" INTEGER,
   "Start" INTEGER DEFAULT (0),
   "Counter" INTEGER DEFAULT (0));

CREATE TRIGGER "trUpdCount"
AFTER UPDATE OF "Counter"
ON "Counts"
WHEN new.counter > 0
BEGIN
  insert or replace into sequence (N) values ((select start + 
counter from counts));
  insert or replace into dates (jdate, sdate) values ((select 
jstartdate + counter from counts), date((select jstartdate + counter 
from counts)));
  update counts set counter = new.counter - 1;
END;

To use, set first a Julian day start date and/or a start integer. Then 
update counter to specify how many dates and/or numbers you want 
created in tables.
Empty data tables between runs (that can be automated with more triggers).

Since we use recursive triggers, set recursive_triggers pragma 
beforehand if not yet done.  This scheme can be adapted to your actual 
needs, merge data tables, use other types, etc.

Don't request large counts as the recursion limit may bite you. As the 
doc says:
The depth of recursion for triggers has a hard upper limit set by the 
SQLITE_MAX_TRIGGER_DEPTH 
compile-time option and a run-time limit set by 
sqlite3_limit(db,SQLITE_LIMIT_TRIGGER_DEPTH,...).
 


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


[sqlite] How to test or create sqlite database on iPad.

2011-05-19 Thread irfan khan
Hi,

We got a new iPad and have to test sqllite database.
Could you please guide me to test.
Basically I want to create database, create tables insert some
records, and fetch records from iPad itself.
Is there any way to create database on iPad for preinstalled sqlite.


Thank & Regards
Irfan khan

-- 



Thanks & Regards

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


Re: [sqlite] SQlite on delete trigger error

2011-05-19 Thread Simon Davies
On 19 May 2011 07:16, Support Lists  wrote:
> Hi,
>
> I have the following sqlite trigger:
> /
> /|/CREATE TRIGGER DLT_actymethods_ibfk_1 BEFORE DELETE ON activity FOR
> EACH ROW BEGIN DELETE FROM actymethods WHERE ACTY_COD = OLD.ACTY_COD; END/
>
> |So before delete the row from the table activity delete all records
> from the table actymethods associated to that activity.
>
> The problem is that I get the error:
>
> /"Only a single result allowed for a SELECT that is part of an expression"/
>
> Any idea why? And how to solve it?

Here's what I tried:

SQLite version 3.6.23.1
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table tmp( id integer primary key, id1 integer, data text );
sqlite> insert into tmp values( 1, 2, '2_1' );
sqlite> insert into tmp values( 2, 5, '5_1' );
sqlite> insert into tmp values( 3, 2, '2_2' );
sqlite> insert into tmp values( 4, 3, '3_1' );
sqlite> insert into tmp values( 5, 2, '2_3' );
sqlite> insert into tmp values( 6, 3, '3_2' );
sqlite> insert into tmp values( 7, 2, '2_4' );
sqlite>
sqlite> create trigger tmp_delete before delete on tmp begin delete
from tmp where id1 = old.id1; end;
sqlite>
sqlite> select * from tmp;
1|2|2_1
2|5|5_1
3|2|2_2
4|3|3_1
5|2|2_3
6|3|3_2
7|2|2_4
sqlite> delete from tmp where id=7;
sqlite>
sqlite> select * from tmp;
2|5|5_1
4|3|3_1
6|3|3_2
sqlite>

No error.

>
> Many thanks.
> Carlos.

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


Re: [sqlite] Unknown parameter for prepare_v2

2011-05-19 Thread Dev_lex

Oh ok..
Thanks a lot, I thought there was some way to do that..

I need to prepare the statement before to know the name of the table, but
I'll find an other way..

Thanks !


Martin Engelschalk wrote:
> 
> Hi,
> 
> you cannot bind the name of a table. Bind variables only work for Values 
> in the database, like you used in the VALUES('1', ?) - clause.
> Names of tables, columns or other items of the schema must be written in 
> the sql statement.
> You will have to build your statement (using sprintf() or similar) 
> before preparig it.
> 
> This is not uniqe to sqlite, but to SQL in general.
> 
> Martin
> 
> Am 19.05.2011 10:04, schrieb Dev_lex:
>> Hello,
>>
>> I've a little question about sqlite3_prepare_v2 :
>>
>> I would like to do this :
>>
>>const char   *zSql = "INSERT INTO ?(ID, MyData) VALUES('1',?)";
>>
>>   if(ppStmt)
>>{
>>sqlite3_bind_parameter_name(ppStmt, "atest");
>>sqlite3_bind_blob(ppStmt, 2,&blob, sizeof(blob),
>> SQLITE_TRANSIENT);
>>sqlite3_step(ppStmt);
>>sqlite3_finalize(ppStmt);
>>}
>>
>> So then I've just to bind values.. It works great for the second '?'
>> which
>> is a blob, so bind_blob(), but for the first one I don't really know what
>> to
>> use ?
>>
>> Maybe the '?' syntax is incorrect? I've not understood everything about
>> it..
>>
>> Regards
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Unknown-parameter-for-prepare_v2-tp31653746p31653969.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] Unknown parameter for prepare_v2

2011-05-19 Thread Martin.Engelschalk
Hi,

you cannot bind the name of a table. Bind variables only work for Values 
in the database, like you used in the VALUES('1', ?) - clause.
Names of tables, columns or other items of the schema must be written in 
the sql statement.
You will have to build your statement (using sprintf() or similar) 
before preparig it.

This is not uniqe to sqlite, but to SQL in general.

Martin

Am 19.05.2011 10:04, schrieb Dev_lex:
> Hello,
>
> I've a little question about sqlite3_prepare_v2 :
>
> I would like to do this :
>
>const char   *zSql = "INSERT INTO ?(ID, MyData) VALUES('1',?)";
>
>   if(ppStmt)
>{
>sqlite3_bind_parameter_name(ppStmt, "atest");
>sqlite3_bind_blob(ppStmt, 2,&blob, sizeof(blob), SQLITE_TRANSIENT);
>sqlite3_step(ppStmt);
>sqlite3_finalize(ppStmt);
>}
>
> So then I've just to bind values.. It works great for the second '?' which
> is a blob, so bind_blob(), but for the first one I don't really know what to
> use ?
>
> Maybe the '?' syntax is incorrect? I've not understood everything about it..
>
> Regards
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] About Fossil usage

2011-05-19 Thread Stephan Beal
On Thu, May 19, 2011 at 7:03 AM, Nico Williams wrote:

> Is a "private" branch then one for which autosync is off, or is there
> some other distinction as well?  How does one change a branch to no
> longer be private?
>

http://www.fossil-scm.org/fossil/doc/tip/www/private.wiki


> How does one remove changesets?  How does one collapse deltas?
>

Fossil doesn't allow one to remove changesets (and i'm not sure what
collapsing deltas means, unless it means to compound multiple changes into
one delta, in which case fossil can't do that). Once its in a fossil db, its
"fossilized" - there forever. Fossil offers a "shun" feature to "disable"
unwanted artifacts, but has (by design) no way to remove them.

Regarding the autosync feature Richard mentioned: if you work on more than
one machine on the same repo then i highly recommend leaving autosync on (at
least most of the time). If it is turned off and you forget to manually
push/pull from one of your machines, it can easily lead to an unintentional
fork (been there, done that many times).

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Unknown parameter for prepare_v2

2011-05-19 Thread Dev_lex

Hello,

I've a little question about sqlite3_prepare_v2 :

I would like to do this : 

  const char   *zSql = "INSERT INTO ?(ID, MyData) VALUES('1',?)";

 if(ppStmt)
  {
  sqlite3_bind_parameter_name(ppStmt, "atest");
  sqlite3_bind_blob(ppStmt, 2, &blob, sizeof(blob), SQLITE_TRANSIENT);
  sqlite3_step(ppStmt);
  sqlite3_finalize(ppStmt);
  }

So then I've just to bind values.. It works great for the second '?' which
is a blob, so bind_blob(), but for the first one I don't really know what to
use ?

Maybe the '?' syntax is incorrect? I've not understood everything about it..

Regards


-- 
View this message in context: 
http://old.nabble.com/Unknown-parameter-for-prepare_v2-tp31653746p31653746.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] DB triggers: Initial patch

2011-05-19 Thread Stephan Beal
On Wed, May 18, 2011 at 11:24 PM, Nico Williams wrote:

>  - setup Fossil clones that folks can pull from (this means getting my
> hosting provider to add support for Fossil, so it won't happen soon
> enough)
>

If your hoster supports CGI, that's all you need to host fossil repos (and
it can be set up in literally under 3 minutes once you've done it a few
times).

http://www.fossil-scm.org/index.html/wiki?name=Cookbook

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users