Date: 07/01/00
- Next message: kir: "[phplib-dev] cvs commit"
- Next in thread: kir: "[phplib-dev] cvs commit"
- Maybe reply: kir: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: kir
Date: Sun Jul 2 00:09:06 2000
Modified files:
php-lib/CHANGES
php-lib/php/db/oracle/db_sql.inc
php-lib/php/db/pgsql/db_sql.inc
Log message:
- Added DB_Sql($query) constructor for pgsql/db_sql.inc
- Code cleanup for oracle/db_sql.c
Index: php-lib/CHANGES
diff -u php-lib/CHANGES:1.179 php-lib/CHANGES:1.180
--- php-lib/CHANGES:1.179 Sat Jul 1 01:03:56 2000
+++ php-lib/CHANGES Sun Jul 2 00:08:33 2000
@@ -1,4 +1,8 @@
-$Id: CHANGES,v 1.179 2000/06/30 23:03:56 athompso Exp $
+$Id: CHANGES,v 1.180 2000/07/01 22:08:33 kir Exp $
+
+02-Jul-2000 kir
+ - Added DB_Sql($query) constructor for pgsql/db_sql.inc
+ - Code cleanup for oracle/db_sql.c
30-Jun-2000 athompso
- Added null-query special case handling to db_pgsql.inc
Index: php-lib/php/db/oracle/db_sql.inc
diff -u php-lib/php/db/oracle/db_sql.inc:1.1 php-lib/php/db/oracle/db_sql.inc:1.2
--- php-lib/php/db/oracle/db_sql.inc:1.1 Thu Apr 13 15:06:59 2000
+++ php-lib/php/db/oracle/db_sql.inc Sun Jul 2 00:08:34 2000
@@ -4,47 +4,64 @@
*
* Copyright (c) 1998,1999 Luis Francisco Gonzalez Hernandez
*
- * $Id: db_sql.inc,v 1.1 2000/04/13 13:06:59 kk Exp $
+ * $Id: db_sql.inc,v 1.2 2000/07/01 22:08:34 kir Exp $
*
*/
-class DB_Sql {
- var $Debug = false;
- var $Home = "/u01/app/oracle/product/8.0.4";
- var $Remote = 1;
- /* This Query will be sent directly after the first connection
- Example:
- var $ConnectQuery="ALTER SESSION SET nls_date_language=german nls_date_format='DD.MM.RRRR'";
- -> Set the date format for this session, this is fine when your ora-role
- cannot be altered */
- var $ConnectQuery='';
- /* Due to a strange error with Oracle 8.0.5, Apache and PHP3.0.6
- you don't need to set the ENV - on my system Apache
- will change to a zombie, if I don't set this to FALSE!
- Instead I set these ENV-vars before the startup of apache.
- If unsure try it out, if it works. */
- var $OraPutEnv = true;
+class DB_Sql
+{
- var $Database = "";
+ // public: connection parameters:
+ var $Home = "/opt/oracle/product/8.0.4"; // ORACLE_HOME
+ var $Database = ""; // Remote ? TNS name : SID
var $User = "";
var $Password = "";
+ var $Remote = true; // Set to false if
+ // $Database contains
+ // ORACLE_SID
+
+ // public: configuration parameters
+ var $Debug = false;
+
+ // This Query will be sent directly after the first connection
+ // Example:
+ // var $ConnectQueryi="ALTER SESSION SET nls_date_language=german nls_date_format='DD.MM.RRRR'";
+ // Set the date format for this session, this is fine when your ora-role
+ // cannot be altered
+ var $ConnectQuery = "";
+
+ // Due to a strange error with Oracle 8.0.5, Apache and PHP3.0.6
+ // you don't need to set the ENV - on my system Apache
+ // will change to a zombie, if I don't set this to FALSE!
+ // Instead I set these ENV-vars before the startup of apache.
+ // If unsure try it out, if it works.
+ var $OraPutEnv = true;
- var $Link_ID = 0;
- var $Query_ID = 0;
- var $Record = array();
+ // public: result array and current row number
+ var $Record = array();
var $Row;
- var $Errno = 0;
- var $Error = "";
- var $ora_no_next_fetch=false;
+ // public: current error number and error text
+ var $Errno = 0;
+ var $Error = "";
+ // Error handling:
+ // yes - report && die
+ // report - report && continue
+ // no - ignore
+ var $Halt_On_Error = "yes";
-
- /* copied from db_mysql for completeness */
- /* public: identification constant. never change this. */
+ // public: identification constant, never change this
var $type = "oracle";
- var $revision = "Revision: 1.3";
- var $Halt_On_Error = "yes"; ## "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning)
+ // public: this is an api revision, not a CVS revision.
+ var $revision = "1.3";
+
+ // private: link and query handles
+ var $Link_ID = 0;
+ var $Query_ID = 0;
+ // private: seek() function helper
+ var $ora_no_next_fetch=false;
+
/* public: constructor */
function DB_Sql($query = "") {
$this->query($query);
@@ -59,8 +76,9 @@
return $this->Query_ID;
}
+ /* public: connection handling .... */
function connect() {
- ## see above why we do this
+ // see above why we do this
if ($this->OraPutEnv) {
PutEnv("ORACLE_SID=$this->Database");
PutEnv("ORACLE_HOME=$this->Home");
@@ -73,30 +91,34 @@
if($this->Debug) {
printf("<br>connect() $this->User/******@$this->Database<br>\n");
}
- $this->Link_ID=ora_plogon
+ $this->Link_ID = <email protected>
("$this->User/$this->Password@$this->Database","");
- /************** (comment by SSilk)
- this dosn't work on my system:
- $this->Link_ID=ora_plogon
- ("$this->User@$this->Database.world","$this->Password");
- ***************/
} else {
if($this->Debug) {
printf("<br>connect() $this->User, $this->Password <br>\n");
}
- $this->Link_ID=ora_plogon("$this->User","$this->Password");
- /* (comment by SSilk: don't know how this could work, but I leave this untouched!) */
+ $this->Link_ID = <email protected>("$this->User","$this->Password");
+ /* (comment by SSilk: don't know how this could work,
+ but I leave this untouched!)
+ KIR: It is the case when this->Database is ORACLE_SID
+ */
}
if($this->Debug) {
printf("<br>connect() Link_ID: $this->Link_ID<br>\n");
}
if (!$this->Link_ID) {
- $this->halt("connect() Link-ID == false " .
- "($this->Link_ID), ora_plogon failed");
- } else {
- //echo "commit on<p>";
- ora_commiton($this->Link_ID);
- }
+
+ $this->Errno = <email protected>(0);
+ $this->Error = <email protected>(0);
+
+ $this->halt("connect() Link-ID == false " .
+ ", ora_plogon failed");
+ return;
+ }
+
+ // Switch auto-commit on
+ ora_commiton($this->Link_ID);
+
if($this->Debug) {
printf("<br>connect() Obtained the Link_ID: $this->Link_ID<br>\n");
}
Index: php-lib/php/db/pgsql/db_sql.inc
diff -u php-lib/php/db/pgsql/db_sql.inc:1.3 php-lib/php/db/pgsql/db_sql.inc:1.4
--- php-lib/php/db/pgsql/db_sql.inc:1.3 Sat Jul 1 01:03:57 2000
+++ php-lib/php/db/pgsql/db_sql.inc Sun Jul 2 00:08:35 2000
@@ -5,7 +5,7 @@
* Copyright (c) 1998,1999 NetUSE GmbH
* Boris Erdmann, Kristian Koehntopp
*
- * $Id: db_sql.inc,v 1.3 2000/06/30 23:03:57 athompso Exp $
+ * $Id: db_sql.inc,v 1.4 2000/07/01 22:08:35 kir Exp $
*
*/
@@ -32,6 +32,12 @@
if("" != $add) return " ".$me.$add;
}
+ /* public: constructor */
+ function DB_Sql($query = "") {
+ $this->query($query);
+ }
+
+
function connect() {
if ( 0 == $this->Link_ID ) {
$cstr = "dbname=".$this->Database.
@@ -47,9 +53,15 @@
}
function query($Query_String) {
+
+ /* No empty queries, please, since PHP4 chokes on them. */
if ($Query_String == "")
+ /* The empty query string is passed on from the constructor,
+ * when calling the class without a query, e.g. in situations
+ * like these: '$db = new DB_Sql_Subclass;'
+ */
return 0;
-
+
$this->connect();
# printf("<br>Debug: query = %s<br>\n", $Query_String);
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected>
For additional commands, e-mail: phplib-dev-help <email protected>
- Next message: kir: "[phplib-dev] cvs commit"
- Next in thread: kir: "[phplib-dev] cvs commit"
- Maybe reply: kir: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: kk: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

