@param string $statement
@param array $options

@return bool|\PDOStatement|\SwooleTW\Http\Coroutine\PDOStatement
171671
public function prepare($statement, $options = null)
    {
        $options = is_null($options) ? [] : $options;
        if (strpos($statement, ':') !== false) {
            $i = 0;
            $bindKeyMap = [];
            $statement = preg_replace_callback('/:([a-zA-Z_]\w*?)\b/', function ($matches) use (&$i, &$bindKeyMap) {
                $bindKeyMap[$matches[1]] = $i++;

                return '?';
            }, $statement);
        }

        $stmtObj = $this->client->prepare($statement);

        if ($stmtObj) {
            $stmtObj->bindKeyMap = $bindKeyMap ?? [];

            return new PDOStatement($this, $stmtObj, $options);
        } else {
            $statementException = new StatementException($this->client->error, $this->client->errno);
            throw new QueryException($statement, [], $statementException);
        }
    }
10235
protected function platformPrepareSqlStatement($sqlStatement, array $options = [])
    {
        // Sqlite3::changes() returns 0 for "DELETE FROM TABLE" queries. This hack
        // modifies the query so that it a proper number of affected rows is returned.
        if ($this->isDeleteHack === true && preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sqlStatement)) {
            return trim($sqlStatement) . ' WHERE 1=1';
        }

        return $sqlStatement;
    }
443049
public static function getDAG($sentence, $options = array())
    {
        $defaults = array(
            'mode'=>'default'
        );

        $options = array_merge($defaults, $options);

        $N = mb_strlen($sentence, 'UTF-8');
        $i = 0;
        $j = 0;
        $DAG = array();
        $word_c = array();

        while ($i < $N) {
            $c = mb_substr($sentence, $j, 1, 'UTF-8');
            if (count($word_c)==0) {
                $next_word_key = $c;
            } else {
                $next_word_key = implode('.', $word_c).'.'.$c;
            }

            if (isset(self::$dag_cache[$next_word_key])) {
                if (self::$dag_cache[$next_word_key]['exist']) {
                    array_push($word_c, $c);
                    if (self::$dag_cache[$next_word_key]['end']) {
                        if (!isset($DAG[$i])) {
                            $DAG[$i] = array();
                        }
                        array_push($DAG[$i], $j);
                    }
                    $j += 1;
                    if ($j >= $N) {
                        $word_c = array();
                        $i += 1;
                        $j = $i;
                    }
                } else {
                    $word_c = array();
                    $i += 1;
                    $j = $i;
                }
                continue;
            }

            if (self::$trie->exists($next_word_key)) {
                self::$dag_cache[$next_word_key] = array('exist' => true, 'end' => false);
                array_push($word_c, $c);
                $next_word_key_value = self::$trie->get($next_word_key);
                if ($next_word_key_value == array("end"=>"")
                 || isset($next_word_key_value["end"])
                 || isset($next_word_key_value[0]["end"])
                ) {
                    self::$dag_cache[$next_word_key]['end'] = true;
                    if (!isset($DAG[$i])) {
                        $DAG[$i] = array();
                    }
                    array_push($DAG[$i], $j);
                }
                $j += 1;
                if ($j >= $N) {
                    $word_c = array();
                    $i += 1;
                    $j = $i;
                }
            } else {
                $word_c = array();
                $i += 1;
                $j = $i;
                self::$dag_cache[$next_word_key] = array('exist' => false);
            }
        }

        for ($i=0; $i<$N; $i++) {
            if (!isset($DAG[$i])) {
                $DAG[$i] = array($i);
            }
        }

        return $DAG;
    }
1039071
protected function fetchSingleValue($statement, array $params = array(), array $types = array())
    {
        return $this->getDb()->fetchColumn($statement, $params, 0, $types);
    }
509537
public static function isFidaVista($statement) {

        $result = false;
        $domDocument = new \DOMDocument();
        libxml_use_internal_errors(true);
        
        try {
            //$domDocument->loadXML($statement);
            if ($domDocument->loadXML($statement) == true) {
                $node = $domDocument->childNodes->item(0);
                
                if ($node->nodeName === 'FIDAVISTA') {
                    $result = true;
                }
            }
        } catch (Exception $exc) {
            $result = false;
        } finally {
            unset($domDocument);
        }
        
        return $result;
    }
1031090
public function execute_statement( Statement $statement, array $data, $options = 0 ) {

		$this->query_statement( $statement, $data, $options );

		return $this->last_affected_rows();
	}
401211
private static function isEndQuote($statement)
    {
        $trimmed = Multibyte::trim($statement);
        $first = mb_substr($statement, 0, 1);

        return in_array($trimmed, ['"', '\''])
            || (
                in_array($first, ['"', '\''])
                && mb_substr($statement, 1, 1) === ' '
                && ctype_lower(mb_substr($statement, 2, 1)) === true
            );
    }
1345329
private function _runQuery($query, $options)
    {
        $this->_testQueryStarts($query, '[select|show]');
        $statement = $this->_executeQuery($query, $options);
        if (is_object($statement) && $statement instanceof \PDOStatement) {
            return $statement;
        }
        else {
            $this->_error(FQDBException::INTERNAL_ASSERTION_FAIL, FQDBException::FQDB_CODE);
        }
    }
422689
public function query($statement, $params = array())
    {
        $returnValue = null;
        $this->preparedExec = false;

       
        if (count($params) > 0){
        	$sth = $this->dbConnector->prepare($statement);
        	$sth->execute($params);
        }
        else{
        	$sth = $this->dbConnector->query($statement);
        }
        
		
        if (!empty($sth)){
        	$returnValue = $sth;
        }

        return $returnValue;
    }
186130
public function query($statement) {
		try {
			$stmt = $this->pdo->query($statement);
			return new QueryResult($stmt, $this->pdo);
		} catch (PDOException $e) {
			throw $this->exceptionAdapter->adapt($e, $statement);
		}
	}
207431
public function where($statement, $params = null)
    {
        $this->where[] = $statement;
        $this->addParams($params);

        return $this;
    }
1336744
public function prepareRawStatement(string $statement, array $bindings): void
    {
        $this->statement = $statement;
        if (empty($bindings)) {
            return;
        }

        foreach ($bindings as $key => $value) {
            $this->addBindingValue($key, $value);
        }
    }
1041831
private function getPdoStatement($statement)
    {
        try {
            if (false === $sth = $this->pdo->prepare($statement)) {
                throw new \Exception(sprintf('Can not prepare this pdo statement: "%s"', $statement));
            }
        } catch (\Exception $e) {
            throw $e;
        }

        return $sth;
    }
994671
protected function insertExecute(string $statement, array $values): ?array {
		
		// our insert method should return either a single ID or a list of created IDs.
		// we can use the ExtendedPdo's fetchAffected method to determine how many were
		// inserted and then use that to determine our return value.  if nothing at all
		// was inserted, we return null.
		
		$affected = $this->dbConn->fetchAffected($statement, array_values($values));
		
		if ($affected === 0) {
			return null;
		}
		
		if ($affected === 1) {
			return [$this->getInsertedId()];
		}
		
		// if we haven't returned, then we inserted more than 1 row.  we can construct a
		// list of the IDs that were created by using the last ID and range as follows.
		// to identify our first ID, it would seem like $lastId - $affected would be enough,
		// but if we inserted 5 rows ending at 10, 10 - 5 = 5 and we don't want a range to
		// be [10,9,8,7,6,5] because that's six IDs.  so, we want to do 10 - (5 - 1) which
		// would result in [10,9,8,7,6] which is the correct response.
		
		$lastId = $this->getInsertedId();
		$firstId = $lastId - ($affected - 1);
		return range($lastId, $firstId);
	}
758537
public function prepare($statement) {
        $this->connect();

        $this->statement = new Statement($statement, $this->getParams(), $this->routings);
        $this->statement->setFetchMode($this->defaultFetchMode);

        return $this->statement;
    }
1260219
public static function Fetch($statement, $parameters=array(), $fetchMode=PDO::FETCH_BOTH)
	{
		$db = self::connect($fetchMode);
		
		try
		{
			$query = $db->prepare($statement);
			
			if($query)
			{
				foreach($parameters as $key => $parameter)
				{
					if(!isset($parameter["type"]))
						$parameter["type"] = PDO::PARAM_STR;
	
					$query->bindParam($key,$parameter["value"],$parameter["type"]);
				}
				
				$query->execute();
			}
			else
			{
				throw new \Exception("Sorry, there was a problem with the query statement.");
			}
		}
		catch (PDOException $e)
		{
			$exception = "Sorry, there was a problem with the query. ({$e->getMessage()})";
		}

		if($exception) throw new \Exception($exception);
		
		return $query->fetch($fetchMode);
	}
1025657
public function passLetStatement(array $statement)
    {
        foreach ($statement['assignments'] as $assignment) {
            if (isset($assignment['expr'])) {
                $this->passExpression($assignment['expr']);
            }
            $this->increaseMutations($assignment['variable']);
            if (self::DETECT_VALUE_IN_ASSIGNMENT == ($this->detectionFlags & self::DETECT_VALUE_IN_ASSIGNMENT)) {
                if (isset($assignment['expr'])) {
                    if ('variable' == $assignment['expr']['type']) {
                        $this->increaseMutations($assignment['expr']['value']);
                        break;
                    }
                }
            }
        }
    }