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}”)