{"id":15021918,"url":"https://github.com/php/pecl-database-pdo_user","last_synced_at":"2025-10-19T22:31:49.573Z","repository":{"id":7217770,"uuid":"8524662","full_name":"php/pecl-database-pdo_user","owner":"php","description":"Userspace driver for PDO","archived":false,"fork":false,"pushed_at":"2013-03-02T21:33:09.000Z","size":240,"stargazers_count":6,"open_issues_count":0,"forks_count":9,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-29T21:22:56.579Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://pecl.php.net/package/pdo_user","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php.png","metadata":{"files":{"readme":"README.OBJECTS","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-02T18:05:07.000Z","updated_at":"2022-11-21T03:20:33.000Z","dependencies_parsed_at":"2022-09-04T22:52:27.043Z","dependency_job_id":null,"html_url":"https://github.com/php/pecl-database-pdo_user","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-database-pdo_user","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-database-pdo_user/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-database-pdo_user/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-database-pdo_user/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php","download_url":"https://codeload.github.com/php/pecl-database-pdo_user/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237224777,"owners_count":19275085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T19:57:13.254Z","updated_at":"2025-10-19T22:31:44.239Z","avatar_url":"https://github.com/php.png","language":"C","readme":"PDO Userspace Driver\n--------------------\n\nThis extension exports three class definitions (two interfaces plus one static class):\n\ninterface PDO_User_Driver {\n\tfunction __construct($dsn, $user, $pass, $options) {\n\t\t/* new PDO('user:driver=classname;...') */\n\t}\n\n\tfunction pdo_prepare($sql, $options) {\n\t\t/* PDO::prepare() or PDO::query() */\n\n\t\tif (SUCCESS) {\n\t\t\treturn new Object_Implementing_PDO_User_Statement($optional, $parameters);\n\t\t} else {\n\t\t\t/* If your class will be unable to perform the query, return false here to indicate failure */\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_do($sql) {\n\t\t/* PDO::exec() */\n\t\tif (SUCCESS) {\n\t\t\treturn $rowsAffected;\n\t\t} else {\n\t\t\treturn FALSE; /* NULL or a negative number may also be used to indicate failure */\n\t\t}\n\t}\n\n\tfunction pdo_quote($string) {\n\t\t/* PDO::quote() */\n\n\t\t/* There is no \"failure\" mode for this method, you must return something */\n\t\treturn $modifiedString;\n\t}\n\n\tfunction pdo_begin() {\n\t\t/* PDO::beginTransaction() */\n\t\tif (SUCCESS) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_commit() {\n\t\t/* PDO::commit() */\n\t\tif (SUCCESS) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_rollback() {\n\t\t/* PDO::rollBack() */\n\t\tif (SUCCESS) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_lastInsertID($seq) {\n\t\t/* PDO::lastInsertID() */\n\n\t\t/* There is no \"failure\" mode for this method, you must return something */\n\t\treturn $lastIDString;\n\t}\n\n\tfunction pdo_checkLiveness() {\n\t\t/* Called by PDO internally */\n\t\treturn $driverIsAliveBool;\n\t}\n\n\tfunction pdo_setAttribute($attr, $val) {\n\t\t/* PDO::setAttribute($attr, $val) */\n\n\t\t/* $attr == PDO::ATTR_* */\n\t\tif (SUCCESS) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_getAttribute($attr) {\n\t\t/* PDO::getAttribute($attr) */\n\n\t\t/* $attr == PDO::ATTR_* */\n\t\tif (SUCCESS) {\n\t\t\treturn $attributeValue;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_close() {\n\t\t/* Called when shutting down a database handle - e.g. unset($pdoHandle); */\n\n\t\t/* Return value ignored */\n\t}\n\n\tfunction pdo_fetchError() {\n\t\t/* PDO::errorInfo */\n\n\t\treturn array(0 =\u003e 12345, 1 =\u003e 'Error 12345 has occured...blah...blah...blah');\n\t}\n}\n\ninterface PDO_User_Statement {\n\tfunction pdo_execute() {\n\t\t/* PDO_Statement::execute() */\n\n\t\t/* The result of emulated bound parameters may be retreived via: */\n\t\t$resultQuery = PDO_User::statementParam($this, PDO_User::STATEMENT_PARAM_ACTIVE_QUERY);\n\n\t\tif (SUCCESS) {\n\t\t\treturn array('rows' =\u003e $numberOfRowsInSet, 'cols' =\u003e $numberOfColsInSet);\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_fetch($orientation, $offset) {\n\t\t/* PDO_Statement::fetch() and family */\n\n\t\t/* This method should only adjust the current cursor's position,\n\t\t * getcol() will be used to actually retreive the data */\n\n\t\t/* $orientation is one of PDO::FETCH_ORI_*\n\t\t * $offset is a relative position to the location tagged by $orientation */\n\t\tif (SUCCESS) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\t/* e.g. - No more rows */\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_nextRowset() {\n\t\t/* PDO_Statement::nextRowset() */\n\n\t\tif (SUCCESS) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_describe($columnNumber) {\n\t\t/* Called after PDO_Statement::execute() to determine column names,\n\t\t * also used by PDO_Statement::getColumnMeta() */\n\t\treturn array('name' =\u003e $nameOfColumn, 'maxlen' =\u003e $maximumLengthOfDataInColumn);\n\t}\n\n\tfunction pdo_colmeta($columnNumber) {\n\t\t/* PDO_Statement::getColumnMeta() */\n\t\t/* Return as many of the supported fields as possible,\n\t\t * custom fields may also be returned by prefixing with user: */\n\t\treturn array('scale' =\u003e $floatingPointScale,\n\t\t\t\t\t 'table' =\u003e $sourceTable,\n\t\t\t\t\t 'type' =\u003e $phpTypeName, /* e.g. 'string', 'integer', 'bool' */\n\t\t\t\t\t 'native_type' =\u003e $dbTypeName, /* e.g. 'char', 'blog', 'double' */\n\t\t\t\t\t 'flags' =\u003e array(\t'primary_key',\n\t\t\t\t\t\t\t\t\t\t'not_null',\n\t\t\t\t\t\t\t\t\t\t'unique_key',\n\t\t\t\t\t\t\t\t\t\t'multiple_key',\n\t\t\t\t\t\t\t\t\t\t'unsigned',\n\t\t\t\t\t\t\t\t\t\t'auto_increment',\n\t\t\t\t\t\t\t\t\t\t'blob',\n\t\t\t\t\t\t\t\t\t\t'user:foo', /* custom flag(s) */\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t'user:bar' =\u003e 'baz' /* custom metadata(s) */\n\t\t\t);\n\t}\n\n\tfunction pdo_getcol($columnNumber) {\n\t\t/* Called by PDO_Statement::fetch() family of functions */\n\n\t\treturn $contentsOfColumnForCurrentRow;\n\t}\n\n\tfunction pdo_paramhook($event, $columnNumber, $columnName, $isParam, \u0026$parameter) {\n\t\t/* Called before and after EXEC and FETCH events */\n\t\t/* $event is one of PDO::PARAM_EVT_EXEC_* or PDO_PARAM_EVT_FETCH_*\n\t\t * $columnNumber / $columnName are the identifiers of the column, either or both may be available\n\t\t * $isParam is TRUE for placeholder parameters (e.g. WHERE foo = ?), it is FALSE for result parameters (e.g. SELECT col1)\n\t\t * $parameter is the actual bound variable and is always passed by reference */\n\n\t\t/* Return value is ignored */\n\t}\n\n\tfunction pdo_setAttribute($attr, $val) {\n\t\t/* PDO_Statement::setAttribute($attr, $val) */\n\n\t\t/* $attr == PDO::ATTR_* */\n\t\tif (SUCCESS) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_getAttribute($attr) {\n\t\t/* PDO_Statement::getAttribute($attr) */\n\n\t\t/* $attr == PDO::ATTR_* */\n\t\tif (SUCCESS) {\n\t\t\treturn $attributeValue;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_closeCursor() {\n\t\t/* PDO_Statement::closeCursor() */\n\n\t\tif (SUCCESS) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction pdo_close() {\n\t\t/* Called with shutting down a statement */\n\n\t\t/* Return value ignored */\n\t}\n}\n\nclass PDO_User {\n\tfunction parseDSN($dsn, $params) {\n\t\t/* Parses a DSN string in the format: var1=val1;var2=val2;var3=val3;...\n\t\t * For the variables named in $params, For example:\n\n\t\t\t$result = PDO_User::parseDSN('host=localhost;port=3306', array('host','port'));\n\t\t\tprint_r($result);\n\n\t\t * Results in:\n\n\t\t\tArray(2) {\n\t\t\t\t[host] =\u003e localhost\n\t\t\t\t[port] =\u003e 3306\n\t\t\t}\n\n\t\t */\n\t}\n\n\tfunction driverParam($attribute[, $value]) {\n\t\t/* $attribute is one of:\n\t\t\tPDO_User::DRIVER_PARAM_MAX_ESCAPSED_CHAR_LENGTH\t\t(used by emulated prepared statement routines internally)\n\t\t\tPDO_User::DRIVER_PARAM_DATA_SOURCE\t\t\t\t\t(refers to the $dsn passed to the driver class' constructor)\n\t\t\tPDO_User::DRIVER_PARAM_SQLSTATE\t\t\t\t\t\t(Driver's current SQLSTATE value)\n\n\t\t\tPDO_User::STATEMENT_PARAM_ACTIVE_QUERY\t\t\t\t(Post-transformation emulated prepared statement result)\n\t\t\tPDO_User::STATEMENT_PARAM_SQLSTATE\t\t\t\t\t(Statement's current SQLSTATE value)\n\t\t \n\t\t * When $value is passed, the parameter will be set to this new value\n\t\t * Whether or not $value is passed, the current value will be returned */\n\t}\n\n\tfunction tokenizeSQL($sql[, $ignore_whitespace = true]) {\n\t\t/* Split a standard SQL statement into token pieces interpolating some escape sequences in ``, '', and \"\" pairs\n\t\t\t\\\\\t\tLiteral backslash\n\t\t\t\\000\tInterpolated to character with identified octal value\n\t\t\t\\x00\tInterpolated to character with identified hex value\n\t\t\t\\r\t\tCarriage Return (0x0D)\n\t\t\t\\n\t\tLine Feed (0x0A)\n\t\t\t\\t\t\tTab (0x09)\n\t\t\t\\'\t\tSingle Quote (Only interpolated within '' strings)\n\t\t\t\\\"\t\tDouble Quote (Only interpolated within \"\" strings)\n\t\t\t\\`\t\tBacktick (Only interpolated witin `` strings)\n\n\t\t\tAny other escape sequence will be interpolated as it's literal value, e.g.:\n\t\t\t\\a\t\tLiteral backslash followed by the letter a\n\n\t\t\tReturns a 2D array of arrays containing the token id and the source text it came from. */\n\t}\n\n\tfunction tokenName($tokenid) {\n\t\t/* Returns the textual name of the token ID returned by tokenizeSQL(), e.g.:\n\t\t\tPU_SELECT\n\t\t\tPU_STRING\n\t\t\tPU_WHITESPACE\n\t\t\tetc... */\n\t}\n\n\tfunction parseSQL($sql) {\n\t\t/* Parse a standard SQL string into a query expression tree */\n\t}\n}\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp%2Fpecl-database-pdo_user","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp%2Fpecl-database-pdo_user","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp%2Fpecl-database-pdo_user/lists"}