It powers the model layer in the framework. It is found under the directory Phalcon\Db. It consists of abstraction layer which is written in C programming language.
Database Adapter
Phalcon uses PDO_ to connect to databases. It supports following Database engines:
Class | Description |
---|---|
Phalcon\Db\Adapter\Pdo\Mysql | It is the most used relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. |
Phalcon\Db\Adapter\Pdo\Postgresql | PostgreSQL is a powerful, open source relational database system. It provides reliability, data integrity, and correctness. |
Phalcon\Db\Adapter\Pdo\Sqlite | SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine |
Implementation
<?php
use Phalcon\Db\Adapter\Pdo\Factory;
$options = [
'host' => 'localhost',
'dbname' => 'javatpoint',
'port' => 3306,
'username' => 'siddharth',
'password' => 'flash',
'adapter' => 'mysql',
];
$db = Factory::load($options);
?>
Database Dialects
Phalcon stores specific details of database engine in dialects.
Class | Description |
---|---|
Phalcon\Db\Dialect\Mysql | SQL specific dialect for MySQL database system |
Phalcon\Db\Dialect\Postgresql | SQL specific dialect for PostgreSQL database system |
Phalcon\Db\Dialect\Sqlite | SQL specific dialect for SQLite database system |
Leave a Reply