[sqlite] Atomic database structure initialization

2014-09-19 Thread Paul
My goal is to make structure initialization of an *abstract* database atomic. Why abstract is because I am dealing with C++ wrapper I am gonna use for several differents storages. All these storages  are accessed concurently, and if database file is missing it must be created and initialized.

Re: [sqlite] Atomic database structure initialization

2014-09-19 Thread Clemens Ladisch
Paul wrote: > My goal is to make structure initialization of an *abstract* database atomic. > [...] if database file is missing it must be created and initialized. Just do the check for the database structure and the initialization inside a transaction.

Re: [sqlite] Atomic database structure initialization

2014-09-19 Thread Paul
> Paul wrote: > > My goal is to make structure initialization of an *abstract* database > > atomic. > > [...] if database file is missing it must be created and initialized. > > > > Just do the check for the database structure and the initialization i

Re: [sqlite] Atomic database structure initialization

2014-09-19 Thread Clemens Ladisch
Paul wrote: >> Paul wrote: >>> My goal is to make structure initialization of an *abstract* database >>> atomic. >>> [...] if database file is missing it must be created and initialized. >> >> >> >> Just do the check for the database structure and the ini

Re: [sqlite] Atomic database structure initialization

2014-09-19 Thread Dan Kennedy
On 09/19/2014 02:53 PM, Paul wrote: Paul wrote: My goal is to make structure initialization of an *abstract* database atomic. [...] if database file is missing it must be created and initialized. Just do the check for the database structure and the

Re: [sqlite] Atomic database structure initialization

2014-09-19 Thread Paul
> Paul wrote: > >> Paul wrote: > >>> My goal is to make structure initialization of an *abstract* database > >>> atomic. > >>> [...] if database file is missing it must be created and initialized. > >> > >> > >> > >> Just do the check for the database s

Re: [sqlite] Atomic database structure initialization

2014-09-19 Thread Simon Slavin
On 19 Sep 2014, at 8:34am, Paul wrote: > if database file is missing it must be created and initialized. > For that purpose I need to provide a guarantee that *on_create* callback > will be called strictly once. Can you check to see whether the database file exists using file operations, n

Re: [sqlite] Atomic database structure initialization

2014-09-19 Thread Paul
> > On 19 Sep 2014, at 8:34am, Paul wrote: > > > if database file is missing it must be created and initialized. > > For that purpose I need to provide a guarantee that *on_create* callback > > will be called strictly once. > > Can you check to see whether the database file exists using fi

Re: [sqlite] Atomic database structure initialization

2014-09-19 Thread Clemens Ladisch
Paul wrote: >> Paul wrote: >>> How do you check if structure is initializad in an abstract databse? > > struct SqliteDatabase { > ... > > /// Callback is called once database is created. Strictly one time. > virtual bool on_create(); > ... > }; > > struct FooDatabase : public SqliteDatabase > {

Re: [sqlite] Number of registers/Mem in sqlite Vdbe

2014-09-19 Thread Richard Hipp
On Fri, Sep 19, 2014 at 2:04 AM, Prakash Premkumar wrote: > Can you kindly tell me where in the source code is the number of registers > for Vdbe allocated ? > The Parse.nMem variable keeps track of the number of registers required. After all code is generated, the sqlite3VdbeMakeReady() routin

Re: [sqlite] An order by problem, maybe a bug?

2014-09-19 Thread James K. Lowden
On Fri, 19 Sep 2014 02:02:30 +0100 Simon Slavin wrote: > By the way I wanted to warn you about starting any project with first > name, middle name and last name fields. This leads to problems, and > I would go to some lengths to avoid it if possible. It would be > better to provide two columns:

Re: [sqlite] Atomic database structure initialization

2014-09-19 Thread Keith Medcalf
There is also a PRAGMA user_version (see http://www.sqlite.org/pragma.html#pragma_schema_version) which will let you store a number in the database header so you can keep track of what version of the "user schema" you have implemented in the database. Initially, when the database is created e

Re: [sqlite] An order by problem, maybe a bug?

2014-09-19 Thread Keith Medcalf
Most systems that encompass non-western style names will use different terms: formalname and familyname in preference to firstname and lastname. FirstName, MiddleName, LastName imply ordering which does not necessarily hold. Calling them FormalName, AncestorName, FamilyName more aptly describ

Re: [sqlite] An order by problem, maybe a bug?

2014-09-19 Thread Simon Slavin
On 19 Sep 2014, at 3:58pm, James K. Lowden wrote: > On Fri, 19 Sep 2014 02:02:30 +0100 > Simon Slavin wrote: > >> By the way I wanted to warn you about starting any project with first >> name, middle name and last name fields. This leads to problems, and >> I would go to some lengths to avoid

Re: [sqlite] An order by problem, maybe a bug?

2014-09-19 Thread John McKown
On Fri, Sep 19, 2014 at 11:40 AM, Simon Slavin wrote: > > On 19 Sep 2014, at 3:58pm, James K. Lowden wrote: > >> On Fri, 19 Sep 2014 02:02:30 +0100 >> Simon Slavin wrote: >> >>> By the way I wanted to warn you about starting any project with first >>> name, middle name and last name fields. Thi

Re: [sqlite] An order by problem, maybe a bug?

2014-09-19 Thread Roger Binns
On 19/09/14 07:58, James K. Lowden wrote: > I wonder what "problems" you're talking about. Do you think the IRS, > the Social Security Administration, the DMV, the passport agency, your > birth certificate, and your local bank are just doing it wrong? You do realise there are more people in the

Re: [sqlite] An order by problem, maybe a bug?

2014-09-19 Thread Simon Slavin
On 19 Sep 2014, at 7:42pm, Roger Binns wrote: > On 19/09/14 07:58, James K. Lowden wrote: >> I wonder what "problems" you're talking about. Do you think the IRS, >> the Social Security Administration, the DMV, the passport agency, your >> birth certificate, and your local bank are just doing it

[sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Andrea Peri
Hi, I'm trying to implement a sqlite extension using some string metric algorithms. My goal is to compare two strings and retrieve the metric. I understand that to use the argv[0] and argv[1] args inside an extension function is need to apply to them the sqlite3_value_text(...) function. Unfortu

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Richard Hipp
On Fri, Sep 19, 2014 at 4:22 PM, Andrea Peri wrote: > Hi, > I'm trying to implement a sqlite extension using some string metric > algorithms. > > My goal is to compare two strings and retrieve the metric. > > I understand that to use the argv[0] and argv[1] args inside an > extension function is

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Andrea Peri
Hi, thx for clarification. I do no change UTF8-UTF16 (I hope). I was guessing the sqlite3_value_text was changing because I does this simple test: try-ing passing "aaa" to the function and try-ing a printf("%s",argv[0]); inside the function I have on stdout something like: "P^. " Instead If

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Igor Tandetnik
On 9/19/2014 4:36 PM, Andrea Peri wrote: printf("%s",argv[0]); argv[0] is sqlite_value*, not a char*. It's not a pointer to a NUL-terminated string, which is what %s format specifier expects. Instead If I use this other printf("%s",sqlite3_value_text(argv[0])); I have correctly "aaa" So

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Scott Robison
On Fri, Sep 19, 2014 at 3:08 PM, Igor Tandetnik wrote: > On 9/19/2014 4:36 PM, Andrea Peri wrote: > >> >> I don't understand why this difference >> > > I don't understand why you expected there to *not* be a difference between > a program that performs a nonsensical action, and a program that us

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Keith Medcalf
>While you are correct that the action is "nonsensical" based on the >definition of the API, surely you can concede that in an environment (C >programming) where "argv" is an intrinsic part of every program thanks to >that name's standard use as a parameter to main But that is because you (meanin

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Igor Tandetnik
On 9/19/2014 7:56 PM, Keith Medcalf wrote: the actual type of the argument strings passed to the main function of a C program is char*[], not char** It's valid either way. C99 6.7.5.3/7 A declaration of a parameter as "array of type" shall be adjusted to "qualified pointer to type"... And

[sqlite] sqlite3 hangs

2014-09-19 Thread Bokassa
Hi all, I see my query hanging with this stack: dybagme->where #0 0x00332b00ee00 in __fsync_nocancel () from /lib64/libpthread.so.0 #1 0x0041b418 in full_fsync (fd=6, fullSync=0, dataOnly=0) at sqlite3.c:27735 #2 0x0041b54c in unixSync (id=0x2315650, flags=2) at sqlite

Re: [sqlite] sqlite3 hangs

2014-09-19 Thread Roger Binns
On 19/09/14 17:40, Bokassa wrote: > Hi all, > I see my query hanging with this stack: > > dybagme->where > #0 0x00332b00ee00 in __fsync_nocancel () from /lib64/libpthread.so.0 > #1 0x0041b418 in full_fsync (fd=6, fullSync=0, dataOnly=0) at > sqlite3.c:27735 ... > The program it

[sqlite] 50% faster than 3.7.17

2014-09-19 Thread Richard Hipp
The latest SQLite 3.8.7 alpha version (available on the download page http://www.sqlite.org/download.html) is 50% faster than the 3.7.17 release from 16 months ago. That is to say, it does 50% more work using the same number of CPU cycles. This performance gain is over and above the query planner

Re: [sqlite] 50% faster than 3.7.17

2014-09-19 Thread jose isaias cabrera
"Richard Hipp" wrote... The latest SQLite 3.8.7 alpha version (available on the download page http://www.sqlite.org/download.html) is 50% faster than the 3.7.17 release from 16 months ago. That is to say, it does 50% more work using the same number of CPU cycles. This performance gain is over

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Scott Robison
On Fri, Sep 19, 2014 at 5:56 PM, Keith Medcalf wrote: > > >While you are correct that the action is "nonsensical" based on the > >definition of the API, surely you can concede that in an environment (C > >programming) where "argv" is an intrinsic part of every program thanks to > >that name's sta

Re: [sqlite] 50% faster than 3.7.17

2014-09-19 Thread Stephen Chrzanowski
I, as well, wish to thank you for this tool Dr. Hipp. I've never published a public application using this engine, but, at my place of employment, where my primary responsibility is to just monitor servers world wide, I've coded a few tidbit web and desktop applications that have made my job SO mu

[sqlite] Rrepresentation of REAL type

2014-09-19 Thread TimeOfDay.nl
I am looking at my SQLite database in two ways: 1. from PHP, in my application, thru 'select * from table' statements and the such 2. from Adminer, as a database management tool When I look at a field that is type Real, and has the value of -41.29 as the entered value, the results differ. - The

[sqlite] Missing SQLite.Designer.SQLiteDataViewSupport?

2014-09-19 Thread Hans Lehmann
I am one of several developers here that use SQLite in a development environment for mixed-platform applications. Using Visual Studio 2010 and 2012, on Windows 7-x64. We all have the following packages installed: sqlite-netFx40-setup-bundle-x86-2010-1.0.84.0, sqlite-netFx40-setup-bundle-x64-2010

Re: [sqlite] Performance regression between 3.7.17 and 3.8.0.2?

2014-09-19 Thread Merike
19.09.2014 05:24, Richard Hipp kirjutas: > Thanks again for the regression report. This problem is now fixed on > the SQLite trunk. See > http://www.sqlite.org/src/info/72727b68cd0796?dc=22 for the check-in > that fixes the problem. > > If all you want to know is that the problem has been fixed,

[sqlite] Inefficient query plan with ORDER BY and UNION ALL subquery

2014-09-19 Thread Yuanzhong Xu
Hi, In SQLite 3.8.6, suppose I have two tables in the same format: CREATE TABLE t1 (id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT); CREATE TABLE t2 (id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT); The query plan can be quite efficient for: EXPLAIN QUERY PLAN SELECT id,data FROM (SELECT * F

Re: [sqlite] Rrepresentation of REAL type

2014-09-19 Thread Richard Hipp
On Fri, Sep 19, 2014 at 11:46 AM, TimeOfDay.nl wrote: > I am looking at my SQLite database in two ways: > > 1. from PHP, in my application, thru 'select * from table' statements and > the such > 2. from Adminer, as a database management tool > > When I look at a field that is type Real, and has

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Keith Medcalf
>> There is no magic associated with a symbol name in C -- it is simply >> what you chose to call it. Just because you chose to call something >>"argc" does not mean that it is a count of anything (much less a count >>of arguments), nor even that it is a default width integer; nor does >>calli

Re: [sqlite] How preserve the string metric in an extension.

2014-09-19 Thread Scott Robison
On Fri, Sep 19, 2014 at 8:53 PM, Keith Medcalf wrote: > >Please carefully re-read my comment: 'defined as "char**" or equivalent'. > >"char** argv" is the same as "char* argv[]" in every way except for > >spelling. > > but char** is not equivalent to sqlite_value** and a scalar function > definit

Re: [sqlite] Inefficient query plan with ORDER BY and UNION ALL subquery

2014-09-19 Thread Yuanzhong Xu
I think this is related to a check for restriction (18) in subquery flattening. (18) If the sub-query is a compound select, then all terms of the ORDER by clause of the parent must be simple references to columns of the sub-query. Thanks, Yuanzhong On Fri, Sep 19, 2014 at 8:16 PM, Yuanzhong Xu

Re: [sqlite] Missing SQLite.Designer.SQLiteDataViewSupport?

2014-09-19 Thread Joe Mistachkin
Hans Lehmann wrote: > > "Could not find any resources appropriate for the specified culture or the > neutral culture. Make sure "SQLite.Designer.SQLiteDataViewSupport2012.xml" > was correctly embedded or linked into assembly "SQLite.Designer" at compile > time, or that all the satellite assemblie