Re: [sqlite] Fossil Feature Request

2018-03-30 Thread Graham Holden
Just adding "?ln" seems to add line numbers:
https://www.sqlite.org/src/artifact/810fbfebe12359f1?ln
Sent from my Samsung Galaxy S7 - powered by Three
 Original message From: J Decker  Date: 
30/03/2018  20:48  (GMT+00:00) To: SQLite mailing list 
 Subject: Re: [sqlite] Fossil Feature 
Request 
On Fri, Mar 30, 2018 at 12:46 PM, Richard Hipp  wrote:

> On 3/30/18, J Decker  wrote:
> >  Sqlite's Fossile browser can't link line numbers...
> >
> >
> > Add ability to link to lines of source...
> >
> >
> > was trying to share this as another reference for getting UTF8 characters
> > from strings
> >
> > #define READ_UTF8(zIn, zTerm, c)
> > https://www.sqlite.org/src/artifact/810fbfebe12359f1
>
> Just add the "ln=155-165" query parameter.  Like this:
>
>   https://www.sqlite.org/src/artifact/810fbfebe12359f1?ln=155-165
>
>
Good to know for future reference - but there's no line numbers shown in
the first place


> --
> 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
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Fossil Feature Request

2018-03-30 Thread Kyle Shannon
On Fri, Mar 30, 2018 at 1:32 PM, J Decker  wrote:
>  Sqlite's Fossile browser can't link line numbers...
>
>
> Add ability to link to lines of source...
>
>
> was trying to share this as another reference for getting UTF8 characters
> from strings
>
> #define READ_UTF8(zIn, zTerm, c)
> https://www.sqlite.org/src/artifact/810fbfebe12359f1
>
> which is like line 155 and kinda hard to find... when sharing refernces
> from github I can select a line to share directly.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

I think what you want is already supported:

https://www.sqlite.org/src/artifact/810fbfebe12359f1?ln=155

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


Re: [sqlite] Fossil Feature Request

2018-03-30 Thread J Decker
On Fri, Mar 30, 2018 at 12:46 PM, Richard Hipp  wrote:

> On 3/30/18, J Decker  wrote:
> >  Sqlite's Fossile browser can't link line numbers...
> >
> >
> > Add ability to link to lines of source...
> >
> >
> > was trying to share this as another reference for getting UTF8 characters
> > from strings
> >
> > #define READ_UTF8(zIn, zTerm, c)
> > https://www.sqlite.org/src/artifact/810fbfebe12359f1
>
> Just add the "ln=155-165" query parameter.  Like this:
>
>   https://www.sqlite.org/src/artifact/810fbfebe12359f1?ln=155-165
>
>
Good to know for future reference - but there's no line numbers shown in
the first place


> --
> 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] Fossil Feature Request

2018-03-30 Thread Richard Hipp
On 3/30/18, J Decker  wrote:
>  Sqlite's Fossile browser can't link line numbers...
>
>
> Add ability to link to lines of source...
>
>
> was trying to share this as another reference for getting UTF8 characters
> from strings
>
> #define READ_UTF8(zIn, zTerm, c)
> https://www.sqlite.org/src/artifact/810fbfebe12359f1

Just add the "ln=155-165" query parameter.  Like this:

  https://www.sqlite.org/src/artifact/810fbfebe12359f1?ln=155-165

-- 
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] Fossil Feature Request

2018-03-30 Thread Scott Robison
On Fri, Mar 30, 2018 at 1:32 PM, J Decker  wrote:
>  Sqlite's Fossile browser can't link line numbers...
>
>
> Add ability to link to lines of source...
>
>
> was trying to share this as another reference for getting UTF8 characters
> from strings
>
> #define READ_UTF8(zIn, zTerm, c)
> https://www.sqlite.org/src/artifact/810fbfebe12359f1
>
> which is like line 155 and kinda hard to find... when sharing refernces
> from github I can select a line to share directly.

Try something like this:

http://www.fossil-scm.org/fossil/artifact/6eb26bb7a6?ln=1755-1759
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Fossil Feature Request

2018-03-30 Thread J Decker
 Sqlite's Fossile browser can't link line numbers...


Add ability to link to lines of source...


was trying to share this as another reference for getting UTF8 characters
from strings

#define READ_UTF8(zIn, zTerm, c)
https://www.sqlite.org/src/artifact/810fbfebe12359f1

which is like line 155 and kinda hard to find... when sharing refernces
from github I can select a line to share directly.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] MIN() and MAX() of set of row values

2018-03-30 Thread David Raymond
https://www.sqlite.org/rowvalue.html section 2.1 for ordering.


-Original Message-
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Simon Slavin
Sent: Friday, March 30, 2018 1:06 PM
To: SQLite mailing list
Subject: Re: [sqlite] MIN() and MAX() of set of row values

On 30 Mar 2018, at 6:04pm, Peter Da Silva  wrote:

> On 3/30/18, 11:58 AM, "sqlite-users on behalf of Simon Slavin" 
>  slav...@bigfraud.org> wrote:
>> can think of to do it is to devise a metric to turn a pair (a, b) into one 
>> number.
> 
> Problem is you can't uniquely order pairs of points. Is (1, 2) greater or 
> lesser than (2, 1)?

That's up to you.  That's why you are devising the metric.  Maybe the metric is 
just score == a + b .

Simon.
___
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] MIN() and MAX() of set of row values

2018-03-30 Thread Igor Tandetnik

On 3/30/2018 1:04 PM, Peter Da Silva wrote:

On 3/30/18, 11:58 AM, "sqlite-users on behalf of Simon Slavin" 
 wrote:

can think of to do it is to devise a metric to turn a pair (a, b) into one 
number.


Problem is you can't uniquely order pairs of points.


Yes you can.


Is (1, 2) greater or lesser than (2, 1)?


"select (1, 2) < (2, 1)" says lesser.

For further discussion, see 
https://www.sqlite.org/rowvalue.html#row_value_comparisons
--
Igor Tandetnik


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


Re: [sqlite] MIN() and MAX() of set of row values

2018-03-30 Thread David Raymond
Why not something simpler, like

select * from T order by a, b limit 1; --for the min,

select * from T order by a desc, b desc limit 1; --for the max?

select (select a, b from T order by a, b limit 1) = (1, 2) as ok;


-Original Message-
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Mark Brand
Sent: Friday, March 30, 2018 10:48 AM
To: SQLite mailing list
Subject: [sqlite] MIN() and MAX() of set of row values

Hi,

Row values make life easier in so many ways, but I was just wondering if 
there is (or should be or could be) a way to use aggregate MIN() and 
MAX() on a set of row values.

Mark

CREATE TABLE T (a, b);
INSERT INTO T (a, b) VALUES (1, 2), (1, 3), (2, 3);

SELECT MIN((a,b)) = (1, 2) ok  FROM T;
--Error: near line 4: row value misused

SELECT MIN((SELECT a, b)) = (1, 2) ok  FROM T;
--Error: near line 7: row value misused

SELECT (1, 2) = MIN(SELECT a, b FROM T);
--Error: near line 10: near "SELECT": syntax error

--ok
SELECT T.*
FROM T
LEFT JOIN T S
   ON (S.a, S.b) < (T.a, T.b)
WHERE S.a IS NULL;

--ok
SELECT (T.a, T.b) = (1, 2) ok
FROM T
LEFT JOIN T S
   ON (S.a, S.b) < (T.a, T.b)
WHERE S.a IS NULL;

___
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] MIN() and MAX() of set of row values

2018-03-30 Thread Simon Slavin
On 30 Mar 2018, at 6:04pm, Peter Da Silva  wrote:

> On 3/30/18, 11:58 AM, "sqlite-users on behalf of Simon Slavin" 
>  slav...@bigfraud.org> wrote:
>> can think of to do it is to devise a metric to turn a pair (a, b) into one 
>> number.
> 
> Problem is you can't uniquely order pairs of points. Is (1, 2) greater or 
> lesser than (2, 1)?

That's up to you.  That's why you are devising the metric.  Maybe the metric is 
just score == a + b .

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


Re: [sqlite] MIN() and MAX() of set of row values

2018-03-30 Thread Peter Da Silva
On 3/30/18, 11:58 AM, "sqlite-users on behalf of Simon Slavin" 
 wrote:
> can think of to do it is to devise a metric to turn a pair (a, b) into one 
> number.

Problem is you can't uniquely order pairs of points. Is (1, 2) greater or 
lesser than (2, 1)?

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


Re: [sqlite] MIN() and MAX() of set of row values

2018-03-30 Thread Simon Slavin
On 30 Mar 2018, at 5:55pm, Igor Tandetnik  wrote:

> I don't think that's what the OP had in mind. They didn't want the smaller of 
> a and b for each row, but rather the lexicographically smallest (a, b) pair 
> among all rows.
> 
> Row values support less-than comparison, so it kind of makes sense to expect 
> MIN to work on them, too.

Ah.  Okay, I get it.

The only way I can think of to do it is to devise a metric to turn a pair (a, 
b) into one number.

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


Re: [sqlite] MIN() and MAX() of set of row values

2018-03-30 Thread Igor Tandetnik

On 3/30/2018 12:10 PM, Simon Slavin wrote:

On 30 Mar 2018, at 3:48pm, Mark Brand  wrote:


SELECT MIN((a,b)) = (1, 2) ok  FROM T;
--Error: near line 4: row value misused

SELECT MIN((SELECT a, b)) = (1, 2) ok  FROM T;
--Error: near line 7: row value misused

SELECT (1, 2) = MIN(SELECT a, b FROM T);
--Error: near line 10: near "SELECT": syntax error


You got very close to the right syntax.

SQLite version 3.19.3 2017-06-27 16:48:08
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE T (a, b);
sqlite> INSERT INTO T (a, b) VALUES (1, 2), (1, 3), (2, 3);
sqlite> SELECT min(a,b) FROM T;
1
1
2


I don't think that's what the OP had in mind. They didn't want the smaller of a 
and b for each row, but rather the lexicographically smallest (a, b) pair among 
all rows.

Row values support less-than comparison, so it kind of makes sense to expect 
MIN to work on them, too.
--
Igor Tandetnik


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


Re: [sqlite] MIN() and MAX() of set of row values

2018-03-30 Thread Simon Slavin
On 30 Mar 2018, at 3:48pm, Mark Brand  wrote:

> SELECT MIN((a,b)) = (1, 2) ok  FROM T;
> --Error: near line 4: row value misused
> 
> SELECT MIN((SELECT a, b)) = (1, 2) ok  FROM T;
> --Error: near line 7: row value misused
> 
> SELECT (1, 2) = MIN(SELECT a, b FROM T);
> --Error: near line 10: near "SELECT": syntax error

You got very close to the right syntax.

SQLite version 3.19.3 2017-06-27 16:48:08
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE T (a, b);
sqlite> INSERT INTO T (a, b) VALUES (1, 2), (1, 3), (2, 3);
sqlite> SELECT min(a,b) FROM T;
1
1
2

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


Re: [sqlite] sqlite3_column_decltype and affinity

2018-03-30 Thread Simon Slavin
On 30 Mar 2018, at 11:22am, Eric Grange  wrote:

> Is there a way to have sqlite3_column_decltype return the affinity for an
> expression ?

You may be referring to

sqlite3_column_type()

which can be applied to columns returned by a query even if that column is an 
expression.  But if you want to do it accurately for every row it can't be done 
at the column level, because an expression has a datatype and not an affinity, 
and different rows of the same expression might have a different type:

SELECT month,
   CASE weekday
   WHEN 6 THEN 'weekend'
   WHEN 7 THEN 'weekend'
   ELSE weekday
   END
   FROM deliverydates;

To handle that properly I think you'd have to call sqlite3_value_type() for 
each value returned.

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


Re: [sqlite] Fixes to the transliteration table in ext/misc/spellfix.c

2018-03-30 Thread Ian Zimmerman
On 2018-03-30 11:28, Marcin Ciura wrote:

>   { 0x0426,  0x54, 0x63, 0x00, 0x00 },  /* Ц to Tc */
>   { 0x0446,  0x74, 0x63, 0x00, 0x00 },  /* ц to tc */
> 
> This Cyrillic letter is usually transliterated as Ts.  Unless "Tc" is
> a hack meant to cover both "Ts" and the rarer transliteration "C", it
> looks like a typo: https://en.wikipedia.org/wiki/Tse_(Cyrillic)

Also often as "Cz".  Unfortunately :-P

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] MIN() and MAX() of set of row values

2018-03-30 Thread Mark Brand

Hi,

Row values make life easier in so many ways, but I was just wondering if 
there is (or should be or could be) a way to use aggregate MIN() and 
MAX() on a set of row values.


Mark

CREATE TABLE T (a, b);
INSERT INTO T (a, b) VALUES (1, 2), (1, 3), (2, 3);

SELECT MIN((a,b)) = (1, 2) ok  FROM T;
--Error: near line 4: row value misused

SELECT MIN((SELECT a, b)) = (1, 2) ok  FROM T;
--Error: near line 7: row value misused

SELECT (1, 2) = MIN(SELECT a, b FROM T);
--Error: near line 10: near "SELECT": syntax error

--ok
SELECT T.*
FROM T
LEFT JOIN T S
  ON (S.a, S.b) < (T.a, T.b)
WHERE S.a IS NULL;

--ok
SELECT (T.a, T.b) = (1, 2) ok
FROM T
LEFT JOIN T S
  ON (S.a, S.b) < (T.a, T.b)
WHERE S.a IS NULL;

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


[sqlite] sqlite3_column_decltype and affinity

2018-03-30 Thread Eric Grange
Hi,

Is there a way to have sqlite3_column_decltype return the affinity for an
expression ?

https://www.sqlite.org/datatype3.html#affinity_of_expressions

states that a CAST can be used to specify the affinity of a column, however
sqlite3_column_decltype does not report that affinity, as is documented in

https://www.sqlite.org/c3ref/column_decltype.html

I would like to have the affinity for purposes of presenting the results of
an SQL query (for column display width etc.).
Thanks!

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


[sqlite] Fixes to the transliteration table in ext/misc/spellfix.c

2018-03-30 Thread Marcin Ciura
In http://www.sqlite.org/src/artifact/b3a644285cb008f3:

  { 0x0392,  0x42, 0x00, 0x00, 0x00 },  /* Β to B */
  { 0x03B2,  0x62, 0x00, 0x00, 0x00 },  /* β to b */

Although Ancient Greek beta is rendered as B, Modern Greek beta is
transliterated as V:
https://en.wikipedia.org/wiki/Romanization_of_Greek#Modern_Greek

  { 0x040B,  0x44, 0x00, 0x00, 0x00 },  /* Ћ to D */
  { 0x045B,  0x64, 0x00, 0x00, 0x00 },  /* ћ to d */

This Serbian letter corresponds to Croatian Ć, so it should be
transliterated as C: https://en.wikipedia.org/wiki/Tshe

  { 0x0409,  0x49, 0x00, 0x00, 0x00 },  /* Љ to I */
  { 0x0459,  0x69, 0x00, 0x00, 0x00 },  /* љ to i */

This Serbian letter corresponds to the Croatian digraph Lj, so it should be
transliterated as L (probably not Lj for consistency with Њ transliterated
as N): https://en.wikipedia.org/wiki/Lje

  { 0x0426,  0x54, 0x63, 0x00, 0x00 },  /* Ц to Tc */
  { 0x0446,  0x74, 0x63, 0x00, 0x00 },  /* ц to tc */

This Cyrillic letter is usually transliterated as Ts.  Unless "Tc" is a
hack meant to cover both "Ts" and the rarer transliteration "C", it looks
like a typo: https://en.wikipedia.org/wiki/Tse_(Cyrillic)

Best regards,
Marcin Ciura
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users