Log of /FigKernelPackages/DBrtns.pm
Parent Directory
Revision
1.10 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Sun Feb 27 14:05:58 2005 UTC (14 years, 9 months ago) by
olson
Branch:
MAIN
Changes since
1.9: +7 -0 lines
Diff to
previous 1.9
On postgres, use DROP TABLE <name> CASCADE so that we can drop tables that
have foreign key constraints set up.
Revision
1.8 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Tue Jan 25 04:44:22 2005 UTC (14 years, 10 months ago) by
redwards
Branch:
MAIN
Changes since
1.7: +4 -2 lines
Diff to
previous 1.7
Minor changes to DBrtns to clarify the weird error I was getting and to include how to fix it in the error code
Revision
1.7 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Tue Jan 11 18:59:39 2005 UTC (14 years, 11 months ago) by
olson
Branch:
MAIN
Changes since
1.6: +9 -3 lines
Diff to
previous 1.6
I ran into a bug today where I was using by_alias to look up aliases
for the peg-mapping code, and one of the aliases was DR6', with a
single-quote. Because the code in by_alias doesn't quote its argument,
the SQL failed with a syntax error.
The perl DBI library has a mechanism designed to solve this
problem. If you use ? in a sql string where you want to substitute an
argument from code, DBI will do the appropriate quoting for you. I've
made this accessible via the SQL method in the DBrtns module, so the
by_alias code now looks like this:
if (($relational_db_response = $rdbH->SQL("SELECT id FROM ext_alias WHERE ( alias = ? )", undef, $alias))
and works properly in the face of $alias having a single-quote in
it. I believe this mechanism is also more efficient. Note the second
argument of SQL is a verbose flag, which means that any bound
variables (to replace ?s in the query) have to start at the third
argument.
I've also made a change in the SQL method such that the query is done
inside an eval{} block, and if it fails, the error is reraised using
confess so that it is possible to see the full backtrace so you can
find in the source where the bad query was.
This form allows you to request diffs between any two revisions of this file.
For each of the two "sides" of the diff,
select a symbolic revision name using the selection box, or choose
'Use Text Field' and enter a numeric revision.