in reply to DBI and JSON fields
When debugging SQL statements, do yourself a favour and print out the SQL statements before you run them:
my $sql = "SELECT COUNT(*) FROM Person WHERE Account_idAccount = 35 AN +D JSON_EXISTS(custom, '$.test3')"); say "Running <<$sql>>"; my $res = $dbh->selectrow_array($sql); ...
Also, it seems to me that you are not using strict or your code would not compile at all. Please do use strict to catch errors where you erroneously don't quote strings.
Most likely you wanted code like the following:
my $sql = <<'SQL'; SELECT COUNT(*) FROM Person WHERE Account_idAccount = 35 AND JSON_ +EXISTS(custom, '$.test3') SQL ...
Update: While using strict is nice, it will not catch using $., as that is a valid Perl variable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DBI and JSON fields
by Bod (Parson) on Mar 12, 2024 at 14:01 UTC | |
by Corion (Patriarch) on Mar 12, 2024 at 14:11 UTC | |
by Bod (Parson) on Mar 12, 2024 at 23:28 UTC | |
by stevieb (Canon) on Mar 13, 2024 at 08:09 UTC | |
by soonix (Chancellor) on Mar 13, 2024 at 07:49 UTC | |
by stevieb (Canon) on Mar 13, 2024 at 08:16 UTC | |
by Bod (Parson) on Mar 18, 2024 at 21:43 UTC |