From a04a28fbb5c03984deb4937c48ae54f8bb6f6703 Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Thu, 3 Feb 2000 10:49:03 +0000 Subject: [PATCH] * Started playing around with alternatives to javadoc. * Fixed the "make install" rule so it doesn't temporarily break the installed scripts. * implemented prepare/execute emulation for MySQL including file-reference parameters (only binmode/binfetchlen remains now) * started fixing up the ODBC backend --- pear/DB.php | 121 +++++++++++++++++++++++++++++------------------ pear/Makefile.in | 13 ++--- 2 files changed, 81 insertions(+), 53 deletions(-) diff --git a/pear/DB.php b/pear/DB.php index 8a42a9fa20..1971d08b3e 100644 --- a/pear/DB.php +++ b/pear/DB.php @@ -51,6 +51,7 @@ define("DB_ERROR_CANNOT_DELETE", -16); define("DB_ERROR_CANNOT_DROP", -17); define("DB_ERROR_NOSUCHTABLE", -18); define("DB_ERROR_NOSUCHFIELD", -19); +define("DB_ERROR_NEED_MORE_DATA", -20); // }}} // {{{ Prepare/execute parameter types @@ -59,11 +60,12 @@ define("DB_ERROR_NOSUCHFIELD", -19); * These constants are used when storing information about prepared * statements (using the "prepare" method in DB_dbtype). * - * The prepare/execute model in DB is borrowed from the ODBC extension, - * in a query the "?" character means a scalar parameter, and a "*" - * character means an opaque parameter. An opaque parameter is simply - * a file name, the real data are in that file (useful for large blob - * operations). + * The prepare/execute model in DB is mostly borrowed from the ODBC + * extension, in a query the "?" character means a scalar parameter. + * There is one extension though, a "*" character means an opaque + * parameter. An opaque parameter is simply a file name, the real + * data are in that file (useful for stuff like putting uploaded files + * into your database). */ define("DB_PARAM_SCALAR", 1); define("DB_PARAM_OPAQUE", 2); @@ -117,16 +119,17 @@ class DB { // {{{ factory() /** - * Create a new DB object for the specified database type. + * Create a new DB object for the specified database + * type * - * @param $type database type + * database type * - * @return object a newly created DB object, or a DB error code on - * error + * a newly created DB object, or a DB error + * code on error */ function factory($type) { global $USED_PACKAGES; - // "include" should be replaced with "use" once PHP gets it + // "include" should be replaced with "import" once PHP gets it $pkgname = 'DB/' . $type; if (!is_array($USED_PACKAGES) || !$USED_PACKAGES[$pkgname]) { if (!@include("DB/${type}.php")) { @@ -137,24 +140,26 @@ class DB { } $classname = 'DB_' . $type; $obj = new $classname; - return $obj; + return $obj; // XXX ADDREF } // }}} // {{{ connect() /** - * Create a new DB object and connect to the specified database. + * Create a new DB object and connect to the specified + * database * - * @param $dsn "data source name", see the parseDSN method for a - * description of the dsn format. + * "data source name", see the + * method for a description of the + * dsn format. * - * @param $persistent (optional) whether this connection should be - * persistent. Ignored if the backend extension does not support - * persistent connections. + * whether this connection + * should be persistent. Ignored if the backend extension does + * not support persistent connections. * - * @return object a newly created DB object, or a DB error code on - * error + * a newly created DB object, or a DB error + * code on error */ function connect($dsn, $persistent = false) { global $USED_PACKAGES; @@ -183,9 +188,9 @@ class DB { // {{{ apiVersion() /** - * Return the DB API version. + * Return the DB API version * - * @return double the DB API version number + * the DB API version number */ function apiVersion() { return 1.00; @@ -195,11 +200,12 @@ class DB { // {{{ isError() /** - * Tell whether a result code from a DB method is an error. + * Tell whether a result code from a DB method is an + * error * - * @param $code result code + * result code * - * @return bool whether $code is an error + * whether $code is an error */ function isError($code) { return is_int($code) && ($code < 0); @@ -209,12 +215,13 @@ class DB { // {{{ errorMessage() /** - * Return a textual error message for a DB error code. + * Return a textual error message for a DB error + * code * - * @param $code error code + * error code * - * @return string error message, or false if the error code was - * not recognized + * error message, or false if the error code + * was not recognized */ function errorMessage($code) { if (!is_array($errorMessages)) { @@ -247,30 +254,50 @@ class DB { // {{{ parseDSN() /** + * Parse a data source name + * + * Data Source Name to be + * parsed + * + * + * * Parse a data source name and return an associative array with * the following keys: - * phptype Database backend used in PHP (mysql, odbc etc.) - * dbsyntax Database used with regards to SQL syntax etc. - * protocol Communication protocol to use (tcp, unix etc.) - * hostspec Host specification (hostname[:port]) - * database Database to use on the DBMS server - * username User name for login - * password Password for login - * + *
+ *
phptype
+ *
Database backend used in PHP (mysql, odbc etc.)
+ *
dbsyntax
+ *
Database used with regards to SQL syntax etc.
+ *
protocol
+ *
Communication protocol to use (tcp, unix etc.)
+ *
hostspec
+ *
Host specification (hostname[:port])
+ *
database
+ *
Database to use on the DBMS server
+ *
username
+ *
User name for login
+ *
password
+ *
Password for login
+ *
+ *
* The format of the supplied DSN is in its fullest form: - * phptype(dbsyntax)://username:password@protocol+hostspec/database + *
    + *
  • phptype(dbsyntax)://username:password@protocol+hostspec/database
  • + *
* Most variations are allowed: - * phptype://username:password@protocol+hostspec/database - * phptype://username:password@hostspec/database - * phptype://username:password@hostspec - * phptype://hostspec/database - * phptype://hostspec - * phptype(dbsyntax) - * phptype - * - * FALSE is returned on error. + *
    + *
  • phptype://username:password@protocol+hostspec/database
  • + *
  • phptype://username:password@hostspec/database
  • + *
  • phptype://username:password@hostspec
  • + *
  • phptype://hostspec/database
  • + *
  • phptype://hostspec
  • + *
  • phptype(dbsyntax)
  • + *
  • phptype
  • + *
+ *
+ *
* - * @param $dsn Data Source Name to be parsed + * FALSE is returned on error */ function parseDSN($dsn) { $parsed = array( diff --git a/pear/Makefile.in b/pear/Makefile.in index 3074fc69d1..b4cb2a3a49 100644 --- a/pear/Makefile.in +++ b/pear/Makefile.in @@ -11,7 +11,6 @@ include $(topsrcdir)/build/rules.mk peardir=$(prefix)/lib/php pear_DBdir=$(prefix)/lib/php/DB - install-data-local: -@$(mkinstalldirs) $(peardir) $(pear_DBdir) && \ $(INSTALL_DATA) $(srcdir)/DB.php $(peardir) && \ @@ -39,14 +38,16 @@ install-build: echo "creating phpize" && \ sed \ -e 's#@PREFIX@#$(prefix)#' \ - < $(srcdir)/phpize.in > $(bindir)/phpize && \ - chmod +x $(bindir)/phpize && \ + < $(srcdir)/phpize.in > $(bindir)/phpize.tmp && \ + chmod +x $(bindir)/phpize.tmp && \ + mv $(bindir)/phpize.tmp $(bindir)/phpize && \ echo "creating php-config" && \ sed \ -e 's#@PREFIX@#$(prefix)#' \ -e 's#@PHPINCLUDEDIR@#$(phpincludedir)#g' \ - < $(srcdir)/php-config.in > $(bindir)/php-config && \ - chmod +x $(bindir)/php-config + < $(srcdir)/php-config.in > $(bindir)/php-config.tmp && \ + chmod +x $(bindir)/php-config.tmp && \ + mv $(bindir)/php-config.tmp $(bindir)/php-config && SRC_HEADERS = \ php.h \ @@ -68,7 +69,7 @@ BUILD_HEADERS = \ STANDARD_HEADERS = \ php_output.h - + HEADER_DIRS = \ Zend \ TSRM \ -- 2.40.0