Esempio n. 1
0
 /**
  * Prepares value for insertion into SQL
  * @param string $value
  * @param SugarQuery_Builder_Condition $condition
  * @return string
  */
 protected function prepareValue($value, SugarQuery_Builder_Condition $condition)
 {
     if ($this->sugar_query->usePreparedStatements && !empty($condition->field->def) && !$value instanceof SugarQuery_Builder_Literal) {
         $type = $this->db->getFieldType($condition->field->def);
         $this->sugar_query->addData($condition->field->quoteValue($value, $condition->operator, true));
         return "?{$type}";
     } else {
         return $condition->field->quoteValue($value, $condition->operator);
     }
 }
Esempio n. 2
0
 /**
  * Compile this SugarQuery into a standard SQL-92 Query string
  * @return string
  */
 public function compileSql(SugarQuery $parent = null)
 {
     $compiler = new SugarQuery_Compiler();
     $this->data = $this->dataItems = array();
     $sql = $compiler->compile($this, $this->db);
     if ($parent) {
         $parent->addData($this->data);
     }
     return $sql;
 }