On Thu, Oct 31, 2019 at 9:52 AM Keith Medcalf <kmedc...@dessus.com> wrote:
> On Thursday, 31 October, 2019 07:17, Jeffrey Walton <noloa...@gmail.com> 
> wrote:
> ...
> >    /* negative for days in the past */
> >    int days = 120;
> >    days = -days;
>
> >    const char DELETE_STMT[] = "DELETE from blacklist " \
> >        "WHERE dtime < datetime('now', '? days');";
>
> This statement contains no parameter.  You have a string constant with a ? 
> character inside the string.  Parameters go outside of constants, not inside 
> them.  Perhaps try something like this (which will work only if days is 
> negative):
>
>     const char DELETE_STMT[] = "DELETE from blacklist " \
>         "WHERE dtime < datetime('now', ? || ' days');";

Perfect, thanks.

That information may make good reading at
https://www.sqlite.org/lang_datefunc.html . I would never have figured
out the syntax on my own.

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

Reply via email to