Download the PHP package phel-lang/phel-pdo without Composer
On this page you can find all versions of the php package phel-lang/phel-pdo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package phel-pdo
phel-pdo
phel-lang pdo wrapper library.
Description
Inherently, it is very easy to call the functionality of PHP classes from phel code. Therefore, it is not difficult to access the database using PDO directly.
However, if you have to think about PHP classes while writing phel code, there is a concern that a context switch will occur between the phel world and the PHP world, and you will not be able to concentrate on writing the phel code.
Therefore, I created a wrapper library (phel-pdo) that can handle PDO just by calling Phel functions.
Install
Install from composer. https://packagist.org/packages/phel-lang/phel-pdo
Usage
This is an example of connecting to a file database, creating a table, inserting records, and searching on repl.
Reference
pdo
Represents a connection between PHP and a database server.
begin
Initiates a transaction
commit
Commits a transaction
connect
Connect database and return connection object. Throws a PDOException if the attempt to connect to the requested database fails
error-code
Fetch the SQLSTATE associated with the last operation on the database handle
error-info
Fetch extended error information associated with the last operation on the database handle
exec
Execute an SQL statement and return the number of affected rows
get-attribute
Retrieve a database connection attribute
get-available-drivers
Return an array of available PDO drivers
in-transaction
Checks if inside a transaction
last-insert-id
Returns the ID of the last inserted row or sequence value
prepare
Prepares a statement for execution and returns a statement object
query
Prepares and executes an SQL statement without placeholders
quote
Quotes a string for use in a query
rollback
Rolls back a transaction
set-attribute
Set an attribute
statement
Represents a prepared statement and, after the statement is executed, an associated result set.
bind-value
Binds a value to a parameter
debug-dump-params
Returns an SQL prepared command
execute
Executes a prepared statement
[!NOTE] The return value of the original library,
PDOStatement::execute()
, is abool
value representing the result of theexecute
method, while the return value ofstatement/execute
returns the statement itself.
fetch
Fetches the next row from a result set
fetch-all
Fetches the remaining rows from a result set
fetch-column
Returns a single column from the next row of a result set