abstract class PdoHelper (View source)

A helper class for handling PDO databases

Methods

static void
importSql(PDO $databaseHandle, string $pdoDriver, string $pathAndFilename)

Pumps the SQL into the database. Use for DDL only.

Details

static void importSql(PDO $databaseHandle, string $pdoDriver, string $pathAndFilename)

Pumps the SQL into the database. Use for DDL only.

The given $pathAndFilename is expanded to check for a driver-specific SQL file to import, so "/some/path/to/mysql.statements.sql" is checked and used if "/some/path/to/statements.sql" is passed and $pdoDriver is "mysql". Otherwise the given file is used.

Important: key definitions with length specifiers (needed for MySQL) must be given as "field"(xyz) - no space between double quote and parenthesis - so they can be removed automatically. This is not done for driver-specific SQL, though.

Parameters

PDO $databaseHandle
string $pdoDriver
string $pathAndFilename

Return Value

void