Fork me on GitHub
Subscribe 1

Ticket #433 (fixed enhancement)

Allow for queries from/to non-prefixed tables

  • Created: 2011-05-14 14:49:09
  • Reported by: Franz
  • Assigned to: Franz
  • Milestone: 2.0-alpha1
  • Component: database
  • Priority: high

Currently, the database table prefix is automatically prepended to all table names in all types of queries.

There needs to be some option to circumvent this and simply use the table name that is provided with the query.

History

Franz 2011-09-13 03:08:22

Commit 8344f44 to database master

#433: Allow queries from/to non-prefixed tables.

Franz 2011-09-13 03:11:55

Pretty much done with this now, committed in 8344f44.

That is, except for the join clause where code like the following is the reason that I do not have access to the $query object to determine whether to use the prefix or not:

if (!empty($query->joins))
    $sql .= $this->join($query->joins);

if (!empty($query->where))
    $sql .= $this->where($query->where);

I'd be tempted to simply pass the query object to these functions. You never know when you might need it (plus these helper functions would all have the same, consistent interface).

Franz 2011-09-13 03:13:05

Oh, one more thing:

Should I add this to queries like "CREATE TABLE", too?

Franz 2011-09-14 15:16:24

Commit f73cfbe to database master

#433: Refactor dialect helper functions to allow for not using a prefix in queries with joins.

Franz 2011-09-14 15:21:56

Commit 43aca77 to database master

#433: Allow table-related queries from/to non-prefixed tables.

Franz 2011-09-14 15:30:36

  • Status changed from open to fixed.

Implemented all of the above in f73cfbe and 43aca77.