Exemple #1
0
 /**
  * Builds an SQL compatible order by query portion.
  * Note: does not include the 'ORDER BY' word as a query can be composed of multiple order by clauses.
  * @return String the order by clause query string
  */
 public function toSQL()
 {
     return Inform8Context::getDbConnection()->real_escape_string($this->table) . '.' . Inform8Context::getDbConnection()->real_escape_string($this->field) . ' ' . Inform8Context::getDbConnection()->real_escape_string($this->direction);
 }
Exemple #2
0
 /**
  * Creates an SQL query portion representing this condition.
  * @return String the condition in SQL
  */
 public function toSQL()
 {
     return Inform8Context::getDbConnection()->real_escape_string($this->table) . '.' . Inform8Context::getDbConnection()->real_escape_string($this->field) . ' ' . Inform8Context::getDbConnection()->real_escape_string($this->condition) . ' ' . "'" . Inform8Context::getDbConnection()->real_escape_string($this->value) . "'";
 }
Exemple #3
0
 function __construct()
 {
     $this->mysqli = Inform8Context::getDbConnection();
     $this->logger = Inform8Context::getLogger();
 }
Exemple #4
0
 public function buildQuery()
 {
     $query = "SELECT ";
     if ($this->distinct) {
         $query .= ' DISTINCT ';
     }
     $comma = false;
     foreach ($this->fields as $field) {
         if ($comma) {
             $query .= ', ';
         } else {
             $comma = true;
         }
         $query .= Inform8Context::getDbConnection()->real_escape_string($this->table . '.' . $field);
     }
     $query .= " FROM " . Inform8Context::getDbConnection()->real_escape_string($this->table);
     foreach ($this->joins as $join) {
         $query .= ', ' . Inform8Context::getDbConnection()->real_escape_string($join->getOtherTable());
     }
     $query .= $this->buildWhere();
     $query .= $this->buildOrderBy();
     if ($this->limit > 0) {
         $query .= " LIMIT " . $this->start . ',' . $this->limit;
     }
     return $query;
 }