Skip to main content

Passing Parameters to PDODriver

You can pass parameter directly to the PDODriver by adding to the connection string a query parameter with the value.

e.g.

<?php
$uri = Uri::getInstanceFromUri("mysql://root:password@localhost")
->withQueryKeyValue(PDO::MYSQL_ATTR_COMPRESS, 1);
$db = Factory::getDbRelationalInstance($uri);

Special Parameters

AnyDatasetDB has some special parameters:

ParameterValueDescription
DbPdoDriver::STATEMENT_CACHEtrueIf this parameter is set with "true", anydataset will cache the last prepared queries.
DbPdoDriver::DONT_PARSE_PARAMany valueIs this parameter is set with any value, anydataset won't try to parse the SQL to find the values to bind the parameters.

e.g.

$uri = Uri::getInstanceFromString("sqlite://" . $this->host)
->withQueryKeyValue(DbPdoDriver::STATEMENT_CACHE, "true")
->withQueryKeyValue(DbPdoDriver::DONT_PARSE_PARAM, "");