Bouncy Melons 0.2
declarative style orm
Public Member Functions | Data Fields
BouncyMelons Class Reference

Public Member Functions

 __construct ()
 
 getCache ()
 
 setPDO (\PDO $pdo)
 
 getPDO ()
 
 connect ($dsn, $user, $password, $options=[\PDO::ATTR_PERSISTENT=> true])
 
 park ($vms)
 
 parkOne ($vm)
 
 getVmBySlug ($slug)
 
 tableExist ($name)
 
 getDriver ()
 
 getTableFields ($table)
 
 getCreatePrimaryId ()
 
 getCreateDefaultCharset ()
 
 dropConnection ()
 
 exec ($query)
 
 query ($sql)
 
 queryOne ($sql)
 
 queryParam ($sql)
 
 select ($table, $fields, $where, $limit=null, $orderby=null, $groupBy=null)
 
 selectOne ($table, $where)
 
 insert ($table, $items)
 
 insertOrUpdate ($table, $items)
 
 remove ($table, $id)
 
 truncate ($table)
 
 createViewAs ($view, $sql)
 
 createTemptableAs ($name, $sql)
 
 setItemsPerPage ($itemsPerPage)
 
 getItemsPerPage ()
 

Data Fields

const DEFAULT_ITEMS_PER_PAGE = 50
 

Detailed Description

Definition at line 18 of file BouncyMelons.php.

Constructor & Destructor Documentation

__construct ( )

Definition at line 27 of file BouncyMelons.php.

Member Function Documentation

connect (   $dsn,
  $user,
  $password,
  $options = [\PDO::ATTR_PERSISTENT =,
true]   
)
Parameters
String$dsnlike 'mysql:dbname=bouncymelons;host=localhost'
String$user
String$passwordArray $options PDO driver options, default is [PDO::ATTR_PERSISTENT => true]

Definition at line 66 of file BouncyMelons.php.

createTemptableAs (   $name,
  $sql 
)
Parameters
string$nametemporary table name
string$sqlselect query

Definition at line 294 of file BouncyMelons.php.

createViewAs (   $view,
  $sql 
)
Parameters
string$viewview name
string$sqlselect query

Definition at line 286 of file BouncyMelons.php.

dropConnection ( )

drop connection to currect database

Definition at line 156 of file BouncyMelons.php.

exec (   $query)
Parameters
string$query

Definition at line 164 of file BouncyMelons.php.

getCache ( )
Returns

Definition at line 34 of file BouncyMelons.php.

getCreateDefaultCharset ( )

Definition at line 145 of file BouncyMelons.php.

getCreatePrimaryId ( )

Definition at line 137 of file BouncyMelons.php.

getDriver ( )
Returns
IDriver

Definition at line 120 of file BouncyMelons.php.

getItemsPerPage ( )
Returns
int

Definition at line 309 of file BouncyMelons.php.

getPDO ( )

you can interact with pdo directly if you want

Returns

Definition at line 53 of file BouncyMelons.php.

getTableFields (   $table)
Parameters
string$tabletable name
Returns
array like [['field'=>'fieldA','type'=>'typeOfFieldA'],['field'=>'fieldB','type'=>'typeOfFieldB'],..]

Definition at line 133 of file BouncyMelons.php.

getVmBySlug (   $slug)
Parameters
String$slug
Returns
IVModel

Definition at line 98 of file BouncyMelons.php.

insert (   $table,
  $items 
)
Parameters
String$table
Array$itemsassociative array of values ['param1'=>'value1','param2'=>'value2']
Returns
integer id

Definition at line 240 of file BouncyMelons.php.

insertOrUpdate (   $table,
  $items 
)
Parameters
String$table
Array$itemsassociative array of values ['param1'=>'value1','param2'=>'value2']
Returns
integer id

Definition at line 261 of file BouncyMelons.php.

park (   $vms)
Parameters
array$vmsarray of IVModel

Definition at line 80 of file BouncyMelons.php.

parkOne (   $vm)
Parameters
IVModel$vm

Definition at line 89 of file BouncyMelons.php.

query (   $sql)
Parameters
string$sql
Returns
array of associated array, each sub array represent a row
Exceptions
ESelect

Definition at line 174 of file BouncyMelons.php.

queryOne (   $sql)
Parameters
string$sql
Returns
associative array
Exceptions
EItemNotFound

Definition at line 184 of file BouncyMelons.php.

queryParam (   $sql)

for special queries

Parameters
string$sqllike 'SELECT @@sql_mode';
Returns
param value

Definition at line 193 of file BouncyMelons.php.

remove (   $table,
  $id 
)
Parameters
String$table
int$id

Definition at line 269 of file BouncyMelons.php.

select (   $table,
  $fields,
  $where,
  $limit = null,
  $orderby = null,
  $groupBy = null 
)
Parameters
string$tabletable name
string$wherewhere clause
string$limitlimit
string$orderbyorder by clause
Returns
array of associated array, each sub array represent a row

Definition at line 205 of file BouncyMelons.php.

selectOne (   $table,
  $where 
)

Similar to select, but return only first result

Parameters
string$tabletable name
string$wherewhere clause
Returns
associated array, which represent single row

Definition at line 231 of file BouncyMelons.php.

setItemsPerPage (   $itemsPerPage)

set items per page for all lists globally

Parameters
int$itemsPerPage

Definition at line 302 of file BouncyMelons.php.

setPDO ( \PDO  $pdo)

manually set PDO object

Parameters
PDO$pdo$bouncyMelons->setPDO(new PDO($dsn, $user, $password));

Definition at line 45 of file BouncyMelons.php.

tableExist (   $name)
Parameters
string$nametable name
Returns
bool

Definition at line 113 of file BouncyMelons.php.

truncate (   $table)

remove all data from table

Parameters
string$table

Definition at line 277 of file BouncyMelons.php.

Field Documentation

const DEFAULT_ITEMS_PER_PAGE = 50

Definition at line 20 of file BouncyMelons.php.


The documentation for this class was generated from the following file: