Closed Bug 312508 Opened 19 years ago Closed 18 years ago

Two SQL queries contain "LIMIT" keyword instead of calling sql_limit()

Categories

(Bugzilla :: Database, defect)

2.21
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.0

People

(Reporter: lance.larsh, Assigned: lance.larsh)

References

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041119
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041119

The following queries are using the LIMIT keyword explicitly, rather than
invoking the db-specific method $dbh->sql_limit().  Namely:

  Bugzilla/DB/Schema.pm:1484  push(@statements, "SELECT CAST($column AS $type)
FROM $table LIMIT 1");
  Bugzilla/User.pm:1182       LIMIT 1");

These queries fail on Oracle as a result.

Reproducible: Always

Steps to Reproduce:
Blocks: bz-oracle
Version: unspecified → 2.21
(In reply to comment #0)
>   Bugzilla/DB/Schema.pm:1484  push(@statements, "SELECT CAST($column AS $type)
> FROM $table LIMIT 1");

This query is a little tricky because it's in
Bugzilla::DB::Schema::get_alter_column_ddl().  Since that method doesn't take
$dbh as a parameter, there's no easy way to invoke sql_limit() from there.
Yeah, that one is a bit tricky. You basically have two choices:

(1) Re-write get_alter_column_ddl for your DB (which I think you'll have to do
anyway, yeah?)

(2) Make the Schema constructor take a reference to a Bugzilla::DB object that
it can use. If you do this, make sure to specify in the internal
Bugzilla::DB::Schema documentation that the $dbh that is passed in should *only*
be used to get information about the database, and should *never* interact with
the database directly, as that's forbidden in Schema.pm.
Assignee: database → lance.larsh
Status: UNCONFIRMED → NEW
Ever confirmed: true
Bug 300551 removed 'LIMIT 1' from User.pm.
Depends on: 300551
Bug 329537 removed LIMIT 1 from DB::Schema::get_alter_column_ddl(). All other "LIMIT" are in there DB-specific file, so this bug is fixed.
Status: NEW → RESOLVED
Closed: 18 years ago
No longer depends on: 300551
Resolution: --- → FIXED
Target Milestone: --- → Bugzilla 3.0
You need to log in before you can comment on or make changes to this bug.