Skip to content

Commit

Permalink
chore: i just want it
Browse files Browse the repository at this point in the history
  • Loading branch information
darkterminal committed Jul 10, 2024
1 parent 118f9b9 commit 2e06f6f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/Database/LibSQLConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,27 @@ public function getConnectionMode(): string
return $this->db->getConnectionMode();
}

public function statement($query, $bindings = [])
public function statement($query, $bindings = []): bool
{
$this->select($query, $bindings);

return $this->isRunningMigrations();
}

public function getPdo()
public function getPdo(): LibSQLDatabase
{
return $this->db;
}

public function getReadPdo()
public function getReadPdo(): LibSQLDatabase
{
return $this->db;
}

public function select($query, $bindings = [], $useReadPdo = true)
{
// Example method where query execution and fetching might occur
$result = (array) parent::select($query, $bindings, $useReadPdo);

// Convert result objects to arrays if they are not already
$resultArray = array_map(function ($item) {
return (array) $item;
}, $result);
Expand Down
4 changes: 3 additions & 1 deletion src/Database/LibSQLConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ protected function createConnection($driver, $connection, $database, $prefix = '
{
$config['driver'] = 'libsql';
$config['url'] = 'file:'.$config['database'];
$connection = new LibSQLDatabase($config);
$connection = function() use ($config) {
return new LibSQLDatabase($config);
};

return parent::createConnection($config['driver'], $connection, $config['url'], $prefix, $config);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Database/LibSQLPDOStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function lastInsertId(?string $name = null): string|false
$name = 'id';
}

return (isset($this->lastInsertIds[$name]))
return isset($this->lastInsertIds[$name])
? (string) $this->lastInsertIds[$name]
: false;
}
Expand Down

0 comments on commit 2e06f6f

Please sign in to comment.