Re: [sqlite] Possible Input Parser Issue Inf How to convert SQL file into database when a column value is Inf?

2018-06-12 Thread Abroży Nieprzełoży
or .dump should produce output with 1e999 / -1e999 instead of Inf / -Inf

2018-06-13 1:11 GMT+02:00, Chris Brody :
> On Tue, Jun 12, 2018 at 6:40 PM Richard Hipp  wrote:
>> [...]
>> Maybe use 1e999 and -1e999 instead?
>
> I can confirm on SQLite versions 3.19.2 & 3.24.0:
>
> sqlite> select 1e999;
> Inf
> sqlite> select -1e999;
> -Inf
>
> I wouldn't mind it if SQLite would be a little more symmetrical, i.e.
> output of .dump with Inf or -Inf values would be valid input.
>
> Chris
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Possible Input Parser Issue Inf How to convert SQL file into database when a column value is Inf?

2018-06-12 Thread Chris Brody
On Tue, Jun 12, 2018 at 6:40 PM Richard Hipp  wrote:
> [...]
> Maybe use 1e999 and -1e999 instead?

I can confirm on SQLite versions 3.19.2 & 3.24.0:

sqlite> select 1e999;
Inf
sqlite> select -1e999;
-Inf

I wouldn't mind it if SQLite would be a little more symmetrical, i.e.
output of .dump with Inf or -Inf values would be valid input.

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


Re: [sqlite] Possible Input Parser Issue Inf How to convert SQL file into database when a column value is Inf?

2018-06-12 Thread Richard Hipp
On 6/12/18, Keith Medcalf  wrote:
>
> The tip of trunk also does not parse "Inf" or "-Inf" floating point values

Maybe use 1e999 and -1e999 instead?
-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Possible Input Parser Issue Inf How to convert SQL file into database when a column value is Inf?

2018-06-12 Thread Keith Medcalf

The tip of trunk also does not parse "Inf" or "-Inf" floating point values (eg: 
in an insert statement), but will produce Inf and -Inf output.  The bind and 
column values interfaces however do handle the IEEE inf/-inf correctly.

Is this a bug/oversight in the parser?

sqlite> create table x(x real);
sqlite> insert into x values(Inf);
Error: no such column: Inf
sqlite> insert into x values(-Inf);
Error: no such column: Inf
sqlite> insert into x values(-1e400);
sqlite> select * from x;
-Inf

Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import apsw
>>> import apswaddins
>>> db = apsw.Connection(':memory:')
>>> db.cursor().execute('create table x(x real);')

>>> db.cursor().execute('insert into x values (Inf);')
Traceback (most recent call last):
  File "", line 1, in 
  File "src/cursor.c", line 1019, in APSWCursor_execute.sqlite3_prepare
  File "src/statementcache.c", line 386, in sqlite3_prepare
apsw.SQLError: SQLError: no such column: Inf
>>> db.cursor().execute('insert into x values (-1e400);')

>>> for row in db.cursor().execute('select * from x;'): print row
...
Row(x=-inf)
>>> a = row[0]
>>> a
-inf
>>> db.cursor().execute('insert into x values (?);',(a,))

>>> for row in db.cursor().execute('select * from x;'): print row
...
Row(x=-inf)
Row(x=-inf)

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.

>-Original Message-
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of skywind mailing lists
>Sent: Tuesday, 12 June, 2018 16:06
>To: SQLite mailing list
>Subject: [sqlite] How to convert SQL file into database when a column
>value is Inf?
>
>Hi,
>
>I issued the following commands:
>
>echo .dump | sqlite3 Database.sldb > D.sldb
>sqlite3 -init D.sldb NewDatabase.sldb
>
>Unfortunately, reading the SQL file produced the following error:
>Error: near line 56721: no such column: Inf
>
>The corresponding SQL command is:
>INSERT INTO "Flights"
>VALUES(36,80,1470395806,'','','',NULL,0.0,0,0,0,0,0.0,-Inf,0.0,-
>Inf,0.0,-
>Inf,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,0,0,NULL,NULL,NULL
>,NULL,4,0,'');
>
>OK, it seems to be that the column values are not really correct (-
>Inf) but I would still like to do the conversion. Is there a
>command/trick in sqlite3 that makes it work?
>
>A workaround is of course to use a text editor and try to find and
>replace all occurrences of Inf or -Info.
>
>Regards,
>Hartwig
>
>___
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



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