Query helper functions

Before using queries whe need to now about few helper functions:

namespace shop
    class product
        public $id;
        public $name;
$database->add ('shop.product');
$database->update ();

In this case table with name 'shop_product' will be created with fields 'id' and 'name'. Full table name for class looks like my_db.shop_product and full field name for property 'name' looks like my_db.shop_product.name.

In custum queries you will need to use full table and field names to avoid ambigous field name errors.


To get table name use:

//Outputs something like `my_db`.`shop_product`


//Outputs something like `my_db`.`shop_product`

To get field name use:

//Outputs something like `my_db`.`shop_product`.`name`

The name parameter for 'field' function must be property name, this means if you have public $login than property name is 'login' and to get full field name for login use $database->path->to->table->field('login')


value function gerenates something useful also:


To escape string use function \db\string. Anything that does not go through the db.php functions like custom strings and comes from user input and used in queries must be escaped.