- Ness
- Autopulse
- Autopulse
- Autopulse
You can include this library to your code file by typing the below code;
use Ness\Autopulse\Autopulse
Database: Autopulse Library #top
With this library you can easily access and manage your database.
This class, contains functions that make it easier to process your data. AutoPulse will save you writing complex dml queries. The only think you need is to call required function.
Load a model to database #top
This function is used to load a model class directly to your database.
Autopulse::LoadModel(Mixed $modelForm, DbConnect | MySqlConnect $dbclassinstance);
$modelForm: Model class posted from view
$dbclassinstance: An active database connection source.
Load an array to database #top
This function is used to load an array to your database.
Autopulse::LoadArray(String $tableName = '', Array $fieldList, DbConnect | MySqlConnect $dbclassinstance);
$tableName: Table name $fieldList: Fields with values. array key must be column name of table.
$dbclassinstance: An active database connection source.
Update data #top
Update a data using arrays
Autopulse::Update(Mixed $tableName, Array $fieldList = null, String $whereOption = null, DbConnect | MySqlConnect $dbclassinstance);
$tableName: Table name to update. $fieldList: Fields with values. array key must be column name of table.
$whereOption: Update where...
$dbclassinstance: An active database connection source.
Delete a record #top
Delete from database
Autopulse::Delete(Mixed $TableName, DbConnect | MySqlConnect $dbclassinstance,String $whereOption = null);
$TableName: Table name to delete from. $whereOption: Update where...
$dbclassinstance: An active database connection source.
Delete record using Model #top
Delete from database
Autopulse::Delete(Mixed $modelForm, DbConnect | MySqlConnect $dbclassinstance,String $whereOption = null);
$modelForm: Model Form, Autopulse library use this for getting table name from class name. $whereOption: Update where...
$dbclassinstance: An active database connection source.
Example #top
Let's create a Autopulse command to insert an array to "User" table.
use Ness\Autopulse\Autopulse;
/**
* OTHER CODES
**/
$cons = omap::GetValue("database_1");
$myconnnection = new MySqlConnect($cons["host"],$cons["user"],$cons["password"],$cons["database"]);
$myUser = array("userid"=>null,
"name"=>"Example",
"surname"=>"RECORD",
"email"=>"test@test.com");
if(Autopulse::LoadArray("user", $myUser, $myconnnection->Source()))
{
echo "User Saved";
}else{
echo "Error while saving user";
}