Data Directory - ApinePHP/legacy-framework GitHub Wiki
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"=>"[email protected]"
));
Replace row
$result=(new DataDirectroy())->Replace('apine_users')->Values(array(
"username"=>"Youmy001",
"password"=>"HASHEDPASSWORD",
"email"=>"[email protected]"
));
Update row
$result=(new DataDirectory())->Update('apine_users')->Where(array(
"ID"=>5
))->Values(array(
"email"=>"[email protected]"
));
Delete row
$result=(new DataDirectory())->Delete('apine_users')->Where(array(
"ID"=>5
));