Re: [sqlite] WITH syntax error

2014-07-12 Thread Dan Kennedy

On 07/13/2014 01:24 AM, Staffan Tylen wrote:

According to sqlite3 I'm on 3.8.3:

SQLite version 3.8.3 2014-02-03 14:04:11


I remember now. There was a bug regarding compound SELECT statements 
that use CTEs discovered shortly after 3.8.3 was released:


  http://www.sqlite.org/src/info/67bfd59d9087a987
  http://www.sqlite.org/src/info/31a19d11b97088296a

The fix appeared in 3.8.4. If you upgrade, the statement will work.

You'll note that I said the statement "should" work in 3.8.3. Not that 
it does. :)


Dan.












On Sat, Jul 12, 2014 at 8:06 PM, Dan Kennedy  wrote:


On 07/13/2014 12:29 AM, Staffan Tylen wrote:


The following statement is flagged as invalid, so what's the correct way
of
coding it?

WITH A AS (SELECT 'A'),
 B AS (SELECT 'B')
SELECT *
FROM A
UNION
SELECT *
FROM B
;


This statement should work in SQLite 3.8.3 or newer.


___
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] WITH syntax error

2014-07-12 Thread Keith Medcalf
SQLite version 3.8.6 2014-07-07 18:03:38
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .version
SQLite 3.8.6 2014-07-07 18:03:38 1cec1e030035e5253fb7ebbdfe5c1a3029e4e29b
sqlite>   WITH A AS (SELECT 'A'),
   ...>B AS (SELECT 'B')
   ...>   SELECT *
   ...>   FROM A
   ...>   UNION
   ...>   SELECT *
   ...>   FROM B
   ...>   ;
A
B
sqlite>

>-Original Message-
>From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
>boun...@sqlite.org] On Behalf Of Staffan Tylen
>Sent: Saturday, 12 July, 2014 11:30
>To: sqlite-users@sqlite.org
>Subject: [sqlite] WITH syntax error
>
>The following statement is flagged as invalid, so what's the correct way
>of
>coding it?
>
>  WITH A AS (SELECT 'A'),
>   B AS (SELECT 'B')
>  SELECT *
>  FROM A
>  UNION
>  SELECT *
>  FROM B
>  ;
>
>Staffan
>___
>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] WITH syntax error

2014-07-12 Thread RSmith


On 2014/07/12 20:37, Staffan Tylen wrote:

Ryan

"After your final Select statement, the constructed "WITH" table no longer exists, it's scope is only visible to the select 
following the declaration, so anything after a UNION is a new select and as such cannot refer to anything inside the previous 
select's constructs or clauses."


This is exactly what I've looked for in the documentation, but I've been unable to find any mentioning of this limitation. The 
closest I found was this:


 *

The WITH clause must appear at the beginning of a top-level SELECT 
 statement or at
the beginning of a subquery. The WITH clause cannot be prepended to the 
second or subsequent SELECT statement of a compound
select .

There is no mention here that the WITH clause in not visible to subsequent SELECT statements. Knowing this I'll use your "last 
option" as that seems to do what I'm looking for.

Thanks.


Agreed, this might also have changed since 3.8.3 or may still change - A 
clarification in the documentation is probably a good idea.

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


Re: [sqlite] WITH syntax error

2014-07-12 Thread Staffan Tylen
Ryan

"After your final Select statement, the constructed "WITH" table no longer
exists, it's scope is only visible to the select following the declaration,
so anything after a UNION is a new select and as such cannot refer to
anything inside the previous select's constructs or clauses."

This is exactly what I've looked for in the documentation, but I've been
unable to find any mentioning of this limitation. The closest I found was
this:


   -

   The WITH clause must appear at the beginning of a top-level SELECT
    statement or at the beginning
   of a subquery. The WITH clause cannot be prepended to the second or
   subsequent SELECT statement of a compound select
   .

There is no mention here that the WITH clause in not visible to subsequent
SELECT statements. Knowing this I'll use your "last option" as that seems
to do what I'm looking for.
Thanks.

Staffan



On Sat, Jul 12, 2014 at 8:26 PM, RSmith  wrote:

>
> On 2014/07/12 19:29, Staffan Tylen wrote:
>
>> The following statement is flagged as invalid, so what's the correct way
>> of
>> coding it?
>>
>>WITH A AS (SELECT 'A'),
>> B AS (SELECT 'B')
>>SELECT *
>>FROM A
>>UNION
>>SELECT *
>>FROM B
>>;
>>
>
> Hi Staffan,
>
> What is wrong with it? Depends what you intended to do? Can you say in
> normal English what you would like to achieve or have the SQL engine return
> from the proposed query?
>
> To demonstrate what I mean, your current query basically says to the
> engine: "Imagine there's 2 boxes in the sky, called A and B without form,
> and we try to stuff a value into each, then show me what is all in box A
> and then, for my next query (which should be appended or UNION'd to the
> previous query), get a list of all things in a Table named B (which doesn't
> exist in the DB as far as we can tell)."
>
> There is no plausible way to do this.
>
> A simple fix as an example might be:
>
> WITH A(x) AS (SELECT 'a'), B(x) AS (SELECT 'b')
>   SELECT A.*, B.* FROM A,B
>
> Which adds a form to both WITH table specifications, populates it with
> values and then ask to list the values next to each other. It is important
> to understand that A and B does not exist in the DB, they are just
> constructs of the imagination of the query and only valid within the scope
> of the single select following the construct.
>
> Another possible solution might be:
>
> WITH A(x) AS (SELECT 'a' UNION SELECT 'b')
>   SELECT A.* FROM A
>
> Which adds form and a union in the table with which added records will be
> produced.
>
> Depends what you want. One thing to note, the structure of a WITH
> statement as given in the documentation boils down to the form:
>
> WITH table(schema) AS (Initial SELECT Statement [UNION Recursive-Select])
> final SELECT stmt.
>
> (Ref: http://www.sqlite.org/lang_with.html)
>
> After your final Select statement, the constructed "WITH" table no longer
> exists, it's scope is only visible to the select following the declaration,
> so anything after a UNION is a new select and as such cannot refer to
> anything inside the previous select's constructs or clauses. This, by the
> way, is true for any union'd select, you cannot refer to defines from
> inside the select preceding the union, it's not just a "WITH" construct
> quirk. (Normally anyway, it may differ slightly between engines, if anyone
> knows more specific, please add a thought).
>
> So to be sure, your query can be interpreted:
>
>   WITH A AS (SELECT 'A'),   -- Make tables A and B without form and try to
> insert literals, which
>B AS (SELECT 'B')-- is a bad convention but still possible in
> SQLite.
>   SELECT *
>   FROM A  -- read only from the one table named A
>   UNION
>   SELECT *-- start a new select
>   FROM B  -- What table B? This second select has no reference to such
> a table.
>   ;
>
>
> As a last option, if you absolutely need to Union the values, a sub-select
> will do the job of keeping the "with" construct relevant to the entire
> select query, maybe something like this:
>
> WITH
> A AS (SELECT 'a'),
> B AS (SELECT 'b')
> SELECT * FROM (
>
> SELECT * FROM A
> UNION
> SELECT * FROM B
> );
>
> Hope this helps!
> Ryan
>
>
> ___
> 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] WITH syntax error

2014-07-12 Thread RSmith


On 2014/07/12 19:29, Staffan Tylen wrote:

The following statement is flagged as invalid, so what's the correct way of
coding it?

   WITH A AS (SELECT 'A'),
B AS (SELECT 'B')
   SELECT *
   FROM A
   UNION
   SELECT *
   FROM B
   ;


Hi Staffan,

What is wrong with it? Depends what you intended to do? Can you say in normal English what you would like to achieve or have the SQL 
engine return from the proposed query?


To demonstrate what I mean, your current query basically says to the engine: "Imagine there's 2 boxes in the sky, called A and B 
without form, and we try to stuff a value into each, then show me what is all in box A and then, for my next query (which should be 
appended or UNION'd to the previous query), get a list of all things in a Table named B (which doesn't exist in the DB as far as we 
can tell)."


There is no plausible way to do this.

A simple fix as an example might be:

WITH A(x) AS (SELECT 'a'), B(x) AS (SELECT 'b')
  SELECT A.*, B.* FROM A,B

Which adds a form to both WITH table specifications, populates it with values and then ask to list the values next to each other. It 
is important to understand that A and B does not exist in the DB, they are just constructs of the imagination of the query and only 
valid within the scope of the single select following the construct.


Another possible solution might be:

WITH A(x) AS (SELECT 'a' UNION SELECT 'b')
  SELECT A.* FROM A

Which adds form and a union in the table with which added records will be 
produced.

Depends what you want. One thing to note, the structure of a WITH statement as 
given in the documentation boils down to the form:

WITH table(schema) AS (Initial SELECT Statement [UNION Recursive-Select]) final 
SELECT stmt.

(Ref: http://www.sqlite.org/lang_with.html)

After your final Select statement, the constructed "WITH" table no longer exists, it's scope is only visible to the select following 
the declaration, so anything after a UNION is a new select and as such cannot refer to anything inside the previous select's 
constructs or clauses. This, by the way, is true for any union'd select, you cannot refer to defines from inside the select 
preceding the union, it's not just a "WITH" construct quirk. (Normally anyway, it may differ slightly between engines, if anyone 
knows more specific, please add a thought).


So to be sure, your query can be interpreted:

  WITH A AS (SELECT 'A'),   -- Make tables A and B without form and try to 
insert literals, which
   B AS (SELECT 'B')-- is a bad convention but still possible in SQLite.
  SELECT *
  FROM A  -- read only from the one table named A
  UNION
  SELECT *-- start a new select
  FROM B  -- What table B? This second select has no reference to such a 
table.
  ;


As a last option, if you absolutely need to Union the values, a sub-select will do the job of keeping the "with" construct relevant 
to the entire select query, maybe something like this:


WITH
A AS (SELECT 'a'),
B AS (SELECT 'b')
SELECT * FROM (
SELECT * FROM A
UNION
SELECT * FROM B
);

Hope this helps!
Ryan

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


Re: [sqlite] WITH syntax error

2014-07-12 Thread Staffan Tylen
According to sqlite3 I'm on 3.8.3:

SQLite version 3.8.3 2014-02-03 14:04:11



On Sat, Jul 12, 2014 at 8:06 PM, Dan Kennedy  wrote:

> On 07/13/2014 12:29 AM, Staffan Tylen wrote:
>
>> The following statement is flagged as invalid, so what's the correct way
>> of
>> coding it?
>>
>>WITH A AS (SELECT 'A'),
>> B AS (SELECT 'B')
>>SELECT *
>>FROM A
>>UNION
>>SELECT *
>>FROM B
>>;
>>
>
> This statement should work in SQLite 3.8.3 or newer.
>
>
> ___
> 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] WITH syntax error

2014-07-12 Thread Dan Kennedy

On 07/13/2014 12:29 AM, Staffan Tylen wrote:

The following statement is flagged as invalid, so what's the correct way of
coding it?

   WITH A AS (SELECT 'A'),
B AS (SELECT 'B')
   SELECT *
   FROM A
   UNION
   SELECT *
   FROM B
   ;


This statement should work in SQLite 3.8.3 or newer.

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


Re: [sqlite] WITH syntax error

2014-07-12 Thread Petite Abeille

On Jul 12, 2014, at 7:29 PM, Staffan Tylen  wrote:

> The following statement is flagged as invalid, so what's the correct way of
> coding it?

Flagged by whom? Invalid how?

Either way, from SQLIte point of view, looks legit the way it is.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] near "?": syntax error

2010-04-28 Thread Manoj M
Thanks for all help.
Yes, its an application issue. We fixed it.

Regards,
Manoj Marathayil



On Wed, Apr 28, 2010 at 5:16 PM, Richard Hipp  wrote:
> On Wed, Apr 28, 2010 at 7:30 AM, Alexey Pechnikov 
> wrote:
>
>> 2010/4/28 Manoj M :
>> > I am getting error message "near "?": syntax error" randomly while
>> > executing the query "SELECT [record] FROM [ac_contacts_cache] LIMIT 0,
>> > 3".
>>
>> The SQL "LIMIT 0, 3" is incorrect. Use "LIMIT 3 OFFSET 0" instead.
>>
>
> SQLite accepts both variations on the LIMIT syntax.  They do exactly the
> same thing.
>
> Manoj has an application problem of some kind.  He is sending something to
> sqlite3_prepare() that is different from what he things he is sending.  Or,
> perhaps he has multiple threads running with SQLite mutexes disabled.  Or
> prehaps he is send a string into sqlite3_prepare() and then freeing and/or
> overwriting that string before sqlite3_prepare() returns.  In any event, it
> is not SQLite that is causing Manoj's problem, and without additional
> information, we can't really determine the source of the problem.
>
>
>
>>
>> --
>> Best regards, Alexey Pechnikov.
>> http://pechnikov.tel/
>> ___
>> 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-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] near "?": syntax error

2010-04-28 Thread Richard Hipp
On Wed, Apr 28, 2010 at 7:30 AM, Alexey Pechnikov wrote:

> 2010/4/28 Manoj M :
> > I am getting error message "near "?": syntax error" randomly while
> > executing the query "SELECT [record] FROM [ac_contacts_cache] LIMIT 0,
> > 3".
>
> The SQL "LIMIT 0, 3" is incorrect. Use "LIMIT 3 OFFSET 0" instead.
>

SQLite accepts both variations on the LIMIT syntax.  They do exactly the
same thing.

Manoj has an application problem of some kind.  He is sending something to
sqlite3_prepare() that is different from what he things he is sending.  Or,
perhaps he has multiple threads running with SQLite mutexes disabled.  Or
prehaps he is send a string into sqlite3_prepare() and then freeing and/or
overwriting that string before sqlite3_prepare() returns.  In any event, it
is not SQLite that is causing Manoj's problem, and without additional
information, we can't really determine the source of the problem.



>
> --
> Best regards, Alexey Pechnikov.
> http://pechnikov.tel/
> ___
> 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] near "?": syntax error

2010-04-28 Thread Igor Tandetnik
Manoj M wrote:
> I am getting error message "near "?": syntax error" randomly while
> executing the query "SELECT [record] FROM [ac_contacts_cache] LIMIT 0,
> 3".

I don't see how this error may arise from this query, seeing as it doesn't 
contain '?' anywhere.

How exactly do you "execute" the query? You must be passing a string to 
sqlite3_prepare* different from one you think you are passing.
-- 
Igor Tandetnik

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


Re: [sqlite] near "?": syntax error

2010-04-28 Thread Igor Tandetnik
Alexey Pechnikov wrote:
> 2010/4/28 Manoj M :
>> I am getting error message "near "?": syntax error" randomly while
>> executing the query "SELECT [record] FROM [ac_contacts_cache] LIMIT 0,
>> 3".
> 
> The SQL "LIMIT 0, 3" is incorrect. Use "LIMIT 3 OFFSET 0" instead.

Both are valid in SQLite
-- 
Igor Tandetnik

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


Re: [sqlite] near "?": syntax error

2010-04-28 Thread Alexey Pechnikov
2010/4/28 Manoj M :
> I am getting error message "near "?": syntax error" randomly while
> executing the query "SELECT [record] FROM [ac_contacts_cache] LIMIT 0,
> 3".

The SQL "LIMIT 0, 3" is incorrect. Use "LIMIT 3 OFFSET 0" instead.

-- 
Best regards, Alexey Pechnikov.
http://pechnikov.tel/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Schema syntax error

2009-03-22 Thread D. Richard Hipp

On Mar 18, 2009, at 9:39 PM, Tristan Seligmann wrote:

> Divmod Axiom[1] is a Python ORM built on SQLite; one of the book
> keeping tables it creates in the database has a column named
> "indexed", which became a reserved word around SQLite 3.6.4 (?). The
> "obvious" fix for this problem is to simply quote the column name
> using "", but the problem is that it is now impossible to load older
> databases which didn't have the column created with the name quoted:
>
> Error: malformed database schema (axiom_attributes) - near "indexed":
> syntax error
>
> What sort of migration path exists for converting / fixing these old
> databases? Ideally there would be some mechanism that does not require
> reinstalling an older version of SQLite.

See http://www.sqlite.org/cvstrac/chngview?cn=6370

Beginning with the next release, the parser has been modified to allow  
INDEXED to be used as the name of a table or index or column.


>
> -- 
> mithrandi, i Ainil en-Balandor, a faer Ambar
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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



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


Re: [sqlite] Schema syntax error

2009-03-19 Thread Kees Nuyt
On Thu, 19 Mar 2009 03:39:11 +0200, Tristan Seligmann
 wrote:

>Divmod Axiom[1] is a Python ORM built on SQLite; one of the book
>keeping tables it creates in the database has a column named
>"indexed", which became a reserved word around SQLite 3.6.4 (?). The
>"obvious" fix for this problem is to simply quote the column name
>using "", but the problem is that it is now impossible to load older
>databases which didn't have the column created with the name quoted:
>
>Error: malformed database schema (axiom_attributes) - near "indexed":
>syntax error
>
>What sort of migration path exists for converting / fixing these old
>databases? Ideally there would be some mechanism that does not require
>reinstalling an older version of SQLite.

Digging in the mailing list archives, I found this:

==
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] FTS and upgrades
From: d...@hwaci.com
Date: Tue, 10 Jul 2007 22:26:21 +

I probably shouldn't tell you this, but

There is a pragma:

   PRAGMA writable_schema=ON;

Which when enabled allows you to UPDATE or 
DELETE against the sqlite_master table.
==

Using this PRAGMA, you can UPDATE the sql column in the
sqlite_master table. Of course this is undocumented and
unsupported, and you risk corrupting your databases.
Backups and rigorous testing required.
-- 
  (  Kees Nuyt
  )
c[_]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] configure syntax error on HP

2008-06-23 Thread Dennis Cote
Dan wrote:
> 
> You don't, by chance, know how to get gcc to report variable  
> declarations
> mixed in with code as errors (or warnings) do you?
> 
> i.e. how do I get the following to cause an error?
> 
>void somefunction(){
>  int one;
>  popuateOne();
>  int two;
>}
> 

With gcc you can add the --pedantic option to get more errors and 
warnings. Add -Wall to turn all warnings into errors as well.

$ gcc --ansi --pedantic test.c
test.c: In function `somefunction':
test.c:4: warning: ISO C90 forbids mixed declarations and code
C:/DOCUME~1/DENNIS~1.HAR/LOCALS~1/Temp/ccOS.o:test.c:(.text+0xd): 
undefined reference to `popuateOne'

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


Re: [sqlite] configure syntax error on HP

2008-06-22 Thread Jay A. Kreibich
On Sun, Jun 22, 2008 at 05:36:32PM -0400, Matt Sergeant scratched on the wall:
> On Sat, 21 Jun 2008 11:50:31 +0700, Dan wrote:
> >> On Thu, 19 Jun 2008 12:05:56 -0400, D. Richard Hipp wrote:
> >>> On Jun 19, 2008, at 11:49 AM, Matt Sergeant wrote:
>  
>  Note that there are some C++ style comments crept back into the code

> >> Good. You might want to consider adding a test for this -
> > 
> > How do you test this?
> 
> Effectively a grep for '//' minus those matching http://.


  Or you could just use a C compiler


  If you're using gcc, "-ansi" will turn off all the "bending of the
  rules" the default gcc environment has, including the ability to
  understand C++ style comments.

  For this and other reasons, I would suggest altering the Makefiles
  so that "-ansi" is used any time gcc is being used.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"'People who live in bamboo houses should not throw pandas.' Jesus said that."
   - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech 2006"
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] configure syntax error on HP

2008-06-22 Thread Matt Sergeant
On Sat, 21 Jun 2008 11:50:31 +0700, Dan wrote:
> 
>> On Thu, 19 Jun 2008 12:05:56 -0400, D. Richard Hipp wrote:
>>> 
>>> On Jun 19, 2008, at 11:49 AM, Matt Sergeant wrote:
 
 Note that there are some C++ style comments crept back into the code
 (I
 noticed in the amalgamation, so I can't give you a direct pointer to
 them). This causes compile failures on stricter C compilers.
>>> 
>>> 
>>> Already been fixed.  http://www.sqlite.org/cvstrac/chngview?cn=5207
>>> and http://www.sqlite.org/cvstrac/tktview?tn=3172
>> 
>> Good. You might want to consider adding a test for this - my
>> DBD::SQLite does one, but I'd rather you catch things upstream.
> 
> How do you test this?

Effectively a grep for '//' minus those matching http://.

Matt.

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] configure syntax error on HP

2008-06-20 Thread Dan

On Jun 21, 2008, at 1:27 AM, Matt Sergeant wrote:

> On Thu, 19 Jun 2008 12:05:56 -0400, D. Richard Hipp wrote:
>>
>> On Jun 19, 2008, at 11:49 AM, Matt Sergeant wrote:
>>>
>>> Note that there are some C++ style comments crept back into the code
>>> (I
>>> noticed in the amalgamation, so I can't give you a direct pointer to
>>> them). This causes compile failures on stricter C compilers.
>>
>>
>> Already been fixed.  http://www.sqlite.org/cvstrac/chngview?cn=5207
>> and http://www.sqlite.org/cvstrac/tktview?tn=3172
>
> Good. You might want to consider adding a test for this - my
> DBD::SQLite does one, but I'd rather you catch things upstream.

How do you test this?

Dan.

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


Re: [sqlite] configure syntax error on HP

2008-06-20 Thread Matt Sergeant
On Thu, 19 Jun 2008 12:05:56 -0400, D. Richard Hipp wrote:
> 
> On Jun 19, 2008, at 11:49 AM, Matt Sergeant wrote:
>> 
>> Note that there are some C++ style comments crept back into the code  
>> (I
>> noticed in the amalgamation, so I can't give you a direct pointer to
>> them). This causes compile failures on stricter C compilers.
> 
> 
> Already been fixed.  http://www.sqlite.org/cvstrac/chngview?cn=5207  
> and http://www.sqlite.org/cvstrac/tktview?tn=3172

Good. You might want to consider adding a test for this - my 
DBD::SQLite does one, but I'd rather you catch things upstream.

Matt.

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] configure syntax error on HP

2008-06-19 Thread D. Richard Hipp

On Jun 19, 2008, at 11:49 AM, Matt Sergeant wrote:
>
> Note that there are some C++ style comments crept back into the code  
> (I
> noticed in the amalgamation, so I can't give you a direct pointer to
> them). This causes compile failures on stricter C compilers.


Already been fixed.  http://www.sqlite.org/cvstrac/chngview?cn=5207  
and http://www.sqlite.org/cvstrac/tktview?tn=3172

D. Richard Hipp
[EMAIL PROTECTED]



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


Re: [sqlite] configure syntax error on HP

2008-06-19 Thread Dan

On Jun 19, 2008, at 10:49 PM, Matt Sergeant wrote:

> On Wed, 18 Jun 2008 19:58:02 -0400, D. Richard Hipp wrote:
>>
>> On Jun 18, 2008, at 7:12 PM, Andrea Connell wrote:
>>
>>> I want to use the C API with a C++ class but when I try compiling...
>>>
>>> $ aCC -AA +W829 main.cpp sqlite3.c
>>> main.cpp:
>>> sqlite3.c:
>>> Error 482: "sqlite3.c", line 532 # Array of unknown size; 'const  
>>> char
>>
>> SQLite is written in C, not C++.  You have to use a C compiler to
>> compile it.  If you compile to object code, you can normally link it
>> against C++ code without difficulty.  But you cannot compile SQLite
>> directly using a C++ compiler.
>
> Note that there are some C++ style comments crept back into the  
> code (I
> noticed in the amalgamation, so I can't give you a direct pointer to
> them). This causes compile failures on stricter C compilers.


I think this problem was fixed by [5207]:

   http://www.sqlite.org/cvstrac/chngview?cn=5207

Please post a bug report or a message here if there are others
that need to be removed.

Dan.




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


Re: [sqlite] configure syntax error on HP

2008-06-19 Thread Matt Sergeant
On Wed, 18 Jun 2008 19:58:02 -0400, D. Richard Hipp wrote:
> 
> On Jun 18, 2008, at 7:12 PM, Andrea Connell wrote:
> 
>> I want to use the C API with a C++ class but when I try compiling...
>> 
>> $ aCC -AA +W829 main.cpp sqlite3.c
>> main.cpp:
>> sqlite3.c:
>> Error 482: "sqlite3.c", line 532 # Array of unknown size; 'const char
> 
> SQLite is written in C, not C++.  You have to use a C compiler to  
> compile it.  If you compile to object code, you can normally link it  
> against C++ code without difficulty.  But you cannot compile SQLite  
> directly using a C++ compiler.

Note that there are some C++ style comments crept back into the code (I 
noticed in the amalgamation, so I can't give you a direct pointer to 
them). This causes compile failures on stricter C compilers.

Matt.

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] configure syntax error on HP

2008-06-19 Thread Andrea Connell
 
Okay that worked, thanks.

Just curious though... I've compiled C and C++ code together many times.
I've never had a problem before since C is basically a subset of C++.
Why doesn't it work here?


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of D. Richard Hipp
Sent: Wednesday, June 18, 2008 6:58 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] configure syntax error on HP


On Jun 18, 2008, at 7:12 PM, Andrea Connell wrote:

> I want to use the C API with a C++ class but when I try compiling...
>
> $ aCC -AA +W829 main.cpp sqlite3.c
> main.cpp:
> sqlite3.c:
> Error 482: "sqlite3.c", line 532 # Array of unknown size; 'const char

SQLite is written in C, not C++.  You have to use a C compiler to
compile it.  If you compile to object code, you can normally link it
against C++ code without difficulty.  But you cannot compile SQLite
directly using a C++ compiler.

D. Richard Hipp
[EMAIL PROTECTED]



___
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] configure syntax error on HP

2008-06-18 Thread D. Richard Hipp

On Jun 18, 2008, at 7:12 PM, Andrea Connell wrote:

> I want to use the C API with a C++ class but when I try compiling...
>
> $ aCC -AA +W829 main.cpp sqlite3.c
> main.cpp:
> sqlite3.c:
> Error 482: "sqlite3.c", line 532 # Array of unknown size; 'const char

SQLite is written in C, not C++.  You have to use a C compiler to  
compile it.  If you compile to object code, you can normally link it  
against C++ code without difficulty.  But you cannot compile SQLite  
directly using a C++ compiler.

D. Richard Hipp
[EMAIL PROTECTED]



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


Re: [sqlite] configure syntax error on HP

2008-06-18 Thread Andrea Connell
>On Jun 18, 2008, at 5:38 PM, Andrea Connell wrote:
>
>> I'm trying to compile 3.5.9 on an HP-UX 11i v1 machine but I can't
get
>> past step one...
>>
>> I unpacked the amalgamation, cd'd to the directory, and ran
>> './configure' - that didn't work so I tried 'sh ./configure' like the
>> install instructions suggest. I got a syntax error right away.
>>
>> ~/sqlite/sqlite-amalgamation-3.5.9.tar/sqlite-amalgamation-3.5.9
>> lacpghp1> ./configure
>> interpreter "/bin/sh" not found
>
>A system without /bin/sh hardly qualifies as Unix, does it?
>
>Looks like you are going to need to compile it yourself.  Ignore the  
>configure script.  Just type something like this:
>
>  cc -o sqlite3 -DSQLITE_THREADSAFE=0 - 
>DSQLITE_OMIT_LOAD_EXTENSION=1 sqlite3.c shell.c
>
>You might need to add some "-l..." arguments on the end to specify  
>libraries, but perhaps not.  The -DSQLITE_THREADSAFE=0 eliminates the  
>needs for pthreads and -DSQLITE_OMIT_LOAD_EXTENSION=1 removes the  
>requirement for dlopen, and on most systems those are the only two  
>libraries required.  But if your system doesn't have a Bourne shell,  
>who knows what other peccadillos lurk around the next corner...
>
>D. Richard Hipp
>drh at hwaci.com
 
 
Yea it's pretty scary. I'm not sure if something is screwy on the box
itself or if it's just my account. Either way I'm hoping I can work
around it without too much pain and suffering. 
 
I tried your suggestion and it didn't give any errors
$ cc -o sqlite3 -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION=1
sqlite3.c shell.c
sqlite3.c:
shell.c:
$
 
I can run the CLI now, but there must be more to do. Ultimately I want
to use the C API with a C++ class but when I try compiling...
 
$ aCC -AA +W829 main.cpp sqlite3.c
main.cpp:
sqlite3.c:
Error 482: "sqlite3.c", line 532 # Array of unknown size; 'const char
[]' is
incomplete.
SQLITE_API const char sqlite3_version[];
  ^^^
Error 204: "sqlite3.c", line 6464 # Uninitialized const variable "const
int
sqlite3one".
SQLITE_PRIVATE const int sqlite3one;
 ^^
Error 203: "sqlite3.c", line 10309 # Cannot assign 'char *' with 'void
*'.
z = sqlite3_malloc( n );
^^^
Error 203: "sqlite3.c", line 11101 # Cannot assign 'long long *' with
'void
*'.
  p = malloc(nBytes+8);
  
Error 203: "sqlite3.c", line 11104 # Cannot assign 'long long *' with
'void
*'.
p = malloc(nBytes+8);

Error 203: "sqlite3.c", line 11130 # Cannot assign 'long long *' with
'void
*'.
  p = pPrior;
  ^^
Error 203: "sqlite3.c", line 11145 # Cannot assign 'long long *' with
'void
*'.
  pInt = p;
 ^
Error 203: "sqlite3.c", line 11162 # Cannot assign 'long long *' with
'void
*'.
  p = pPrior;
  ^^
Error 203: "sqlite3.c", line 11173 # Cannot assign 'long long *' with
'void
*'.
p = realloc(p, nBytes+8);

Error 203: "sqlite3.c", line 11176 # Cannot assign 'long long *' with
'void
*'.
  p = pPrior;
  ^^
Error 203: "sqlite3.c", line 11178 # Cannot assign 'long long *' with
'void
*'.
  p = realloc(p, nBytes+8);
  
Error 419: "/usr/include/sys/pset.h", line 186 # 'spu_t' is used as a
type,
but has not been defined as a type.
extern int pset_assign ( psetid_t pset, spu_t spu, psetid_t*
opset)
^
Error 699: "/usr/include/sys/pset.h", line 186 # Error limit reached;
halting
compilation.
extern int pset_assign ( psetid_t pset, spu_t spu, psetid_t*
opset)
^
$
 
Blech. Can I have a clue to my next step?
 
Thanks,
Andrea
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] configure syntax error on HP

2008-06-18 Thread D. Richard Hipp

On Jun 18, 2008, at 5:38 PM, Andrea Connell wrote:

> I'm trying to compile 3.5.9 on an HP-UX 11i v1 machine but I can't get
> past step one...
>
> I unpacked the amalgamation, cd'd to the directory, and ran
> './configure' - that didn't work so I tried 'sh ./configure' like the
> install instructions suggest. I got a syntax error right away.
>
> ~/sqlite/sqlite-amalgamation-3.5.9.tar/sqlite-amalgamation-3.5.9
> lacpghp1> ./configure
> interpreter "/bin/sh" not found

A system without /bin/sh hardly qualifies as Unix, does it?

Looks like you are going to need to compile it yourself.  Ignore the  
configure script.  Just type something like this:

  cc -o sqlite3 -DSQLITE_THREADSAFE=0 - 
DSQLITE_OMIT_LOAD_EXTENSION=1 sqlite3.c shell.c

You might need to add some "-l..." arguments on the end to specify  
libraries, but perhaps not.  The -DSQLITE_THREADSAFE=0 eliminates the  
needs for pthreads and -DSQLITE_OMIT_LOAD_EXTENSION=1 removes the  
requirement for dlopen, and on most systems those are the only two  
libraries required.  But if your system doesn't have a Bourne shell,  
who knows what other peccadillos lurk around the next corner...

D. Richard Hipp
[EMAIL PROTECTED]



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