select
@param string $sql An SQL string
@param array $array Paramters to bind
@param constant $fetchMode A PDO Fetch mode
@return mixed
506210
public function select($table, $fields = "*", $where = ' ', $order = '', $limit = null, $offset = null, $array = array (), $fetchMode)
    {
        // TODO: Implement select() method.
    }
1204547
public function getRow($sql, $params = null)
    {
        $stmt = $this->execute($sql, $params);

        return $stmt->fetch(PDO::FETCH_ASSOC);
    }
1126463
protected static function fetch($sql, $params = []): array
    {
        $self = static::getInstance();
        return DbProxy::fetchObjects($sql, $params, $self->rowClass);
    }
1297818
public function doQuery($sql, $isExecute = false, $method = 'fetch', $fetchMode = null, $forRead = null){
        if ($forRead || $forRead === null && $this->db->getSchema()->isReadQuery($sql)) {
            $pdo = $this->db->getSlavePdo();
        } else {
            $pdo = $this->db->getMasterPdo();
        }
        return $pdo->doQuery($sql, $isExecute, $method, $fetchMode);
    }
1307572
protected function query($sql) {
        $vars = func_get_args();
		$cleaner = "/[\s,].+|[^a-zA-Z]/";
		$illegal = "/[\\\\'\"\%]/";
        try {
            $pdo = $this->dbConnect();
            $stmt = $pdo->prepare($sql);
            $binds = explode(':', $sql);
            foreach($binds as $n => $b) {
				if($n != 0 && substr($b,1)!=false) {
					$b = ':' . preg_replace($cleaner,'',$b);
					$vars[$n] = preg_replace($illegal,'',$vars[$n]);
					$stmt->bindParam($b,$vars[$n]);
				}
            }
            $stmt->execute();
            return (strpos($sql,'SELECT') !== FALSE) ? $stmt->fetchAll() : true;
        } catch(PDOException $e) {
            return array('query_error' => $e);
        }
    }
1268805
public function fetchOne($sql, $params = array()) {
    $result = $this->db()->fetchAssoc($sql, $params);

    if (!empty($result)) {
      $this->setRecord($result);

      return $this;
    }

    return FALSE;
  }
574106
public static function findAll( $sql, $parameters = null, $connection = null, $fetchMode = \PDO::FETCH_ASSOC )
    {
        if ( false === ( $_reader = self::query( $sql, $parameters, $connection, $fetchMode ) ) )
        {
            return null;
        }

        return $_reader->fetchAll();
    }
323
public function select($table = '', $column = [], $arrayWhere = [], $other = '')
    {
        // handle column array data
        if (!is_array($column)) {
            $column = [];
        }
        // get field if pass otherwise use *
        $sField = count($column) > 0 ? implode(', ', $column) : '*';
        // check if table name not empty
        if (!empty($table)) {
            // if more then 0 array found in where array
            if (count($arrayWhere) > 0 && is_array($arrayWhere)) {
                // set class where array
                $this->data = $arrayWhere;
                // parse where array and get in temp var with key name and val
                if (strstr(key($arrayWhere), ' ')) {
                    $tmp = $this->customWhere($this->data);
                    // get where syntax with namespace
                    $where = $tmp['where'];
                } else {
                    $tmp = [];
                    foreach ($arrayWhere as $k => $v) {
                        $tmp[] = "$k = :s_$k";
                    }
                    // join temp array with AND condition
                    $where = implode(' AND ', $tmp);
                }
                // unset temp var
                unset($tmp);
                // set class sql property
                $this->sql = "SELECT $sField FROM `$table` WHERE $where $other;";
            } else {
                $this->sql = "SELECT $sField FROM `$table` $other;";  // if no where condition pass by user
            }

            // pdo prepare statement with sql query
            $this->STH = $this->prepare($this->sql);
            // if where condition has valid array number

            if (count($arrayWhere) > 0 && is_array($arrayWhere)) {
                $this->_bindPdoNameSpace($arrayWhere); // bind pdo param
            }

            // use try catch block to get pdo error
            try {
                // check if pdo execute
                if ($this->STH->execute()) {
                    // set class property with affected rows
                    $this->affectedRows = $this->STH->rowCount();
                    // set class property with sql result
                    $this->results = $this->STH->fetchAll();
                    // close pdo
                    $this->STH->closeCursor();
                    // return self object
                    return $this;
                } else {
                    self::error($this->STH->errorInfo());  // catch pdo error
                }
            } catch (\PDOException $e) {
                // get pdo error and pass on error method
                self::error($e->getMessage() . ': ' . __LINE__);
            } // end try catch block to get pdo error
        } else { // if table name empty
            self::error('Table name not found..');
        }
    }
792087
public function get($sql, $params = array(), $style = PDO::FETCH_ASSOC) {
		$statement = $this->query($sql, $params);

		$results = [];

		while ($row = $statement->fetch($style)) {
			$results[] = $row;
		}

		return $results;
	}
1054226
public static function query($sql,$bind=[])
    {
        try{
            $bind=is_array($bind) ? $bind : [$bind];
            self::$db=Connect::boot();
            Connect::comSql($sql);
            $sth = self::$db->prepare($sql);
            $sth->execute($bind);
            $sth->setFetchMode(\PDO::FETCH_ASSOC);

            return $sth;
        } catch (\PDOException $e) {
            throw new Exception($e->getMessage());
            //View::throwError($error);
        }
    }
1168612
public function fetchOne($sql, $bind = [], $fetchMode = \PDO::FETCH_ASSOC, $useMaster = false)
    {
        return ($rs = $this->fetchAll($sql, $bind, $fetchMode, $useMaster)) ? $rs[0] : false;
    }
420754
public function sqlFetch(string $sql, array $params = []): ?array
    {
        return $this->prepare($sql, $params)->fetch(\PDO::FETCH_ASSOC);
    }
1073643
public static function find( $sql, $parameters = null, $connection = null, $fetchMode = \PDO::FETCH_ASSOC )
    {
        if ( false === ( $_reader = self::query( $sql, $parameters, $connection, $fetchMode ) ) )
        {
            return null;
        }

        return $_reader->fetch();
    }
145107
public static function execute( $sql, $parameters = null, $connection = null, $fetchMode = \PDO::FETCH_ASSOC )
    {
        self::$_statement = self::createStatement( $sql, $connection, $fetchMode );

        if ( empty( $parameters ) )
        {
            return self::$_statement->execute();
        }

        return self::$_statement->execute( $parameters );
    }
829512
function fetch_arrays($sql)
    {
        $rs   = $this->query($sql);
        $data = [];
        while (true == ($row = $rs->fetch_assoc())) {
            $data[] = $row;
        }
        $rs->free();
        return $data;
    }
1176928
public function query($sql, $bind = array())
    {
        // connect to the database if needed
        $this->_connect();

        // is the $sql a Zend_Db_Select object?
        if ($sql instanceof Zend_Db_Select) {
            if (empty($bind)) {
                $bind = $sql->getBind();
            }

            $sql = $sql->assemble();
        }

        // make sure $bind to an array;
        // don't use (array) typecasting because
        // because $bind may be a Zend_Db_Expr object
        if (!is_array($bind)) {
            $bind = array($bind);
        }

        // prepare and execute the statement with profiling
        $stmt = $this->prepare($sql);
        $stmt->execute($bind);

        // return the results embedded in the prepared statement object
        $stmt->setFetchMode($this->_fetchMode);
        return $stmt;
    }
1016708
final private function parseFetched(array $row, FetchMode $fetchmode) {
        foreach($row as $tag => $value) {
            if(isset($this->parameters[$tag])) {
                $param =& $this->parameters[$tag]['param'];
                $type = $this->parameters[$tag]['type'];
                $param = $this->connection->quote($value, $type);
            }
        }
        if($fetchmode->hasMode(DB::FETCH_BOTH)) return array_merge ($row, array_values ($row));
        if($fetchmode->hasMode(DB::FETCH_ASSOC)) return $row;
        if($fetchmode->hasMode(DB::FETCH_NUM)) return array_values ($row);
        if($fetchmode->hasMode(DB::FETCH_COLUMN)) {
            $values = array_values($row);
            return isset($values[$fetchmode->col]) ? $values[$fetchmode->col] : null;
        }
        if($fetchmode->hasMode(DB::FETCH_OBJ)) return (object)$row;
        if($fetchmode->hasMode(DB::FETCH_CLASS)) {
            $classname = $fetchmode->hasMode(DB::FETCH_CLASSTYPE) ? array_shift($row) : $fetchmode->classname;
            $refl = new \ReflectionClass($classname);
            $obj = $fetchmode->hasMode(DB::FETCH_PROPS_EARLY)
                    ? $refl->newInstanceWithoutConstructor()
                    : $refl->newInstanceArgs($fetchmode->ctor_args);
            $refl = new \ReflectionObject($obj);
            foreach($row as $tag => $value) {
                if($refl->hasProperty($tag)) $refl->getProperty($tag)->setValue($obj, $value);
                else $obj->$tag = $value;
            }
            if($fetchmode->hasMode(DB::FETCH_PROPS_EARLY))
                $refl->getConstructor()->invokeArgs($obj, $fetchmode->ctor_args);
            return $obj;
        }
        if($fetchmode->hasMode(DB::FETCH_INTO)) {
            $refl = new \ReflectionObject($fetchmode->obj);
            foreach($row as $tag => $value) {
                if($refl->hasProperty($tag)) $refl->getProperty($tag)->setValue($obj, $value);
                else $obj->$tag = $value;
            }
        }
    }