Skip to content
Youmy001 edited this page Feb 4, 2018 · 9 revisions

This a draft for our future module for database connection which may replace the Database class. Nothing of this is actual documentation of an existing module. This new module will bring better security and remove the necessity to know *SQL to fetch, insert, update, and delete data from the database.

The Idea

The goal of this module is to make access to database data easier. Its gonna represent a higher level version of the current Database class. It's gonna support the five most commun request types : SELECT, INSERT, REPLACE, UPDATE and DELETE.

Planned Support

The first versions will support MySQL. The following versions will gradually include support for SQLite, PosgreSQL and SQLServer.

Examples

Fetch row

$result=(new DataDirectory())->Select('apine_users')->Where(array(
    "register_date"=>"2015-08"
),SQL_SYMBOL_GREATER);

Insert row

$result=(new DataDirectroy())->Insert('apine_users')->Values(array(
    "username"=>"Youmy001",
    "password"=>"HASHEDPASSWORD",
    "email"=>"teasdale.t@kitaiweb.ca"
));

Replace row

$result=(new DataDirectroy())->Replace('apine_users')->Values(array(
    "username"=>"Youmy001",
    "password"=>"HASHEDPASSWORD",
    "email"=>"teasdale.t@kitaiweb.ca"
));

Update row

$result=(new DataDirectory())->Update('apine_users')->Where(array(
    "ID"=>5
))->Values(array(
    "email"=>"teasdale.t@kitaiweb.ca"
));

Delete row

$result=(new DataDirectory())->Delete('apine_users')->Where(array(
    "ID"=>5
));
Clone this wiki locally