SQLite Forum

SQLite3 shell doing math operation on parameter substitution
Login
Not a bug.

The command that is giving you trouble is this line:

> ~~~
.parameter set @contact     '+66-2-615-3964'
~~~

The single-quotes on the argument are being stripped off by the CLI itself,
leaving @contact with the value as a bare +66-2-615-3964.  This gets evaluated
to -4515, as you observe.  You work-around is to bind @contact to a quoted
string instead:

> ~~~
.parameter set @contact     "'+66-2-615-3964'"
~~~

The prior line of the form:

> ~~~
.parameter set @ip          '184.82.96.0/19'
~~~

Works because the bare string 194.82.96.0/19 is a syntax error, and after
seeing that syntax error, the CLI tries putting the string inside of quotes
to see if that works better, and it does.  But +66-2-615-3964 is not a
syntax error, so it never gets quoted.

You are correct that the details of this behavior are not documented.
You might even argue that they are unintuitive.  But the behavior is
as originally intended.

Perhaps we need to invent an easier way for shell scripts to get parameter
values into the CLI.