Re: [sqlite] Is it possible to optimize the read performanceof a C++ app using sqlite pragma journal_mode = wal & pragma

2011-05-26 Thread Frank Chang

Roger Binns, Thank you for your reply. I understand what you are saying 
that we should drop the 
sqlite3_wal_checkpoint_v2(Database,"main",SQLITE_CHECKPOINT_FULL,
// ,);
after the commit transaction 
ReturnValue=sqlite3_prepare(Database,"COMMIT",-1,,0);

status = sqlite3_step(Statement);
sqlite3_finalize(Statement);
We will try testing our deduper prototype using a sqlite WAL database 
without the wal checkpoint after commit. Would you expect us to get faster 
sqlite WAL reads  without the wal checkpoint after commit? Is it possible there 
is another method for obtaining get faster sqlite WAL reads ?  Thank you for 
your help.  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread BareFeetWare
On 27/05/2011, at 10:42 AM, Simon Slavin wrote:

> Tom, John ran across two common problems with SQLite and Xcode:
> 
> A) Xcode seems to want to interpret .c and .h files as C++ instead of C.
> B) Confusion common to people who normally program for Windows or non-Open 
> systems about what combination of files they need: a library, a framework, C 
> source, a .h file.
> 
> An explanation of these points somewhere would be great.

I bypassed that whole issue by just using the SQLite framework built into Mac 
OSX and iOS, and by using an SQLite wrapper for Objective C. Then you don't 
have to worry about compiling SQLite source files into your project or even 
have to bother with the low level sqlite3_ C calls. The only code you then have 
to write is effectively an nice Objective-C executeQuery: method call, which 
returns and array of dictionaries. It's all very straight forward that way.

The slideshow makes it pretty easy to follow:
http://www.barefeetware.com/sqlite/iosxcode/?ml

Thanks,
Tom
BareFeetWare

 --
Comparison of SQLite GUI tools:
http://www.barefeetware.com/sqlite/compare/?ml

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


Re: [sqlite] Is it possible to optimize the read performanceof a C++ app using sqlite pragma journal_mode = wal & pragmawal_checkpoint?

2011-05-26 Thread Jean-Christophe Deschamps

>  Simon Slavin, Thank you for your suggestion. Our deduper prototoype 
> uses fuzzy matching methods such as the Levenshtein Distance to 
> detect duplicates. We have found that these fuzzy matching methods 
> are best implemented in C++ for processing time requirements.
>   We would still like to know your experience with SQLite 
> WAL databases compared to SQlite non-WAL databases. Particularly, we 
> are in the sqlite read processing in SQLIte WAL databases. Is 
> possible to SQLiTe WAL databases to have faster read processing than 
> SQLite non-WAL databases. If so, what method to use to gain the read 
> improvement? Thank you.

It is possible that you would see the biggest improvement by 
implementing your matching method in a plain C SQLite extension.  Doing 
would keep moving/converting data back and forth to a minimum as the 
workload would be made as close to the engine as possible.

I mail you a download link to an extension offering a Unicode-aware 
fuzzy compare function (Levhenshtein-Damerau exactly).  Have a look at 
it, play with it to see how it can fit part of your bill and adapt the 
code as you whish.

Like Simon, I think you should get rid of journaling in your case.


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


Re: [sqlite] Is it possible to optimize the read performanceof a C++ app using sqlite pragma journal_mode = wal & pragmawal_checkpoint?

2011-05-26 Thread Simon Slavin

On 27 May 2011, at 2:05am, Frank Chang wrote:

> Simon Slavin, Thank you for your suggestion. Our deduper prototoype uses 
> fuzzy matching methods such as the Levenshtein Distance to detect duplicates. 
> We have found that these fuzzy matching methods are best implemented in C++ 
> for processing time requirements.

Okay, you are correct.  A distance metric means you can't use the dodge I 
described.  Sorry.

>  We would still like to know your experience with SQLite WAL 
> databases compared to SQlite non-WAL databases. Particularly, we are in the 
> sqlite read processing in SQLIte WAL databases. Is possible to SQLiTe WAL 
> databases to have faster read processing than SQLite non-WAL databases. If 
> so, what method to use to gain the read improvement

I hope that other people will answer this.  However since speed is important to 
you, if you have only one thread of one process using SQLite you can save time 
using PRAGMAs which turn off the multi-process multi-user stuff.  In fact you 
might be able to turn journalling off entirely.

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


Re: [sqlite] Is it possible to optimize the read performanceof a C++ app using sqlite pragma journal_mode = wal & pragmawal_checkpoint?

2011-05-26 Thread Frank Chang

 Simon Slavin, Thank you for your suggestion. Our deduper prototoype uses fuzzy 
matching methods such as the Levenshtein Distance to detect duplicates. We have 
found that these fuzzy matching methods are best implemented in C++ for 
processing time requirements.
  We would still like to know your experience with SQLite WAL 
databases compared to SQlite non-WAL databases. Particularly, we are in the 
sqlite read processing in SQLIte WAL databases. Is possible to SQLiTe WAL 
databases to have faster read processing than SQLite non-WAL databases. If so, 
what method to use to gain the read improvement? Thank you. 
   
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread Simon Slavin

On 27 May 2011, at 1:35am, BareFeetWare wrote:

> Here's a simple answer:

Tom, John ran across two common problems with SQLite and Xcode:

A) Xcode seems to want to interpret .c and .h files as C++ instead of C.
B) Confusion common to people who normally program for Windows or non-Open 
systems about what combination of files they need: a library, a framework, C 
source, a .h file.

An explanation of these points somewhere would be great.

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


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread BareFeetWare
On 27/05/2011, at 12:49 AM, john darnell wrote:

> I am still trying to get SQLite to work on my Mac.  I want to make sure I am 
> doing what I should be doing.

Here's a simple answer:

1. Add the sqlite library to your target's build phase.

2. Add an Objective C wrapper class to your project, such as the one by "Matteo 
Bertozzi":
http://th30z.blogspot.com/2008/11/objective-c-sqlite-wrapper_8445.html

  2.1 Download the Sqlite.h and SQLite.m files

  2.2 Add them to your project.

3. To call SQLite from your code, simply import the Sqlite wrapper class and 
use either the executeNonQuery or executeQuery method. The executeQuery method 
returns an array of dictionaries:

#import "Sqlite.h"

Sqlite* sqlite = [[Sqlite alloc] initWithFile:@"path to file"];

NSArray* resultDictArray = [sqlite executeQuery:@"select Name, Quantity from 
Ingredients order by Name"];

[sqlite executeNonQuery:@"delete from Ingredients where Name = 'squash'"];

[sqlite close];

It's best to create the sqlite object as an ivar within your class, and release 
it in your class's dealloc.

I presented this recently at a CocoaHeads meeting. You can view the slideshow 
here:
http://www.barefeetware.com/sqlite/iosxcode/?ml

Tom
BareFeetWare

 --
Comparison of SQLite GUI tools:
http://www.barefeetware.com/sqlite/compare/?ml



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


Re: [sqlite] [BUG] Silent change in intergeral overflow handling in 3.7.6

2011-05-26 Thread Richard Hipp
On Wed, May 25, 2011 at 4:40 AM, Jan Hudec  wrote:

>  I need condition
>
>object_id = side_id & ~(1 << 63)
>
> but that's not valid syntax.
>

Yeah it is.  Try, for example:

SELECT 1234 & ~(1<<63);
SELECT (-1234) & ~(1<<63);


-- 
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] using a view for fts

2011-05-26 Thread Nico Williams
Use AS to ensure that views'columns get useful column names.

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


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread Simon Slavin

On 26 May 2011, at 9:56pm, john darnell wrote:

> One final message on this topic.  In my last message I mentioned four 
> warnings remaining when I compile the file.  I decided to at least look at 
> them in situ and see what they were.  It turned out that it took very little 
> to fix them AFAIK.  Here is what I did:

Having done that, clean the project (which should throw away all precompiles 
and symbols) and compile again from scratch.  That might fix the warnings.  Or 
it might not.

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


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread john darnell
One final message on this topic.  In my last message I mentioned four warnings 
remaining when I compile the file.  I decided to at least look at them in situ 
and see what they were.  It turned out that it took very little to fix them 
AFAIK.  Here is what I did:

> 
> Warning:   declaration of fsInfo shadows a previous local
> Warning:  shadowed declaration is here
> 

To resolve the above two warnings I changed this code:

(Around line 29173):
struct statfs fsinfo;
if(statfs(zPath, ) == -1){

to 
struct statfs fsinfo1;
if(statfs(zPath, ) == -1){
**(note the change in fsInfo)**
AND

(found around line 29190)
useProxy = !(fsInfo.f_flags_LOCAL);

to this:
useProxy = !(fsInfo1.f_flags_LOCAL);
**(note the change in fsInfo)**


> Warning:   declaration of wait shadows a global decclaration
> Warning:  shadowed declaration is here


To resolve these two warnings I changed this code (found around 29859):

/* Not always defined in the headers as it ought to be */
Extern int gethostuuid(uuid_t id, const struct timespec wait);


To this:

/* Not always defined in the headers as it ought to be */
Extern int gethostuuid(uuid_t id, const struct timespec twait);
**(note the change in wait)**

I would appreciate it if those of you who know the code would double-check my 
hubris and let me know if I have done something monstrously (or maybe even just 
a little) stupid.  It wouldn't be the first time...

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


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread john darnell
Thank you Mr. Slavin.  I checked as you suggest and there were no other options 
listed in the dropdown.  However, with the help of my good friend and colleague 
Mark Woodring I think we found what we needed to change.  

First, under the Project info dialog, under the Build tab, under Language, 
there is a line item called "Compile Source As."  There are five options:  C, 
C++, Objective-C, Objective_C++, and "According to file type."  The project as 
created was compiling all files as C++ files.  I changed the option to 
"According to File Type."

That got rid of 200 of the 1200+ errors.  In that same segment was an item 
called "Increase Sharing of Precompiled Headers." I unchecked it as well, and 
that seemed to get rid of all but four warnings.  Those warnings are as follows:

Warning:   declaration of fsInfo shadows a previous local
Warning:  shadowed declaration is here

Warning:   declaration of wait shadows a global decclaration
Warning:  shadowed declaration is here

I am undecided as to whether I want to do anything about these warnings.  They 
report that a variable has already been created someplace in that scope with 
the same name, and now inside a block inside that scope the programmer is 
creating a new variable with the same name.  On Windows, Visual Studio doesn't 
care.  In Xcode 3.1.3, it lets the programmer know that he is doing it.  It's 
up to her to decide to fix it.

Thanks to all of you who helped resolve this difficult problem.

R,
John

> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org]
> On Behalf Of Simon Slavin
> Sent: Thursday, May 26, 2011 2:13 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] SQLite in Xcode
> 
> 
> On 26 May 2011, at 8:12pm, john darnell wrote:
> 
> > Thank you Mr. Ivanov.  I can buy what you are saying 100%.  What I need to
> know is how to tell Xcode to compile that file as a C file if the standard 
> procedure
> is not working.
> > I recoup: the files are being classified as sourcecode.c.c and 
> > sourcecode.c.h.
> What else do I need to do?
> 
> Take a look at the other options in the popup.  Are their options for 'C 
> Source' and
> 'C Header' ?
> 
> Simon.
> ___
> 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] using a view for fts

2011-05-26 Thread Mr. Puneet Kishor
Consider 

CREATE VIRTUAL TABLE fts_text USING fts4 (id, content);

.. populate the above table, then ..

SELECT rowid, Snippet(fts_text) FROM fts_text WHERE fts_text MATCH ?;

If I try to do something like

CREATE VIEW v_find AS 
  SELECT rowid, Snippet(fts_text) content FROM fts_text;

SELECT rowid, content FROM v_find WHERE fts_text MATCH ?;

I understandably get an error "no such column fts_text".

The above is a contrived example, but can I build a view out of a complicated 
fts query so I can then pass parameters to the view later on?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread Simon Slavin

On 26 May 2011, at 8:12pm, john darnell wrote:

> Thank you Mr. Ivanov.  I can buy what you are saying 100%.  What I need to 
> know is how to tell Xcode to compile that file as a C file if the standard 
> procedure is not working.
> I recoup: the files are being classified as sourcecode.c.c and 
> sourcecode.c.h.  What else do I need to do?

Take a look at the other options in the popup.  Are their options for 'C 
Source' and 'C Header' ?

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


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread john darnell
Thank you Mr. Ivanov.  I can buy what you are saying 100%.  What I need to know 
is how to tell Xcode to compile that file as a C file if the standard procedure 
is not working.
I recoup: the files are being classified as sourcecode.c.c and sourcecode.c.h.  
What else do I need to do?


R,
John

> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org]
> On Behalf Of Pavel Ivanov
> Sent: Thursday, May 26, 2011 1:56 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] SQLite in Xcode
> 
> > Here are two errors out of the 1200+ errors generated (I tried to include as
> much information as possible to help identify the problem.  Please forgive if 
> I am
> overdoing it...):
> >
> >        Compiling /.../sqlite3.c
> >        Error:invalid conversion from "void *" to "char *"
> >        This error was marked at line 13726.
> 
> IIRC, this error is the most famous difference between C and C++. And
> if this error appears then you are compiling it as C++, not as C.
> 
> 
> Pavel
> 
> 
> On Thu, May 26, 2011 at 12:35 PM, john darnell
>  wrote:
> > Mr. Slavin, here's the information you requested:
> >
> > Please note that I am working in Xcode 3.1.3.  That may or may not be 
> > part/all of
> the problem.
> >
> >> -Original Message-
> >> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org]
> >> On Behalf Of Simon Slavin
> >> Sent: Thursday, May 26, 2011 10:01 AM
> >> To: General Discussion of SQLite Database
> >> Subject: Re: [sqlite] SQLite in Xcode
> >>
> >> > 1.)      I downloaded and uncompressed sqlite-autoconf-3070602.tar.gz 
> >> > from
> the
> >> SQLite download page.
> >>
> >> The top one, with just .c and .h is adequate.  You shouldn't end up using 
> >> any of
> >> the scripts or makefiles for building.
> >
> > I can confirm that I only moved/added sqlite3.c and sqlite3.h into the 
> > source
> folder and into the project.
> >
> >>
> >> > 2.)     I moved SQLite3.c and SQLite3.h into my source folder and added
> them to
> >> the project.
> >>
> >> > I made no changes to the code nor did I do anything special when I added
> them
> >> to my project (i.e. I did not set any special compile flags-I simply added 
> >> the two
> >> files to the project).
> >>
> >> Make sure sqlite3.c is 'ticked' next to 'Target Membership' for your 
> >> product file.
> >
> > I am not someone who uses Xcode frequently--I usually develop on Windows
> and port t the Mac, but if by "Target Membership" you mean the last column in 
> the
> pane that lists all files when the project name is selected in the Groups & 
> Files
> pane, headed by an icon that looks like a target, the sqlite3.c file is 
> 'ticked.'
> >
> >>
> >> Also make sure sqlite3.c is listed as 'C source' and sqlite3.h is listed 
> >> as 'C
> header'
> >> under 'Identity and Type'.
> >
> > I clicked the sqlite3.c filename in the Groups & Files panel, clicked the
> information icon (the blue button with the white 'i' at the top of the 
> window).  Under
> the General tab, under the File Type dropdown, the file is listed as
> 'sourcecode.c.c', and the sqlite3.h file is listed as 'sourcecode.c.h.'  If 
> you have in
> mind some other location, please let me know.
> >
> >>
> >> > 3.)     I compiled and received 1200+ errors.
> >>
> >> Try the above, and if those don't go away, post the first one or two (note 
> >> all
> >> 1200+) here.
> >>
> >
> > Here are two errors out of the 1200+ errors generated (I tried to include as
> much information as possible to help identify the problem.  Please forgive if 
> I am
> overdoing it...):
> >
> >        Compiling /.../sqlite3.c
> >        Error:invalid conversion from "void *" to "char *"
> >        This error was marked at line 13726.
> >
> >        Error:forward declaration of 'struct SrcList_item'
> >        This error was marked at line 11047.
> >
> > There were six warnings as well, most of which were warnings about division 
> > by
> zero.
> >
> > R,
> > John
> >
> >> Simon.
> >> ___
> >> 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-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] SQLite in Xcode

2011-05-26 Thread Pavel Ivanov
> Here are two errors out of the 1200+ errors generated (I tried to include as 
> much information as possible to help identify the problem.  Please forgive if 
> I am overdoing it...):
>
>        Compiling /.../sqlite3.c
>        Error:invalid conversion from "void *" to "char *"
>        This error was marked at line 13726.

IIRC, this error is the most famous difference between C and C++. And
if this error appears then you are compiling it as C++, not as C.


Pavel


On Thu, May 26, 2011 at 12:35 PM, john darnell
 wrote:
> Mr. Slavin, here's the information you requested:
>
> Please note that I am working in Xcode 3.1.3.  That may or may not be 
> part/all of the problem.
>
>> -Original Message-
>> From: sqlite-users-boun...@sqlite.org 
>> [mailto:sqlite-users-boun...@sqlite.org]
>> On Behalf Of Simon Slavin
>> Sent: Thursday, May 26, 2011 10:01 AM
>> To: General Discussion of SQLite Database
>> Subject: Re: [sqlite] SQLite in Xcode
>>
>> > 1.)      I downloaded and uncompressed sqlite-autoconf-3070602.tar.gz from 
>> > the
>> SQLite download page.
>>
>> The top one, with just .c and .h is adequate.  You shouldn't end up using 
>> any of
>> the scripts or makefiles for building.
>
> I can confirm that I only moved/added sqlite3.c and sqlite3.h into the source 
> folder and into the project.
>
>>
>> > 2.)     I moved SQLite3.c and SQLite3.h into my source folder and added 
>> > them to
>> the project.
>>
>> > I made no changes to the code nor did I do anything special when I added 
>> > them
>> to my project (i.e. I did not set any special compile flags-I simply added 
>> the two
>> files to the project).
>>
>> Make sure sqlite3.c is 'ticked' next to 'Target Membership' for your product 
>> file.
>
> I am not someone who uses Xcode frequently--I usually develop on Windows and 
> port t the Mac, but if by "Target Membership" you mean the last column in the 
> pane that lists all files when the project name is selected in the Groups & 
> Files pane, headed by an icon that looks like a target, the sqlite3.c file is 
> 'ticked.'
>
>>
>> Also make sure sqlite3.c is listed as 'C source' and sqlite3.h is listed as 
>> 'C header'
>> under 'Identity and Type'.
>
> I clicked the sqlite3.c filename in the Groups & Files panel, clicked the 
> information icon (the blue button with the white 'i' at the top of the 
> window).  Under the General tab, under the File Type dropdown, the file is 
> listed as 'sourcecode.c.c', and the sqlite3.h file is listed as 
> 'sourcecode.c.h.'  If you have in mind some other location, please let me 
> know.
>
>>
>> > 3.)     I compiled and received 1200+ errors.
>>
>> Try the above, and if those don't go away, post the first one or two (note 
>> all
>> 1200+) here.
>>
>
> Here are two errors out of the 1200+ errors generated (I tried to include as 
> much information as possible to help identify the problem.  Please forgive if 
> I am overdoing it...):
>
>        Compiling /.../sqlite3.c
>        Error:invalid conversion from "void *" to "char *"
>        This error was marked at line 13726.
>
>        Error:forward declaration of 'struct SrcList_item'
>        This error was marked at line 11047.
>
> There were six warnings as well, most of which were warnings about division 
> by zero.
>
> R,
> John
>
>> Simon.
>> ___
>> 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-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread john darnell


> 
> I'm not sure what .dylib you're using.  The standard installation of OS X 
> with the
> Developer tools has sqlite header files in
> 
> /usr/include/sqlite3.h
> 
> and
> 
> /Developer/SDKs/MacOSX10.6.sdk/usr/include/sqlite3.h
> 
> which may or may not be identical to each-other.
> 
> Wherever you got your library from, I would have thought it would point 
> blatantly at
> a header file they wanted you to use.
> 

They might be and I just am not familiar enough with OSX to recognize it.  
Thanks for the information.  I'll see what it brings me...
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread Simon Slavin

On 26 May 2011, at 7:38pm, john darnell wrote:

> However, I am intrigued by your remark that I should be using the header file 
> that comes with the .dylib. I had been using the header that came with the 
> amalgamation.  Where can I find the header that should be used with the 
> .dylib?

I'm not sure what .dylib you're using.  The standard installation of OS X with 
the Developer tools has sqlite header files in

/usr/include/sqlite3.h

and 

/Developer/SDKs/MacOSX10.6.sdk/usr/include/sqlite3.h

which may or may not be identical to each-other.

Wherever you got your library from, I would have thought it would point 
blatantly at a header file they wanted you to use.

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


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread john darnell


> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org]
> On Behalf Of Simon Slavin
> Sent: Thursday, May 26, 2011 12:38 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] SQLite in Xcode


> One thing that occurs to me is that you do not need both the dynamic library 
> and
> the .c & .h files.  If you have included the .c code on your project, you 
> should not
> be including or linking to anything else with 'sqlite' in its filename.  
> Similarly, if you
> are linking against an SQLite library, you don't need the .c source code, 
> just the
> version of the .h file that should be found with that library.  

I can promise you that I had removed the .c file from the project.  

However, I am intrigued by your remark that I should be using the header file 
that comes with the .dylib.  I had been using the header that came with the 
amalgamation.  Where can I find the header that should be used with the .dylib?
  
> 
> I'm sorry about the incredibly picky questions we're asking, but Xcode with an
> existing project is huge and complicated and there doesn't seem to be any 
> other
> way to figure out what's going on.
> 

On that we both agree.  I don't mind the questions, not even a little bit.  I 
am dually afraid of two things when I correspond with this list:

1.)  I'm not giving enough information
2.)  I'm being so wordy that no one will want to look at my questions/responses 
(there is a reason my moniker is 'Pedantic' :).

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


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread Simon Slavin

On 26 May 2011, at 5:35pm, john darnell wrote:

>> Make sure sqlite3.c is 'ticked' next to 'Target Membership' for your product 
>> file.
> 
> I am not someone who uses Xcode frequently--I usually develop on Windows and 
> port t the Mac, but if by "Target Membership" you mean the last column in the 
> pane that lists all files when the project name is selected in the Groups & 
> Files pane, headed by an icon that looks like a target, the sqlite3.c file is 
> 'ticked.'
> 
>> Also make sure sqlite3.c is listed as 'C source' and sqlite3.h is listed as 
>> 'C header'
>> under 'Identity and Type'.
> 
> I clicked the sqlite3.c filename in the Groups & Files panel, clicked the 
> information icon (the blue button with the white 'i' at the top of the 
> window).  Under the General tab, under the File Type dropdown, the file is 
> listed as 'sourcecode.c.c', and the sqlite3.h file is listed as 
> 'sourcecode.c.h.' If you have in mind some other location, please let me know.

No, both the above suggest you did the right thing.

One thing that occurs to me is that you do not need both the dynamic library 
and the .c & .h files.  If you have included the .c code on your project, you 
should not be including or linking to anything else with 'sqlite' in its 
filename.  Similarly, if you are linking against an SQLite library, you don't 
need the .c source code, just the version of the .h file that should be found 
with that library.  I'm not sure whether including both source code and library 
would cause the problems you're describing, though.

>>> 3.) I compiled and received 1200+ errors.
>> 
>> Try the above, and if those don't go away, post the first one or two (note 
>> all
>> 1200+) here.
> 
> Here are two errors out of the 1200+ errors generated (I tried to include as 
> much information as possible to help identify the problem.  Please forgive if 
> I am overdoing it...):

I'm sorry about the incredibly picky questions we're asking, but Xcode with an 
existing project is huge and complicated and there doesn't seem to be any other 
way to figure out what's going on.

> 
>   Compiling /.../sqlite3.c
>   Error:invalid conversion from "void *" to "char *"
>   This error was marked at line 13726.
> 
>   Error:forward declaration of 'struct SrcList_item'
>   This error was marked at line 11047.
> 
> There were six warnings as well, most of which were warnings about division 
> by zero.

Maybe someone clever at C can explain these.  I'm terrible at C.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread john darnell
Mr. Slavin, here's the information you requested:

Please note that I am working in Xcode 3.1.3.  That may or may not be part/all 
of the problem.

> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org]
> On Behalf Of Simon Slavin
> Sent: Thursday, May 26, 2011 10:01 AM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] SQLite in Xcode
> 
> > 1.)  I downloaded and uncompressed sqlite-autoconf-3070602.tar.gz from 
> > the
> SQLite download page.
> 
> The top one, with just .c and .h is adequate.  You shouldn't end up using any 
> of
> the scripts or makefiles for building.

I can confirm that I only moved/added sqlite3.c and sqlite3.h into the source 
folder and into the project.

> 
> > 2.) I moved SQLite3.c and SQLite3.h into my source folder and added 
> > them to
> the project.
> 
> > I made no changes to the code nor did I do anything special when I added 
> > them
> to my project (i.e. I did not set any special compile flags-I simply added 
> the two
> files to the project).
> 
> Make sure sqlite3.c is 'ticked' next to 'Target Membership' for your product 
> file.

I am not someone who uses Xcode frequently--I usually develop on Windows and 
port t the Mac, but if by "Target Membership" you mean the last column in the 
pane that lists all files when the project name is selected in the Groups & 
Files pane, headed by an icon that looks like a target, the sqlite3.c file is 
'ticked.'

> 
> Also make sure sqlite3.c is listed as 'C source' and sqlite3.h is listed as 
> 'C header'
> under 'Identity and Type'.

I clicked the sqlite3.c filename in the Groups & Files panel, clicked the 
information icon (the blue button with the white 'i' at the top of the window). 
 Under the General tab, under the File Type dropdown, the file is listed as 
'sourcecode.c.c', and the sqlite3.h file is listed as 'sourcecode.c.h.'  If you 
have in mind some other location, please let me know.

> 
> > 3.) I compiled and received 1200+ errors.
> 
> Try the above, and if those don't go away, post the first one or two (note all
> 1200+) here.
> 

Here are two errors out of the 1200+ errors generated (I tried to include as 
much information as possible to help identify the problem.  Please forgive if I 
am overdoing it...):

Compiling /.../sqlite3.c
Error:invalid conversion from "void *" to "char *"
This error was marked at line 13726.

Error:forward declaration of 'struct SrcList_item'
This error was marked at line 11047.

There were six warnings as well, most of which were warnings about division by 
zero.

R,
John

> Simon.
> ___
> 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] SQLite in Xcode

2011-05-26 Thread Jean-Denis Muys

On 26 mai 2011, at 17:23, john darnell wrote:


On 26 mai 2011, at 16:49, john darnell wrote:

Since then I have tried using the sqlite.dylib file that comes with OSX but in
doing so, some important SQLite functions (such as the prepare function) were
not found during the link process.

This shouldn't happen. My app links just fine. You must add "libsqlite3.dylib" 
to the
"Link binary with libraries" section of the "Build Phases" pane of your target
settings.

Jean-Denis


Thank you, Jean-Denis for this information.  I initially added the 
libsqlite3.dylib into the Libraries->API->Debug group.  In so doing, Xcode 
automatically added the same dylib to the "Link Binary with Libraries" phase of 
my debug version.  Are you suggesting that I should have added it directly?

I suppose that as long as that library appears in the "Link Binary with 
Libraries" list, it should be OK, but I only ever did it the way I described.

Now I don't get it that you mention your "debug version". "Debug" is a 
configuration, and when I add that library, it gets added to my target whatever 
the configuration. I suppose being able to specify to include a library only 
for some configurations could be useful, but I don't even know how to do that.

Also I don't have a "Libraries->API->Debug" group. My project, created from a 
standard Apple template, only has a "Frameworks" groups where I put all my 
libraries. Since that group is not associated with a directory, it should 
normally be irrelevant which group you use.

Maybe you could copy/paste the exact link error you get to the list.

I can also setup a dummy project with SQLite if you like.

Jean-Denis

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


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread john darnell


> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org]
> On Behalf Of Jean-Denis Muys
> Sent: Thursday, May 26, 2011 10:08 AM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] SQLite in Xcode
> 
> 
> On 26 mai 2011, at 16:49, john darnell wrote:
> 


> >
> > Since then I have tried using the sqlite.dylib file that comes with OSX but 
> > in
> doing so, some important SQLite functions (such as the prepare function) were
> not found during the link process.
> 
> This shouldn't happen. My app links just fine. You must add 
> "libsqlite3.dylib" to the
> "Link binary with libraries" section of the "Build Phases" pane of your target
> settings.
> 
> Jean-Denis
> 

Thank you, Jean-Denis for this information.  I initially added the 
libsqlite3.dylib into the Libraries->API->Debug group.  In so doing, Xcode 
automatically added the same dylib to the "Link Binary with Libraries" phase of 
my debug version.  Are you suggesting that I should have added it directly?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [BUG] Silent change in intergeral overflow handling in 3.7.6

2011-05-26 Thread Doug Currie

On May 26, 2011, at 2:54 AM, Jan Hudec wrote:
> Gotcha! No, it's not. -1-x is equivalent, but -x-1 is not:
> 
>sqlite> select -1-(1<<63), -(1<<63)-1;
>9223372036854775807|9.22337203685478e+18
> 
> Besides my point was not that it's not possible, but that it would
> be more readable with dedicated operator.

Yes.

The fact that a negative number (-1) minus a large positive number (1 << 63) 
results in a positive number does not seem to be in concert with the goal of 
handling arithmetic overflows sensibly. 

This is especially egregious in the second case where the result of negating a 
large positive number and subtracting one is positive AND REAL (double float). 

Ideally SQLite would guarantee one of (in my order of preference):

1) Integer operations that overflow 64 bits behave as wrapped twos complement, 
i.e., they return the low 64 bits of the infinite precision twos complement 
integer result

2) Integer operations that overflow 64 bits result in floating point values 
that approximate the result with the precision of IEEE double 

3) Integer operations that overflow have no guaranteed result

I think option 2 is what SQLite is supposed to do (per the release notes), but 
is failing in both cases of this example.

e

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


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread Simon Slavin

On 26 May 2011, at 3:49pm, john darnell wrote:

> I am still trying to get SQLite to work on my Mac.  I want to make sure I am 
> doing what I should be doing.  Here are the steps I have taken:
> 
> 1.)  I downloaded and uncompressed sqlite-autoconf-3070602.tar.gz from 
> the SQLite download page.

The top one, with just .c and .h is adequate.  You shouldn't end up using any 
of the scripts or makefiles for building.

> 2.) I moved SQLite3.c and SQLite3.h into my source folder and added them 
> to the project.

> I made no changes to the code nor did I do anything special when I added them 
> to my project (i.e. I did not set any special compile flags-I simply added 
> the two files to the project).

Make sure sqlite3.c is 'ticked' next to 'Target Membership' for your product 
file.

Also make sure sqlite3.c is listed as 'C source' and sqlite3.h is listed as 'C 
header' under 'Identity and Type'.

> 3.) I compiled and received 1200+ errors.

Try the above, and if those don't go away, post the first one or two (note all 
1200+) here.

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


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread Jean-Denis Muys

On 26 mai 2011, at 16:49, john darnell wrote:

> Hello everyone.
> 
> I am still trying to get SQLite to work on my Mac.  I want to make sure I am 
> doing what I should be doing.  Here are the steps I have taken:
> 
> 1.)  I downloaded and uncompressed sqlite-autoconf-3070602.tar.gz from 
> the SQLite download page.
> 2.) I moved SQLite3.c and SQLite3.h into my source folder and added them 
> to the project.  I made no changes to the code nor did I do anything special 
> when I added them to my project (i.e. I did not set any special compile 
> flags-I simply added the two files to the project).
> 3.) I compiled and received 1200+ errors.
> 
> Since then I have tried using the sqlite.dylib file that comes with OSX but 
> in doing so, some important SQLite functions (such as the prepare function) 
> were not found during the link process.

This shouldn't happen. My app links just fine. You must add "libsqlite3.dylib" 
to the "Link binary with libraries" section of the "Build Phases" pane of your 
target settings.

Jean-Denis

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


Re: [sqlite] SQLite in Xcode

2011-05-26 Thread Pavel Ivanov
> 2.)     I moved SQLite3.c and SQLite3.h into my source folder and added them 
> to the project.  I made no changes to the code nor did I do anything special 
> when I added them to my project (i.e. I did not set any special compile 
> flags-I simply added the two files to the project).
> 3.)     I compiled and received 1200+ errors.

Try to change settings for sqlite3.c so that it is compiled as C not
as C++ (I don't know exactly where are those settings in XCode, I
believe you should know that).


Pavel


On Thu, May 26, 2011 at 10:49 AM, john darnell
 wrote:
> Hello everyone.
>
> I am still trying to get SQLite to work on my Mac.  I want to make sure I am 
> doing what I should be doing.  Here are the steps I have taken:
>
> 1.)      I downloaded and uncompressed sqlite-autoconf-3070602.tar.gz from 
> the SQLite download page.
> 2.)     I moved SQLite3.c and SQLite3.h into my source folder and added them 
> to the project.  I made no changes to the code nor did I do anything special 
> when I added them to my project (i.e. I did not set any special compile 
> flags-I simply added the two files to the project).
> 3.)     I compiled and received 1200+ errors.
>
> Since then I have tried using the sqlite.dylib file that comes with OSX but 
> in doing so, some important SQLite functions (such as the prepare function) 
> were not found during the link process.
>
> My most recent attempt has been to follow the instructions that come with the 
> tarball I downloaded to create my own SQLite library.  When I run 
> ./configure, the procedure errors out, saying that it could not find an 
> acceptable C compiler in the $Path.
>
> Anyone have any new possibilities to try?
>
> BTW, (and I apologize for not sharing this sooner-it didn't occur to me that 
> it might be relevant until recently)  I am using SQLite3 in concert with the 
> InDesign SDK to produce an InDesign plugin (which we freely distribute to our 
> customers).  There is a possibility that the SDK has something going on that 
> causes the massive explosion of errors.
>
> And finally, the very first time I used SQLite3 on my Windows box, upon 
> compilation, it generated a whopping 200 errors, and continued to do so until 
> I turned off "using precompiled headers."  I cannot see a way to do this in 
> Xcode.  Perhaps that is my problem?
>
> R,
> John A.M. Darnell
> Senior Programmer
> Walsworth Publishing Company
> Brookfield, MO
> John may also be reached at 
> johnamdarn...@gmail.com
>
> Trivia question Trivia question:  In The Lord of the Rings,Leglolas was a 
> prince among the Silvan Elves.  What was the name of his father the King?  
> For extra credit, what was his surname?
>
>
>
> ___
> 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 in Xcode

2011-05-26 Thread john darnell
Hello everyone.

I am still trying to get SQLite to work on my Mac.  I want to make sure I am 
doing what I should be doing.  Here are the steps I have taken:

1.)  I downloaded and uncompressed sqlite-autoconf-3070602.tar.gz from the 
SQLite download page.
2.) I moved SQLite3.c and SQLite3.h into my source folder and added them to 
the project.  I made no changes to the code nor did I do anything special when 
I added them to my project (i.e. I did not set any special compile flags-I 
simply added the two files to the project).
3.) I compiled and received 1200+ errors.

Since then I have tried using the sqlite.dylib file that comes with OSX but in 
doing so, some important SQLite functions (such as the prepare function) were 
not found during the link process.

My most recent attempt has been to follow the instructions that come with the 
tarball I downloaded to create my own SQLite library.  When I run ./configure, 
the procedure errors out, saying that it could not find an acceptable C 
compiler in the $Path.

Anyone have any new possibilities to try?

BTW, (and I apologize for not sharing this sooner-it didn't occur to me that it 
might be relevant until recently)  I am using SQLite3 in concert with the 
InDesign SDK to produce an InDesign plugin (which we freely distribute to our 
customers).  There is a possibility that the SDK has something going on that 
causes the massive explosion of errors.

And finally, the very first time I used SQLite3 on my Windows box, upon 
compilation, it generated a whopping 200 errors, and continued to do so until I 
turned off "using precompiled headers."  I cannot see a way to do this in 
Xcode.  Perhaps that is my problem?

R,
John A.M. Darnell
Senior Programmer
Walsworth Publishing Company
Brookfield, MO
John may also be reached at 
johnamdarn...@gmail.com

Trivia question Trivia question:  In The Lord of the Rings,Leglolas was a 
prince among the Silvan Elves.  What was the name of his father the King?  For 
extra credit, what was his surname?



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


Re: [sqlite] [BUG] Silent change in intergeral overflow handling in 3.7.6

2011-05-26 Thread Jan Hudec
Igor Tandetnik  writes:

> Jan Hudec  wrote:
> > (it would be nicest if sqlite could get bitwise not one day).
> 
> -x-1  is equivalent, assuming two's complement representation.

Gotcha! No, it's not. -1-x is equivalent, but -x-1 is not:

sqlite> select -1-(1<<63), -(1<<63)-1;
9223372036854775807|9.22337203685478e+18

Besides my point was not that it's not possible, but that it would
be more readable with dedicated operator.

Regards,
Jan Hudec

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