-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Investigate connecting to PostgreSQL (early test)
It might be cleaner to split DB-specific code into separate packages.
- Loading branch information
1 parent
cef0770
commit ce7bba4
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
use PeachySQL\Test\src\DbConnector; | ||
use Ramsey\Uuid\Uuid; | ||
|
||
require 'test/bootstrap.php'; | ||
|
||
$conn = DbConnector::getPgsqlConn(); | ||
|
||
$sql = "INSERT INTO Users (name, dob, weight, isDisabled) | ||
VALUES ($1, $2, $3, $4)"; | ||
|
||
$result = pg_query_params($conn, $sql, ['George McFly', '1938-04-01', 133.8, true]); | ||
|
||
if (!$result) { | ||
echo 'Failed to insert row: ' . pg_last_error($conn) . "\n"; | ||
} else { | ||
echo 'Successfully inserted row!'; | ||
} | ||
|
||
DbConnector::deleteTestTables(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters