Re: [sqlite] geopoly_contains_point(P,X,Y) doc is overly modest
oh, I hope you dont do that since the application I am working on hopes to exploit the retval = 4 of geopoly_overlap ! regards, Graham On 02-12-2018 7:52 am, Richard Hipp wrote: On 12/1/18, Larry Brasfield wrote: The documentation at https://www.sqlite.org/geopoly.html , at 3.8. for geopoly_contains_point(), asserts that the function “returns true if and only if the coordinate X,Y is inside or on the boundary of the polygon P.” As now implemented, in the v3.26 release, it returns 1 where the point is on a boundary and 2 where the point is inside of the boundary. The geopoly_overlap() and geopoly_within() routines are similarly modest about what they compute. Geopoly_within(A,B) returns +1 if B is completely contained inside of A, and returns +2 if A and B are the same polygon. Geopoly_overlap(A,B) returns 4 different non-zero values (1, 2, 3, and 4) depending on whether or not A is contained in B (2), B is contained in A (3), A and B are the same polygon (4), or if they just overlap (1). I haven't documented those behaviors, because I wanted to leave myself some wiggle room in case I need to change the behavior in the future. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] is True (was: geopoly_contains_point(P, X, Y) doc is overly modest)
Ok. This behaviour is documented here: https://www.sqlite.org/lang_expr.html#booleanexpr --- 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 Keith Medcalf >Sent: Saturday, 1 December, 2018 12:45 >To: SQLite mailing list >Subject: [sqlite] is True (was: geopoly_contains_point(P, X, Y) doc >is overly modest) > > >On Saturday, 1 December, 2018 12:23, Richard Hipp >wrote" > >>On 12/1/18, Keith Medcalf wrote: > Maybe it should say 'Non-Zero' or 'Greater than Zero' rather than true, since true, as a symbol, as a special value. > >>> Yes and no, True and False is SQLite work as one would expect >>> (assuming that one is a programmer is a language that behaves >>> as the underlying hardware (CPU) behaves). > >> Yeah, but Mr. Damon is probably right that the documentation should >> be more precise. So I have now updated it. > >I concur. > >There is however a slight anomaly with how the "is True" test works >that has to do with how type affinities work such that "is True" does >not work entirely as one would expect from a machine perspective. >Presently the LHS of an "is True" is not NUMERIC it is converted to >NUMERIC before the "is True" expression is evaluated, rather than "is >True" being a test for any bits being 1 the LHS. > >This means that ('' is true) evaluates to 0, which is expected, since >there are no bits set in the value on the LHS (it also by >happenstance converts to 0 in numeric affinity). However (select 'a' >is true) evaluates to 0. This is incorrect because there are bits >set in the value on the LHS. However if the LHS can be cast to >numeric the test works as expected: > >sqlite> select '' is true; >0 >sqlite> select 'a' is true; >0 >sqlite> select '1' is true; >1 >sqlite> select '2' is true; >1 >sqlite> select '.1' is true; >1 >sqlite> select '-1' is true; >1 >sqlite> select '-0.1' is true; >1 >sqlite> select '0' is true; >0 >sqlite> select '0.0' is true; >0 >sqlite> select '0.1' is true; >1 > >I don't recall if this is documented anywhere but one should expect >(at least I would expect) that ('a' is true) should evaluate as 1, >not 0, since there are bits set in the value on the LHS. > > > > > >___ >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
[sqlite] is True (was: geopoly_contains_point(P, X, Y) doc is overly modest)
On Saturday, 1 December, 2018 12:23, Richard Hipp wrote" >On 12/1/18, Keith Medcalf wrote: >>>Maybe it should say 'Non-Zero' or 'Greater than Zero' rather than >>>true, since true, as a symbol, as a special value. >> Yes and no, True and False is SQLite work as one would expect >> (assuming that one is a programmer is a language that behaves >> as the underlying hardware (CPU) behaves). > Yeah, but Mr. Damon is probably right that the documentation should > be more precise. So I have now updated it. I concur. There is however a slight anomaly with how the "is True" test works that has to do with how type affinities work such that "is True" does not work entirely as one would expect from a machine perspective. Presently the LHS of an "is True" is not NUMERIC it is converted to NUMERIC before the "is True" expression is evaluated, rather than "is True" being a test for any bits being 1 the LHS. This means that ('' is true) evaluates to 0, which is expected, since there are no bits set in the value on the LHS (it also by happenstance converts to 0 in numeric affinity). However (select 'a' is true) evaluates to 0. This is incorrect because there are bits set in the value on the LHS. However if the LHS can be cast to numeric the test works as expected: sqlite> select '' is true; 0 sqlite> select 'a' is true; 0 sqlite> select '1' is true; 1 sqlite> select '2' is true; 1 sqlite> select '.1' is true; 1 sqlite> select '-1' is true; 1 sqlite> select '-0.1' is true; 1 sqlite> select '0' is true; 0 sqlite> select '0.0' is true; 0 sqlite> select '0.1' is true; 1 I don't recall if this is documented anywhere but one should expect (at least I would expect) that ('a' is true) should evaluate as 1, not 0, since there are bits set in the value on the LHS. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] geopoly_contains_point(P,X,Y) doc is overly modest
On 12/1/18, Keith Medcalf wrote: > >>Maybe it should say 'Non-Zero' or 'Greater than Zero' rather than >>true, since true, as a symbol, as a special value. > > Yes and no, True and False is SQLite work as one would expect (assuming that > one is a programmer is a language that behaves as the underlying hardware > (CPU) behaves). Yeah, but Mr. Damon is probably right that the documentation should be more precise. So I have now updated it. -- 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
Re: [sqlite] geopoly_contains_point(P,X,Y) doc is overly modest
>Maybe it should say 'Non-Zero' or 'Greater than Zero' rather than >true, since true, as a symbol, as a special value. Yes and no, True and False is SQLite work as one would expect (assuming that one is a programmer is a language that behaves as the underlying hardware (CPU) behaves). The "False" state is any state in which all the bits are zero. The "True" state is one in which ANY bit is non-zero. Therefore you get: sqlite> select -1 is true; 1 sqlite> select 0 is true; 0 sqlite> select 1 is true; 1 sqlite> select 2 is true; 1 and conversely for "is false". You can also treat True and False as "values" in which case True has the arbitrary integer value 1, and false has the arbitrary integer value 0 (which complies with the "True means ANY bit is 1 and false means NO bits are one". Any arbitrary non-zero value could have been chosen for the "value" of True when it is used as a value. Using the expression "= TRUE" and "= FALSE" is likely a programmer error, just as "= NULL" is likely a programmer error, because what is really meant is "is TRUE", "is FALSE" and "is NULL" ... --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] geopoly_contains_point(P,X,Y) doc is overly modest
On 12/1/18 1:52 PM, Richard Hipp wrote: > On 12/1/18, Larry Brasfield wrote: >> The documentation at https://www.sqlite.org/geopoly.html , at 3.8. for >> geopoly_contains_point(), asserts that the function “returns true if and >> only if the coordinate X,Y is inside or on the boundary of the polygon P.” >> As now implemented, in the v3.26 release, it returns 1 where the point is on >> a boundary and 2 where the point is inside of the boundary. > The geopoly_overlap() and geopoly_within() routines are similarly > modest about what they compute. Geopoly_within(A,B) returns +1 if B > is completely contained inside of A, and returns +2 if A and B are the > same polygon. Geopoly_overlap(A,B) returns 4 different non-zero > values (1, 2, 3, and 4) depending on whether or not A is contained in > B (2), B is contained in A (3), A and B are the same polygon (4), or > if they just overlap (1). > > I haven't documented those behaviors, because I wanted to leave myself > some wiggle room in case I need to change the behavior in the future. Maybe it should say 'Non-Zero' or 'Greater than Zero' rather than true, since true, as a symbol, as a special value. -- Richard Damon ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] geopoly_contains_point(P,X,Y) doc is overly modest
On 12/1/18, Larry Brasfield wrote: > The documentation at https://www.sqlite.org/geopoly.html , at 3.8. for > geopoly_contains_point(), asserts that the function “returns true if and > only if the coordinate X,Y is inside or on the boundary of the polygon P.” > As now implemented, in the v3.26 release, it returns 1 where the point is on > a boundary and 2 where the point is inside of the boundary. The geopoly_overlap() and geopoly_within() routines are similarly modest about what they compute. Geopoly_within(A,B) returns +1 if B is completely contained inside of A, and returns +2 if A and B are the same polygon. Geopoly_overlap(A,B) returns 4 different non-zero values (1, 2, 3, and 4) depending on whether or not A is contained in B (2), B is contained in A (3), A and B are the same polygon (4), or if they just overlap (1). I haven't documented those behaviors, because I wanted to leave myself some wiggle room in case I need to change the behavior in the future. -- 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] geopoly_contains_point(P,X,Y) doc is overly modest
The documentation at https://www.sqlite.org/geopoly.html , at 3.8. for geopoly_contains_point(), asserts that the function “returns true if and only if the coordinate X,Y is inside or on the boundary of the polygon P.” As now implemented, in the v3.26 release, it returns 1 where the point is on a boundary and 2 where the point is inside of the boundary. While the documentation is technically correct, (for a suitable definition of “true” differing from its meaning in SQL), this seems to be a useful behavior worthy of exposure. I suggest the rewording, “returns 2 if the coordinate X,Y is inside polygon P, 1 if on the boundary, or 0 otherwise.” I submit that this might help avoid errors such as “… WHERE geopoly_contains_point(_shape, ptX, ptY) = TRUE”, which will produce surprise for those who read the present claim literally. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] function named geopolyCosine is a misnomer
On 12/1/18, John G wrote: > Is there any documentation on the > geopoly extension? > https://www.sqlite.org/search?s=d=geopoly https://www.sqlite.org/geopoly.html -- 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
Re: [sqlite] function named geopolyCosine is a misnomer
If I missed i tin earlier posts, sorry. Is there any documentation on the geopoly extension? With possible uses or examples? John On Thu, 29 Nov 2018 at 14:39, Richard Hipp wrote: > On 11/29/18, Thomas Kurz wrote: > > Could it be that the one angle is north-based, the other one east-based? > > Ha Ha. No, Graham is right. I started out writing a Cosine function, > then I switched it over to be a Sine function but failed to change the > name. A rename has now been committed to trunk, is in the latest > "prerelease snapshot", and will appear in the next official release > (which will also be the first official release that includes the new > capability). > > -- > 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-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sqlite3_exec()
On 1 Dec 2018, at 1:50pm, Prajeesh Prakash wrote: > I have two thread one is for reading and other is for writing the DB. Both > thread have the same DB connection One connection can only execute one operation at one time. If you want simultaneous operations, use two connections. Simon. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] sqlite3_exec()
Hi Team, Is this sqlite3_exec() function is a blocking call in the case of writing.I have two thread one is for reading and other is for writing the DB. Both thread have the same DB connection(Of course i am in FULLMUTEX mode and sqlite point of few there is no multiple thread every thing is serialized). Reader thread starts first and continuously reading 500 records from a table (I kept the sqlite3_exec() function call inside a loop for continues reading ie, on one iteration it will print 500 records and it is printing successfully using callback function). After 1sec of delay writer thread starts its execution and tries to write 500 records into the same table,Because of the small loop iteration gap in the reader thread the writer will get a chance to update the table hence my reader thread is blocked may be the mutex on the sqlite3* is acquired by the writer thread. After around 45 sec reader start its operation but one thing i observed is that the newly added entry is not printing instead of that old data is printing so i increased the reader thread looping iteration. After few iteration is over the newly added records also printing along with the old data. Why this delay is happening? (even though the writer thread is not coming out from the sqlite3_exec which i used to write the data but after a few sec its came out at that time onward i am getting the updated data). Along with the INSERT sql statement i am not using any BEGIN TRANSACTION and COMMIT. Please give a suggestion for this. Thank you ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users