예제 #1
0
파일: Insert.php 프로젝트: Welvin/stingle
 private function _getValues($values)
 {
     $returnStr = "";
     foreach ($values as $value) {
         $returnStr .= Expr::quoteLiteral($value) . ",";
     }
     return trim($returnStr, ",");
 }
예제 #2
0
 public function __toString()
 {
     $leftExpr = Expr::quoteLiteral($this->_leftExpr);
     $rightExpr = Expr::quoteLiteral($this->_rightExpr);
     if ($leftExpr instanceof Math or $leftExpr instanceof QueryBuilder) {
         $leftExpr = '(' . $leftExpr . ')';
     }
     if ($rightExpr instanceof Math or $rightExpr instanceof QueryBuilder) {
         $rightExpr = '(' . $rightExpr . ')';
     }
     return $leftExpr . ' ' . $this->_operator . ' ' . $rightExpr;
 }
예제 #3
0
파일: Func.php 프로젝트: Welvin/stingle
 public function __toString()
 {
     $finalArguments = $this->_arguments;
     foreach ($finalArguments as &$arg) {
         $arg = Expr::quoteLiteral($arg);
     }
     $returnStr = $this->_name . '(' . implode(', ', $finalArguments) . ')';
     if ($this->_alias != null) {
         $returnStr .= " as `" . $this->_alias . "`";
     }
     return $returnStr;
 }
예제 #4
0
파일: Math.php 프로젝트: Welvin/stingle
 public function __toString()
 {
     // Adjusting Left Expression
     $leftExpr = (string) Expr::quoteLiteral($this->_leftExpr);
     if ($this->_leftExpr instanceof Math) {
         $leftExpr = '(' . $leftExpr . ')';
     }
     // Adjusting Right Expression
     $rightExpr = (string) Expr::quoteLiteral($this->_rightExpr);
     if ($this->_rightExpr instanceof Math) {
         $rightExpr = '(' . $rightExpr . ')';
     }
     return $leftExpr . ' ' . $this->_operator . ' ' . $rightExpr;
 }
예제 #5
0
파일: Expr.php 프로젝트: Welvin/stingle
 /**
  * Creates an instance of BETWEEN() function, with the given argument.
  *
  * @param mixed $val Valued to be inspected by range values.
  * @param integer $x Starting range value to be used in BETWEEN() function.
  * @param integer $y End point value to be used in BETWEEN() function.
  * @return Func A BETWEEN expression.
  */
 public function between($val, $x, $y)
 {
     return Expr::quoteLiteral($val) . ' BETWEEN ' . Expr::quoteLiteral($x) . ' AND ' . Expr::quoteLiteral($y);
 }