Re: [sqlite] R*Tree insert error ...

2012-01-18 Thread Peter Aronson
The order for RTREEs is 
min_dimension1,max_dimension1,min_dimension2,max_dimension2...

51.51340259 is definitely greater thanĀ -1.86352760

Best regards,

Peter




From: "g...@novadsp.com" <g...@novadsp.com>
To: sqlite-users@sqlite.org
Sent: Wed, January 18, 2012 11:51:41 AM
Subject: Re: [sqlite] R*Tree insert error ...

On 18/01/2012 18:04, Dan Kennedy wrote:

> One possibility is that you're hitting one of the r-tree tables
> built-in constraints by specifying a record with (minval > maxval)
> for one or more of the dimensions.

Rearranging the bind parameters for match minx,miny,maxx,maxy layout I now get 
this (doubles dumped with 8 decimal places)

Inserting ID: 01, 51.51340259, -1.86352760, 51.51340259, -1.86352760
failure at read() error code 19 (constraint failed)

This is repeatable using Sqlite3

sqlite> INSERT INTO gps_index VALUES(01, 51.51340259, -1.86352760, 51.51340259,
-1.86352760);
Error: constraint failed
sqlite>

> (minval > maxval)

So how does one insert a point? Is there a magic fudge factor involved? Surely 
minval >= maxval? I cannot see anything at http://www.sqlite.org/rtree.html

Help much appreciated. Thanks.

Jerry


___
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] R*Tree insert error ...

2012-01-18 Thread g...@novadsp.com

On 18/01/2012 18:04, Dan Kennedy wrote:


One possibility is that you're hitting one of the r-tree tables
built-in constraints by specifying a record with (minval > maxval)
for one or more of the dimensions.


Rearranging the bind parameters for match minx,miny,maxx,maxy layout I 
now get this (doubles dumped with 8 decimal places)


Inserting ID: 01, 51.51340259, -1.86352760, 51.51340259, -1.86352760
failure at read() error code 19 (constraint failed)

This is repeatable using Sqlite3

sqlite> INSERT INTO gps_index VALUES(01, 51.51340259, -1.86352760, 
51.51340259,

-1.86352760);
Error: constraint failed
sqlite>


(minval > maxval)


So how does one insert a point? Is there a magic fudge factor involved? 
Surely minval >= maxval? I cannot see anything at 
http://www.sqlite.org/rtree.html


Help much appreciated. Thanks.

Jerry


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


Re: [sqlite] R*Tree insert error ...

2012-01-18 Thread g...@novadsp.com

Hello Dan


Are you using sqlite3_prepare() or sqlite3_prepare_v2()? If the
former, try switching to prepare_v2() then checking the error message
again.


The former. I've switched to V2.


One possibility is that you're hitting one of the r-tree tables
built-in constraints by specifying a record with (minval > maxval)
for one or more of the dimensions.


Excellent call. I've been inserting lat,long,lat,long rather than 
lat,lat,long,long - the CREATE VIRTUAL TABLE statement having been 
copied & pasted from the online example.


Apologies for the noise.

Many thanks :)

Jerry


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


Re: [sqlite] R*Tree insert error ...

2012-01-18 Thread Dan Kennedy

On 01/19/2012 12:42 AM, g...@novadsp.com wrote:


On 18/01/2012 16:41, Richard Hipp wrote:


What does sqlite3_errmsg() say?


'SQL logic error or missing database'


Are you using sqlite3_prepare() or sqlite3_prepare_v2()? If the
former, try switching to prepare_v2() then checking the error message
again.

One possibility is that you're hitting one of the r-tree tables
built-in constraints by specifying a record with (minval > maxval)
for one or more of the dimensions.

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


Re: [sqlite] R*Tree insert error ...

2012-01-18 Thread g...@novadsp.com


On 18/01/2012 16:41, Richard Hipp wrote:


What does sqlite3_errmsg() say?


'SQL logic error or missing database'

I should perhaps add this set of inserts is running inside a transaction 
with a WAL enabled database. There is only one write thread active. All 
other inserts (save R*Tree) work precisely as expected.


Thanks for any pointers.

Jerry.


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


Re: [sqlite] R*Tree insert error ...

2012-01-18 Thread Richard Hipp
On Wed, Jan 18, 2012 at 11:15 AM, g...@novadsp.com  wrote:

> One more oddity. Can anyone help?
>
> 1. Create a 2D index as per documentation:
>
> "CREATE VIRTUAL TABLE gps_index USING rtree(id,minX, maxX,minY, maxY)"
>
> 2. Create a statement using a binding string:
>
> "INSERT INTO gps_index VALUES(last_insert_rowid(), ?, ?, ?, ?)"
>
> 3. Bind values. Binding indices run from 1 to 4. This works.
>
> 4. Call sqlite3_step(). This now returns a 1 - SQLITE_ERROR.
>

What does sqlite3_errmsg() say?



>
> Thx++
>
> Using SQLite version 3.7.7.1 built with SQLITE_ENABLE_RTREE=1
> (Windows/VS2008)
>
>
> __**_
> 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