-
-
Notifications
You must be signed in to change notification settings - Fork 6
Database
The Database repository is separately maintained at https://github.com/PhpGt/Database
The database layer of PHP.Gt encloses your application's database scripts within a simple and standardised interface, separating database access from your page logic. Write your queries in plain SQL or use the SQL Builder as an object oriented representation of an SQL query, with the benefit of inheritance.
A layer on top of PDO is used for database access, so the following database engines are supported:
- CUBRID
- Sybase
- Firebird
- IBM
- Informix
- MySQL
- MS SQL Server
- Oracle
- ODBC and DB2
- PostgreSQL
- SQLite
- 4D
All database connection settings should be stored in your project's configuration. By default, SQLite is used as it does not require a server to be running.
The config.ini
configuration file of your project stores all of the database connection settings within the [database]
section. Read more about project config in the Configuration section.
Example config.ini
for connecting to a local MySQL database:
[database]
driver=mysql
host=localhost
schema=MyApp
port=3306
username=app_user
password=app_pass
You can connect to an existing database, or use database migrations to create a new one. See below for details on migrations.
A reference to the Database object can only be made from a Logic class.
// TODO: database property of logic class
// TODO: Call queries organised by query collection (link to below section)
// TODO: Extending queries using SqlBuilder (link to below section)
// TODO: Bind iterable key-value pairs to named parameters or single variables to question marks within query.
// TODO: Named parameters bound using key-value pairs.
// TODO: Question marks bound in order, passed into query function as variable arguments.
// TODO: Use of :orderBy
and :limit
, and why these have been implemented by Gt and not PDO.
// TODO.
// TODO: Iterating, counting, etc.
// TODO: Casting ResultSets to custom objects (manual for now, as issue #80 is still in question form).
// TODO: numbered queries
// TODO: migration integrity hashes
- Request-response lifecycle
- Running your application
- Project layout
- Application architecture
- Web servers
- URIs
- Page view
- Dynamic URIs and pages
- Headers and footers
- Page logic
- Protected globals
- User input
- Cookies
- Sessions
- DOM manipulation
- Custom HTML components
- DOM templates
- Binding data to the DOM
- Database
- Client side assets
- API Webservices
- Security
- Configuration
- Build system
- Coding styleguide