Skip to content

Commit

Permalink
document disabling of double quoted string literals, fix examples (re…
Browse files Browse the repository at this point in the history
…solves #15)
  • Loading branch information
Grinnz committed Jul 22, 2020
1 parent 884b579 commit 9b4101e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
used.
- Newly created mojo_migrations tables from Mojo::SQLite::Migrations will use
a primary key.
- Allow -json parameters in queries.
- Recognize -json parameters in queries.

3.003 2019-10-01 15:49:43 EDT
- Increase DBD::SQLite dependency to 1.64 to support configuring
Expand Down
9 changes: 7 additions & 2 deletions lib/Mojo/SQLite.pm
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ gracefully by holding on to them only for short amounts of time.
get '/' => sub {
my $c = shift;
my $db = $c->sqlite->db;
$c->render(json => $db->query('select datetime("now","localtime") as now')->hash);
$c->render(json => $db->query(q{select datetime('now','localtime') as now})->hash);
};
app->start;
Expand All @@ -233,9 +233,14 @@ L<DBD::SQLite/"journal_mode"> for more information.
# Performed concurrently
my $pid = fork || die $!;
say $sql->db->query('select datetime("now","localtime") as time')->hash->{time};
say $sql->db->query(q{select datetime('now','localtime') as time})->hash->{time};
exit unless $pid;
The L<double-quoted string literal misfeature
|https://sqlite.org/quirks.html#double_quoted_string_literals_are_accepted> is
disabled for all connections since Mojo::SQLite 3.003; use single quotes for
string literals and double quotes for identifiers, as is normally recommended.
All cached database handles will be reset automatically if a new process has
been forked, this allows multiple processes to share the same L<Mojo::SQLite>
object safely.
Expand Down

1 comment on commit 9b4101e

@DabeDotCom
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.