diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index 24b66a3..d4281b2 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -109,6 +109,8 @@ foreach( $GLOBALS['pg4wp_pre_sql'] as $sql2run) wpsql_query( $sql2run); + pg4wp_init($conn); + return $conn; } @@ -573,6 +575,35 @@ return $sql; } + // Database initialization + function pg4wp_init() + { + // Provide (mostly) MySQL-compatible field function + // Note: MySQL accepts heterogeneous argument types. No easy fix. + // Can define version with typed first arg to cover some cases. + // Note: ROW_NUMBER+unnest doesn't guarantee order, but is simple/fast. + // If it breaks, try https://stackoverflow.com/a/8767450 + $result = pg_query(<<