Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Your own movie database in 5 minutes with IMDb API and Perl. Parent comment
mysql -u user -p < inserts.sql
If the $dbh were in the example, then:
(a) you could avoid that (eek!) archaic escapeSingleQuote() sub, e.g., my $released = $dbh->quote($released), but much better:
(b) as mentioned, use the SQL placeholders to avoid quoting altogether, but
(c) if you really want to print the INSERT's, just do method (a). Start by declaring the $dbh, e.g. for MySQL:
my $dbh = DBI->new( 'DBI:mysql:my_db', 'db_user', 'db_pass');
There are no comments on this comment yet.
mysql -u user -p < inserts.sql
If the $dbh were in the example, then:
(a) you could avoid that (eek!) archaic escapeSingleQuote() sub, e.g., my $released = $dbh->quote($released), but much better:
(b) as mentioned, use the SQL placeholders to avoid quoting altogether, but
(c) if you really want to print the INSERT's, just do method (a). Start by declaring the $dbh, e.g. for MySQL:
my $dbh = DBI->new( 'DBI:mysql:my_db', 'db_user', 'db_pass');