LazyRecord\BaseModel::dbQuery PHP 메소드

dbQuery() 공개 메소드

get pdo connetion and make a query.
public dbQuery ( $dsId, string $sql ) : PDOStatement
$sql string SQL statement
리턴 PDOStatement pdo statement object. $stm = $this->dbQuery($sql); foreach( $stm as $row ) { $row['name']; }
    public function dbQuery($dsId, $sql)
    {
        $conn = $this->getConnection($dsId);
        if (!$conn) {
            throw new RuntimeException("data source {$dsId} is not defined.");
        }
        return $conn->query($sql);
    }