Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

codeigniter 2 uses pdo or php mysql function for it's active record?

Does CodeIgniter 2 use PDO or PHP MySQL functions for its active record class?

like image 842
ktm Avatar asked Apr 16 '11 08:04

ktm


1 Answers

CI does not use PDO.

PDO in Codeigniter - Protect vs SQL Injection

CI uses mysql_real_escape_string() to help guard against injection or if you feel safer, you could find (or write) a custom PDO class like the post above.

From http://codeigniter.com/user_guide/database/active_record.html:

"CodeIgniter uses a modified version of the Active Record Database Pattern. This pattern allows information to be retrieved, inserted, and updated in your database with minimal scripting. In some cases only one or two lines of code are necessary to perform a database action. CodeIgniter does not require that each database table be its own class file. It instead provides a more simplified interface.

Beyond simplicity, a major benefit to using the Active Record features is that it allows you to create database independent applications, since the query syntax is generated by each database adapter. It also allows for safer queries, since the values are escaped automatically by the system."

like image 188
Fuseblown Avatar answered Sep 19 '22 10:09

Fuseblown