Difference between revisions of "Gallery3:Developer Handbook:Database Abstraction Layer" - Gallery Codex
Personal tools

Difference between revisions of "Gallery3:Developer Handbook:Database Abstraction Layer"

From Gallery Codex

 
Line 11: Line 11:
 
* Gallery 3 database tables can have a prefix to distinguish them from other tables in the same database.  To support prefixes properly, all table names must be wrapped in curly braces whenever used in a database query.  For example:  ''$db->query(“SELECT * FROM {tags}”)''
 
* Gallery 3 database tables can have a prefix to distinguish them from other tables in the same database.  To support prefixes properly, all table names must be wrapped in curly braces whenever used in a database query.  For example:  ''$db->query(“SELECT * FROM {tags}”)''
  
[[Category:Gallery 3:Developer Handbook]]
+
[[Category:Gallery 3:Developer Handbook|Database Abstraction Layer]]

Latest revision as of 14:22, 13 June 2011

Database Abstraction Layer

Gallery 3 uses the Kohana Database Abstraction Layer. This is well documented on the Kohana website:

Notes about the Gallery 3 database abstraction layer:

  • You don’t have to worry about creating connections to the database, this is handled for you by the Gallery 3 framework
  • Gallery 3 only supports MySQL 5.x so it’s perfectly legal to use SQL statements that are only supported by MySQL 5.x.
  • The Kohana docs are slightly out of date. To build a query, the new syntax is: db::build()
  • Gallery 3 database tables can have a prefix to distinguish them from other tables in the same database. To support prefixes properly, all table names must be wrapped in curly braces whenever used in a database query. For example: $db->query(“SELECT * FROM {tags}”)
advertisements