Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Any sufficiently advanced technology is indistinguishable from magic. -- Arthur C. Clarke


devel / comp.lang.tcl / Setting a variable stops a SQL query

SubjectAuthor
* Setting a variable stops a SQL queryCecil Westerhof
`* Setting a variable stops a SQL querygreg
 `* Setting a variable stops a SQL queryCecil Westerhof
  `* Setting a variable stops a SQL queryheinrichmartin
   `- Setting a variable stops a SQL querygreg

1
Setting a variable stops a SQL query

<877cmnw48d.fsf@munus.decebal.nl>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12780&group=comp.lang.tcl#12780

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.lang.tcl
Subject: Setting a variable stops a SQL query
Date: Sun, 12 Nov 2023 13:22:42 +0100
Organization: Decebal Computing
Lines: 71
Message-ID: <877cmnw48d.fsf@munus.decebal.nl>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="6a61c7dbe6d78e723411f78a7f16a77e";
logging-data="107996"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CBoRCB1TrTHpSSJ8Ho61OcbsJp51LixM="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:jT31msUP/ANH2/IZ5CqtY00kgbI=
sha1:dPUz0K7ZhkWcUsbs5WcTjeiU2A4=
 by: Cecil Westerhof - Sun, 12 Nov 2023 12:22 UTC

I have the following code:
set getFirstAndLast {
SELECT MIN(WeekNo) AS FirstWeek
, MAX(WeekNo) AS LastWeek
FROM (
SELECT strftime('%W', dayDate, '+1 day') AS WeekNo
, COUNT(dayViews) AS Days
FROM dayViews
GROUP BY WeekNo
)
WHERE Days = 7
}
set selectWeek {
SELECT strftime('%W', dayDate, '+1 day') AS WeekNo
, COUNT(*) AS Days
, SUM(dayViews) AS WeekTotals
FROM dayViews
WHERE WeekNo >= :startWeek
AND WeekNo <= :endWeek
GROUP BY WeekNo
ORDER BY WeekNo
}

sqlite3 db ~/Databases/youtube.sqlite
db eval ${getFirstAndLast} {
set startWeek ${FirstWeek}
set endWeek ${LastWeek}
# set nrOfWeeks [expr { 1 + $endWeek - $startWeek }]
# puts ${nrOfWeeks}i
puts "Start with week ${FirstWeek} and en with week ${LastWeek}"
}
db eval ${selectWeek} {
if { ${Days} != 7 } {
puts "ERROR: week ${WeekNo} has ${Days} days"
}
puts [format "Week %2s has %4s views" ${WeekNo} ${WeekTotals}]
lappend viewsArr ${WeekTotals}
lappend weekArr ${WeekNo}
}
db close
puts "Got here"

When I run this I get:
Start with week 38 and en with week 45
Week 38 has 160 views
Week 39 has 92 views
Week 40 has 134 views
Week 41 has 200 views
Week 42 has 241 views
Week 43 has 241 views
Week 44 has 664 views
Week 45 has 416 views
Got here

When I uncomment the two statements in the first 'db eval' I get:
8i
Start with week 38 and en with week 45
Got here

So the set works and does not corrupt startWeek, or endWeek, bor does
it terminate the program.
But it ruins the second 'db eval'.
What could be happening here?
Even when I set nrOfWeeks2 instead of nrOfWeeks, I have the same
problem.

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Re: Setting a variable stops a SQL query

<81bf551d-0bc0-4949-899d-b7c9019df46fn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12782&group=comp.lang.tcl#12782

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:1813:b0:41e:73b4:b901 with SMTP id t19-20020a05622a181300b0041e73b4b901mr133985qtc.0.1699827016034;
Sun, 12 Nov 2023 14:10:16 -0800 (PST)
X-Received: by 2002:a17:902:f7c1:b0:1cc:335b:c923 with SMTP id
h1-20020a170902f7c100b001cc335bc923mr1494998plw.2.1699827015348; Sun, 12 Nov
2023 14:10:15 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Sun, 12 Nov 2023 14:10:14 -0800 (PST)
In-Reply-To: <877cmnw48d.fsf@munus.decebal.nl>
Injection-Info: google-groups.googlegroups.com; posting-host=185.250.212.124; posting-account=99ziWAoAAADLScDbI_CyfIcpa_gFZ0zh
NNTP-Posting-Host: 185.250.212.124
References: <877cmnw48d.fsf@munus.decebal.nl>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <81bf551d-0bc0-4949-899d-b7c9019df46fn@googlegroups.com>
Subject: Re: Setting a variable stops a SQL query
From: gregor.ebbing@googlemail.com (greg)
Injection-Date: Sun, 12 Nov 2023 22:10:16 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3772
 by: greg - Sun, 12 Nov 2023 22:10 UTC

Cecil Westerhof schrieb am Sonntag, 12. November 2023 um 13:28:09 UTC+1:
> I have the following code:
> set getFirstAndLast {
> SELECT MIN(WeekNo) AS FirstWeek
> , MAX(WeekNo) AS LastWeek
> FROM (
> SELECT strftime('%W', dayDate, '+1 day') AS WeekNo
> , COUNT(dayViews) AS Days
> FROM dayViews
> GROUP BY WeekNo
> )
> WHERE Days = 7
> }
> set selectWeek {
> SELECT strftime('%W', dayDate, '+1 day') AS WeekNo
> , COUNT(*) AS Days
> , SUM(dayViews) AS WeekTotals
> FROM dayViews
> WHERE WeekNo >= :startWeek
> AND WeekNo <= :endWeek
> GROUP BY WeekNo
> ORDER BY WeekNo
> }
>
>
> sqlite3 db ~/Databases/youtube.sqlite
> db eval ${getFirstAndLast} {
> set startWeek ${FirstWeek}
> set endWeek ${LastWeek}
> # set nrOfWeeks [expr { 1 + $endWeek - $startWeek }]
> # puts ${nrOfWeeks}i
> puts "Start with week ${FirstWeek} and en with week ${LastWeek}"
> }
> db eval ${selectWeek} {
> if { ${Days} != 7 } {
> puts "ERROR: week ${WeekNo} has ${Days} days"
> }
> puts [format "Week %2s has %4s views" ${WeekNo} ${WeekTotals}]
> lappend viewsArr ${WeekTotals}
> lappend weekArr ${WeekNo}
> }
> db close
> puts "Got here"
>
> When I run this I get:
> Start with week 38 and en with week 45
> Week 38 has 160 views
> Week 39 has 92 views
> Week 40 has 134 views
> Week 41 has 200 views
> Week 42 has 241 views
> Week 43 has 241 views
> Week 44 has 664 views
> Week 45 has 416 views
> Got here
>
> When I uncomment the two statements in the first 'db eval' I get:
> 8i
> Start with week 38 and en with week 45
> Got here
>
> So the set works and does not corrupt startWeek, or endWeek, bor does
> it terminate the program.
> But it ruins the second 'db eval'.
> What could be happening here?
> Even when I set nrOfWeeks2 instead of nrOfWeeks, I have the same
> problem.
>
> --
> Cecil Westerhof
> Senior Software Engineer
> LinkedIn: http://www.linkedin.com/in/cecilwesterhof

expr change in {} the variable type, not in ()

in the second select:
from
https://www.sqlite.org/lang_datefunc.html
Their strftime() equivalents return a string that is the text representation of the corresponding number.
....
WHERE WeekNo >= ':startWeek'
AND WeekNo <= ':endWeek'

or

in the first 'db eval'.

puts "[tcl::unsupported::representation $endWeek]"
#int
set nrOfWeeks [expr { 1 + $endWeek - $startWeek }]

#string
#set nrOfWeeks [expr ( 1 + $endWeek - $startWeek )]
puts "[tcl::unsupported::representation $endWeek]"
# puts ${nrOfWeeks}i

Re: Setting a variable stops a SQL query

<87il65vlf8.fsf@munus.decebal.nl>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12783&group=comp.lang.tcl#12783

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.lang.tcl
Subject: Re: Setting a variable stops a SQL query
Date: Mon, 13 Nov 2023 14:21:15 +0100
Organization: Decebal Computing
Lines: 113
Message-ID: <87il65vlf8.fsf@munus.decebal.nl>
References: <877cmnw48d.fsf@munus.decebal.nl>
<81bf551d-0bc0-4949-899d-b7c9019df46fn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="c4c240e33310d29a9bc3a1267bb39f6f";
logging-data="713384"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19PliepOGUyRdt4VbnRZfhl53+vxSPO9LA="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:GrSGHF8Fz4AhCbqaoB0SSRAxdPI=
sha1:f6DfT50zGBGnZ+xeiYQIMKlO7M0=
 by: Cecil Westerhof - Mon, 13 Nov 2023 13:21 UTC

greg <gregor.ebbing@googlemail.com> writes:

> Cecil Westerhof schrieb am Sonntag, 12. November 2023 um 13:28:09 UTC+1:
>> I have the following code:
>> set getFirstAndLast {
>> SELECT MIN(WeekNo) AS FirstWeek
>> , MAX(WeekNo) AS LastWeek
>> FROM (
>> SELECT strftime('%W', dayDate, '+1 day') AS WeekNo
>> , COUNT(dayViews) AS Days
>> FROM dayViews
>> GROUP BY WeekNo
>> )
>> WHERE Days = 7
>> }
>> set selectWeek {
>> SELECT strftime('%W', dayDate, '+1 day') AS WeekNo
>> , COUNT(*) AS Days
>> , SUM(dayViews) AS WeekTotals
>> FROM dayViews
>> WHERE WeekNo >= :startWeek
>> AND WeekNo <= :endWeek
>> GROUP BY WeekNo
>> ORDER BY WeekNo
>> }
>>
>>
>> sqlite3 db ~/Databases/youtube.sqlite
>> db eval ${getFirstAndLast} {
>> set startWeek ${FirstWeek}
>> set endWeek ${LastWeek}
>> # set nrOfWeeks [expr { 1 + $endWeek - $startWeek }]
>> # puts ${nrOfWeeks}i
>> puts "Start with week ${FirstWeek} and en with week ${LastWeek}"
>> }
>> db eval ${selectWeek} {
>> if { ${Days} != 7 } {
>> puts "ERROR: week ${WeekNo} has ${Days} days"
>> }
>> puts [format "Week %2s has %4s views" ${WeekNo} ${WeekTotals}]
>> lappend viewsArr ${WeekTotals}
>> lappend weekArr ${WeekNo}
>> }
>> db close
>> puts "Got here"
>>
>> When I run this I get:
>> Start with week 38 and en with week 45
>> Week 38 has 160 views
>> Week 39 has 92 views
>> Week 40 has 134 views
>> Week 41 has 200 views
>> Week 42 has 241 views
>> Week 43 has 241 views
>> Week 44 has 664 views
>> Week 45 has 416 views
>> Got here
>>
>> When I uncomment the two statements in the first 'db eval' I get:
>> 8i
>> Start with week 38 and en with week 45
>> Got here
>>
>> So the set works and does not corrupt startWeek, or endWeek, bor does
>> it terminate the program.
>> But it ruins the second 'db eval'.
>> What could be happening here?
>> Even when I set nrOfWeeks2 instead of nrOfWeeks, I have the same
>> problem.
>>
>> --
>> Cecil Westerhof
>> Senior Software Engineer
>> LinkedIn: http://www.linkedin.com/in/cecilwesterhof
>
>
> expr change in {} the variable type, not in ()
>
>
>
> in the second select:
> from
> https://www.sqlite.org/lang_datefunc.html
> Their strftime() equivalents return a string that is the text
> representation of the corresponding number.
> ...
> WHERE WeekNo >= ':startWeek'
> AND WeekNo <= ':endWeek'
>
>
> or
>
> in the first 'db eval'.
>
>
> puts "[tcl::unsupported::representation $endWeek]"
> #int
> set nrOfWeeks [expr { 1 + $endWeek - $startWeek }]
>
> #string
> #set nrOfWeeks [expr ( 1 + $endWeek - $startWeek )]
> puts "[tcl::unsupported::representation $endWeek]"
> # puts ${nrOfWeeks}i

It works, but I find it strange for two reasons:
- I was always told that what is given to expr should be between '{'
and '}'.
- I would not expect that expr would change the input parameters.

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Re: Setting a variable stops a SQL query

<bce10d88-cbf4-4168-b3ec-a427807c1608n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12784&group=comp.lang.tcl#12784

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:8e0c:b0:775:cf45:a4ff with SMTP id re12-20020a05620a8e0c00b00775cf45a4ffmr12434qkn.6.1699913305947;
Mon, 13 Nov 2023 14:08:25 -0800 (PST)
X-Received: by 2002:a17:902:ea11:b0:1cc:237c:7885 with SMTP id
s17-20020a170902ea1100b001cc237c7885mr125569plg.6.1699913305175; Mon, 13 Nov
2023 14:08:25 -0800 (PST)
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Mon, 13 Nov 2023 14:08:24 -0800 (PST)
In-Reply-To: <87il65vlf8.fsf@munus.decebal.nl>
Injection-Info: google-groups.googlegroups.com; posting-host=84.115.226.19; posting-account=Od2xOAoAAACEyRX3Iu5rYt4oevuoeYUG
NNTP-Posting-Host: 84.115.226.19
References: <877cmnw48d.fsf@munus.decebal.nl> <81bf551d-0bc0-4949-899d-b7c9019df46fn@googlegroups.com>
<87il65vlf8.fsf@munus.decebal.nl>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bce10d88-cbf4-4168-b3ec-a427807c1608n@googlegroups.com>
Subject: Re: Setting a variable stops a SQL query
From: martin.heinrich@frequentis.com (heinrichmartin)
Injection-Date: Mon, 13 Nov 2023 22:08:25 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 8655
 by: heinrichmartin - Mon, 13 Nov 2023 22:08 UTC

On Monday, November 13, 2023 at 2:28:08 PM UTC+1, Cecil Westerhof wrote:
> greg writes:
>
> > Cecil Westerhof schrieb am Sonntag, 12. November 2023 um 13:28:09 UTC+1:
> >> I have the following code:
> >> set getFirstAndLast {
> >> SELECT MIN(WeekNo) AS FirstWeek
> >> , MAX(WeekNo) AS LastWeek
> >> FROM (
> >> SELECT strftime('%W', dayDate, '+1 day') AS WeekNo
> >> , COUNT(dayViews) AS Days
> >> FROM dayViews
> >> GROUP BY WeekNo
> >> )
> >> WHERE Days = 7
> >> }
> >> set selectWeek {
> >> SELECT strftime('%W', dayDate, '+1 day') AS WeekNo
> >> , COUNT(*) AS Days
> >> , SUM(dayViews) AS WeekTotals
> >> FROM dayViews
> >> WHERE WeekNo >= :startWeek
> >> AND WeekNo <= :endWeek
> >> GROUP BY WeekNo
> >> ORDER BY WeekNo
> >> }
> >>
> >>
> >> sqlite3 db ~/Databases/youtube.sqlite
> >> db eval ${getFirstAndLast} {
> >> set startWeek ${FirstWeek}
> >> set endWeek ${LastWeek}
> >> # set nrOfWeeks [expr { 1 + $endWeek - $startWeek }]
> >> # puts ${nrOfWeeks}i
> >> puts "Start with week ${FirstWeek} and en with week ${LastWeek}"
> >> }
> >> db eval ${selectWeek} {
> >> if { ${Days} != 7 } {
> >> puts "ERROR: week ${WeekNo} has ${Days} days"
> >> }
> >> puts [format "Week %2s has %4s views" ${WeekNo} ${WeekTotals}]
> >> lappend viewsArr ${WeekTotals}
> >> lappend weekArr ${WeekNo}
> >> }
> >> db close
> >> puts "Got here"
> >>
> >> When I run this I get:
> >> Start with week 38 and en with week 45
> >> Week 38 has 160 views
> >> Week 39 has 92 views
> >> Week 40 has 134 views
> >> Week 41 has 200 views
> >> Week 42 has 241 views
> >> Week 43 has 241 views
> >> Week 44 has 664 views
> >> Week 45 has 416 views
> >> Got here
> >>
> >> When I uncomment the two statements in the first 'db eval' I get:
> >> 8i
> >> Start with week 38 and en with week 45
> >> Got here
> >>
> >> So the set works and does not corrupt startWeek, or endWeek, bor does
> >> it terminate the program.
> >> But it ruins the second 'db eval'.
> >> What could be happening here?
> >> Even when I set nrOfWeeks2 instead of nrOfWeeks, I have the same
> >> problem.
> >>
> >> --
> >> Cecil Westerhof
> >> Senior Software Engineer
> >> LinkedIn: http://www.linkedin.com/in/cecilwesterhof
> >
> >
> > expr change in {} the variable type, not in ()
> >
> >
> >
> > in the second select:
> > from
> > https://www.sqlite.org/lang_datefunc.html
> > Their strftime() equivalents return a string that is the text
> > representation of the corresponding number.
> > ...
> > WHERE WeekNo >= ':startWeek'
> > AND WeekNo <= ':endWeek'

I did not test it, but are you telling SQL to compare strings here? That might introduce a data-dependent bug like '2' >= '10'.

> > or
> >
> > in the first 'db eval'.
> >
> >
> > puts "[tcl::unsupported::representation $endWeek]"
> > #int
> > set nrOfWeeks [expr { 1 + $endWeek - $startWeek }]
> >
> > #string
> > #set nrOfWeeks [expr ( 1 + $endWeek - $startWeek )]
> > puts "[tcl::unsupported::representation $endWeek]"
> > # puts ${nrOfWeeks}i
> It works, but I find it strange for two reasons:
> - I was always told that what is given to expr should be between '{'
> and '}'.

That still holds. expr should not shimmer, but it does in this case (actually evaluation of the arg _before_ the call to expr does). Compare these (first one with braces):

expect:~$ set i [expr 1]; puts [::tcl::unsupported::representation $i]; set ii [expr {$i+$i}]; puts [::tcl::unsupported::representation $i]
value is a int with a refcount of 2, object pointer at 0xbdbfa0, internal representation 0x1:0x1, no string representation
value is a int with a refcount of 2, object pointer at 0xbdbfa0, internal representation 0x1:0x1, no string representation
expect:~$ set i [expr 1]; puts [::tcl::unsupported::representation $i]; set ii [expr $i+$i]; puts [::tcl::unsupported::representation $i]
value is a int with a refcount of 2, object pointer at 0xb6d560, internal representation 0x1:0x1, no string representation
value is a int with a refcount of 2, object pointer at 0xb6d560, internal representation 0x1:0x1, string representation "1"

i has no string rep before expr.
When passing {$i+$i} to expr, expr will parse that constant string and read the int rep of i.
When passing $i+$i to expr, expr will actually see and parse 1+1, not i. The string rep of i is needed to subst $i in $i+$i.

> - I would not expect that expr would change the input parameters.

It does not, because EIAS in Tcl. I think the unexpected behavior happens in the SQL library, not Tcl. It seems that it relies on the (unsupported) representation, i.e. it behaves in a different way depending on the existence of a string rep. However, the existence of either representation is just for performance.

More remarks with examples below:
* Emphasizing that expr is _not_ the offending part, note that merely logging the number value would also produce a string rep. Expr can actually fix the string rep "problem", just like incr.
* The refcount of 2 in my examples most likely comes from the interactive session (e.g. command history). In such a session, it is also important to never return the object under investigation to the command line (or it will have a string rep!).

expect:~$ set i [expr 1]; puts [::tcl::unsupported::representation $i]; puts $i; puts [::tcl::unsupported::representation $i]; puts [::tcl::unsupported::representation [expr {$i}]]
value is a int with a refcount of 2, object pointer at 0xbdbf70, internal representation 0x1:0x1, no string representation
1 value is a int with a refcount of 2, object pointer at 0xbdbf70, internal representation 0x1:0x1, string representation "1"
value is a int with a refcount of 1, object pointer at 0xbdb1c0, internal representation 0x1:0x1, no string representation
expect:~$ set i [expr 1]; puts [::tcl::unsupported::representation $i]; puts $i; puts [::tcl::unsupported::representation $i]; set i [expr {$i}]; puts [::tcl::unsupported::representation $i]
value is a int with a refcount of 2, object pointer at 0xbdc5a0, internal representation 0x1:0x1, no string representation
1 value is a int with a refcount of 2, object pointer at 0xbdc5a0, internal representation 0x1:0x1, string representation "1"
value is a int with a refcount of 2, object pointer at 0xbdbf70, internal representation 0x1:0x1, no string representation
expect:~$ set i [expr 1]; puts [::tcl::unsupported::representation $i]; puts $i
value is a int with a refcount of 2, object pointer at 0xb95a90, internal representation 0x1:0x1, no string representation
1 expect:~$ puts [::tcl::unsupported::representation $i]
value is a int with a refcount of 2, object pointer at 0xb95a90, internal representation 0x1:0x1, string representation "1"
expect:~$ incr i 0; puts [::tcl::unsupported::representation $i]
value is a int with a refcount of 2, object pointer at 0xb95a90, internal representation 0x1:0x1, no string representation

Re: Setting a variable stops a SQL query

<b8fed460-25e0-4fef-b516-ed7781c61e81n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12785&group=comp.lang.tcl#12785

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:20d9:b0:77b:e884:388b with SMTP id f25-20020a05620a20d900b0077be884388bmr28269qka.4.1699946048797; Mon, 13 Nov 2023 23:14:08 -0800 (PST)
X-Received: by 2002:a63:4620:0:b0:5bd:d918:12ed with SMTP id t32-20020a634620000000b005bdd91812edmr339464pga.9.1699946048485; Mon, 13 Nov 2023 23:14:08 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!69.80.99.11.MISMATCH!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Mon, 13 Nov 2023 23:14:07 -0800 (PST)
In-Reply-To: <bce10d88-cbf4-4168-b3ec-a427807c1608n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=185.250.212.44; posting-account=99ziWAoAAADLScDbI_CyfIcpa_gFZ0zh
NNTP-Posting-Host: 185.250.212.44
References: <877cmnw48d.fsf@munus.decebal.nl> <81bf551d-0bc0-4949-899d-b7c9019df46fn@googlegroups.com> <87il65vlf8.fsf@munus.decebal.nl> <bce10d88-cbf4-4168-b3ec-a427807c1608n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b8fed460-25e0-4fef-b516-ed7781c61e81n@googlegroups.com>
Subject: Re: Setting a variable stops a SQL query
From: gregor.ebbing@googlemail.com (greg)
Injection-Date: Tue, 14 Nov 2023 07:14:08 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 10
 by: greg - Tue, 14 Nov 2023 07:14 UTC

heinrichmartin schrieb am Montag, 13. November 2023 um 23:08:28 UTC+1:

> > > ...
> > > WHERE WeekNo >= ':startWeek'
> > > AND WeekNo <= ':endWeek'
> I did not test it, but are you telling SQL to compare strings here? That might introduce a data-dependent bug like '2' >= '10'.

True, that was a bad solution on my part.
This is how it could work:

cast(strftime('%W', dayDate, '+1 day') as integer)

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor