public function build_director()
 {
     $sql_builder = new SQLBuilder();
     $data = $this->get_data();
     $input = SQLLexical::make_product_list($data['list_product']);
     return $sql_builder->sql_insert('tam_an.product', array('Name', 'Bought', 'Price', 'Unit'))->sql_insert_values_recursive($input)->end_query()->to_string();
 }
 public function build_director()
 {
     //get data from SQL
     $data = $this->get_data();
     $input = SQLLexical::make_product_list($data['list_product']);
     //use sql builder
     $sql_builder = new SQLBuilder();
     $id_array = array("Name", "Bought", "Price", "Unit");
     foreach ($input as $key => $value) {
         $sql_builder->update('tam_an.product')->set($id_array, $value)->where()->equals('ID', $key)->end_query();
     }
     return $sql_builder->to_string();
 }
 public function build_director()
 {
     $sql_builder = new SQLBuilder();
     $data = $this->get_data();
     ///format key word to tokens
     $keywords = SQLLexical::format_product_query_to_array($data);
     $keywords = SQLLexical::make_keywords($keywords);
     //make query
     $len = sizeof($keywords);
     $tempID = array();
     for ($i = 0; $i < $len; $i++) {
         $tempID[$i] = 'Name';
     }
     return $sql_builder->select(array("Name", SQLBuilder::sql_as("Unit", "UnitName"), "Price", SQLBuilder::sql_as("ID", "Id"), SQLBuilder::sql_as("Product_ID", "ProductId"), SQLBuilder::sql_as("Bought", "Import_Price")))->from("tam_an.product")->where()->or_recursive('like', $tempID, $keywords)->to_string();
 }
 public function alter_product_new_product_query($data)
 {
     $input = SQLLexical::make_product_list($data['list_product']);
     return $this->sql_insert('tam_an.product', array('Name', 'Bought', 'Price', 'Unit'))->sql_insert_values_recursive($input)->end_query()->to_string();
 }