Search notes:
jq --arg
jq --arg nam val
assigns the value
val
to the variable
nam
. The variable can then be referred to in the
jq
program as
$nam
.
The arguments passed with --arg
are interpreted as strings:
$ jq --arg num1 40 --arg num2 2 -n '$num1 + $num2'
"402"
In order to convert them to a number the
tonumber
operator can be used:
$ jq --arg num1 40 --arg num2 2 -n '($num1 | tonumber) + ($num2 | tonumber)'
Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78
Stack trace:
#0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array)
#1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1740420286, '3.141.14.210', 'Mozilla/5.0 App...', NULL)
#2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/JavaScript/JSON/tools/jq/options/arg(40): insert_webrequest()
#3 {main}
thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78