/** * Monty_MySQLI_Easy::__construct() * * @param string $table_name The table to work with * @param string $table_shortcut Optional table shortcut character * @param resource $mysqli Optional database MySQLi object to reuse * * @return \Monty_MySQLI_Easy */ public function __construct($table_name, $table_shortcut = null, $mysqli = null) { parent::__construct(); if (!$table_shortcut) { $table_shortcut = substr($table_name, 0, 1); } self::$comparisons = ['eq' => '=', 'gt' => '>', 'gte' => '>=', 'like' => 'LIKE', 'lt' => '<', 'lte' => '<=', 'ne' => '!=', 'regexp' => 'REGEXP']; self::$operators = ['and' => 'AND', 'or' => 'OR']; $this->joins = []; $this->tables_list = [[$table_name, $table_shortcut]]; $this->wheres = []; $this->is_dirty = true; $this->insert_type = null; $this->limit_count = null; $this->limit_start = null; $this->wheres_count = 0; if ($mysqli) { $this->DB = $mysqli; } }
/** * Monty_MySQLI::table() * * @param string $table_name The table to link to * @param string $table_shortcut Optional table shortcut letter * * @return object Monty_MySQLI_Easy */ public function table($table_name, $table_shortcut = null) { $easy = new Monty_MySQLI_Easy($table_name, $table_shortcut, $this->DB); $easy->setReturnType($this->return_type); return $easy; }