1. Go to this page and download the library: Download schema-keeper/executor library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
schema-keeper / executor example snippets
use SchemaKeeper\Tools\Executor\Fetcher\SingleColumn;
use SchemaKeeper\Tools\Executor\Exception\RaisedException;
try {
$executor->execFunc('public.test_function', [], new SingleColumn());
} catch (RaisedException $e) {
echo $e->getExceptionName().' '.$e->getExceptionHint();
}
use SchemaKeeper\Tools\Executor\Fetcher\SingleColumn;
use SchemaKeeper\Tools\Executor\Fetcher\SingleRow;
use SchemaKeeper\Tools\Executor\Fetcher\MultipleRow;
$params = [':dummy' => 'test'];
$result1 = $executor->execFunc('public.test_function', $params, new SingleColumn());
$result2 = $executor->execFunc('public.test_function', $params, new SingleRow());
$result3 = $executor->execFunc('public.test_function', $params, new MultipleRow());
var_dump($result1, $result2, $result3);
use SchemaKeeper\Tools\Executor\Connection\PDOProxy;
use SchemaKeeper\Tools\Executor\ErrorHandler;
use SchemaKeeper\Tools\Executor\Executor;
$dsn = 'pgsql:dbname=schema_keeper;host=localhost';
$pdo = new PDO($dsn, 'postgres', 'postgres', [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$conn = new PDOProxy($pdo);
$errorHandler = new ErrorHandler();
$executor = new Executor($conn, $errorHandler);