Date: 10/24/99
- Next message: Kristian Koehntopp: "[PHPLIB-DEV] Please check out and test"
- Previous message: Kristian Koehntopp: "[PHPLIB-DEV] cvs commit"
- Next in thread: negro: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: kk
Date: Sun Oct 24 16:40:02 1999
Removed files:
php-lib/stuff/patch.odbc
Modified files:
php-lib/CHANGES
php-lib/php/db_oracle.inc
php-lib/php/oohforms.inc
php-lib/php/table.inc
Log message:
- removal of stuff/patch.odbc, as it referred to the UID column name
problem.
- update of db_oracle.inc as contributed.
- oohforms elements now report their type.
- table bug reported by MarkN fixed.
Index: php-lib/CHANGES
diff -u php-lib/CHANGES:1.109 php-lib/CHANGES:1.110
--- php-lib/CHANGES:1.109 Sun Oct 24 15:29:33 1999
+++ php-lib/CHANGES Sun Oct 24 16:39:30 1999
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.109 1999/10/24 13:29:33 kk Exp $
+$Id: CHANGES,v 1.110 1999/10/24 14:39:30 kk Exp $
24-Oct-1999 kk
- Documentation update, prepare for armageddon
@@ -10,6 +10,9 @@
straighter that what we had before.
- db_mssql.inc: Auto_Free spelling fix.
- Template class documented.
+ - Changes to db_oracle.inc by kir accepted.
+ - Fix to Table, regarding bug reported by Mark Nold.
+ - removed stuff/patch.odbc as UID column name is long since gone.
22-Oct-1999 kk
- New method is_registered() for Session class.
Index: php-lib/php/db_oracle.inc
diff -u php-lib/php/db_oracle.inc:1.14 php-lib/php/db_oracle.inc:1.15
--- php-lib/php/db_oracle.inc:1.14 Sun Jul 25 08:02:43 1999
+++ php-lib/php/db_oracle.inc Sun Oct 24 16:39:30 1999
@@ -4,7 +4,7 @@
*
* Copyright (c) 1998,1999 Luis Francisco Gonzalez Hernandez
*
- * $Id: db_oracle.inc,v 1.14 1999/07/25 06:02:43 ssilk Exp $
+ * $Id: db_oracle.inc,v 1.15 1999/10/24 14:39:30 kk Exp $
*
*/
@@ -35,8 +35,9 @@
/* copied from db_mysql for completeness */
/* public: identification constant. never change this. */
var $type = "oracle";
- var $revision = "\$Revision: 1.14 $";
+ var $revision = "1.2";
+ var $Halt_On_Error = "yes"; ## "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning)
/* public: constructor */
function DB_Sql($query = "") {
@@ -87,6 +88,7 @@
$this->halt("connect() Link-ID == false " .
"($this->Link_ID), ora_plogon failed");
} else {
+ //echo "commit on<p>";
ora_commiton($this->Link_ID);
}
if($this->Debug) {
@@ -303,10 +305,9 @@
## this is the important part and it is also the HACK!
if (eregi("^[[:space:]]*SELECT[[:space:]]",$this->lastQuery) ) {
- $q=eregi_Replace("^[[:space:]]*SELECT[[:space:]]+".
- ".*[[:space:]]+FROM",
- "SELECT COUNT(*) FROM",
- $this->lastQuery);
+ $from_pos = strpos(strtoupper($this->lastQuery),"FROM");
+ $q = "SELECT count(*) ". substr($this->lastQuery, $from_pos);
+
ORA_parse($curs,$q);
ORA_exec($curs);
ORA_fetch($curs);
@@ -338,6 +339,43 @@
print $this->Record[$Name];
}
+ /* public: sequence number */
+ function nextid($seq_name)
+ {
+ $this->connect();
+
+ /* Independent Query_ID */
+ $Query_ID = ora_open($this->Link_ID);
+
+ if(! <email protected>($Query_ID,"SELECT $seq_name.NEXTVAL FROM DUAL"))
+ {
+ // There is no such sequence yet, then create it
+ if(! <email protected>($Query_ID,"CREATE SEQUENCE $seq_name")
+ ||
+ ! <email protected>($Query_ID)
+ )
+ {
+ $this->halt("<BR> nextid() function - unable to create sequence");
+ return 0;
+ }
+ <email protected>($Query_ID,"SELECT $seq_name.NEXTVAL FROM DUAL");
+ }
+ if (! <email protected>($Query_ID)) {
+ $this->halt("<BR>ora_exec() failed:<BR>nextID function");
+ }
+ if ( <email protected>($Query_ID) ) {
+ $next_id = ora_getcolumn($Query_ID, 0);
+ }
+ else {
+ $next_id = 0;
+ }
+ if ( Query_ID > 0 ) {
+ ora_close(Query_ID);
+ }
+
+ return $next_id;
+ }
+
function disconnect() {
if($this->Debug) {
echo "Debug: Disconnecting $this->Query_ID...<br>\n";
@@ -350,12 +388,22 @@
$this->Query_ID=0;
}
+ /* private: error handling */
function halt($msg) {
- printf("</td></tr></table><BR><b>Database error:</b> %s<br>\n", $msg);
- printf("<b>ORACLE Error</b>: %s (%s)<br>\n",
+ if ($this->Halt_On_Error == "no")
+ return;
+
+ $this->haltmsg($msg);
+
+ if ($this->Halt_On_Error != "report")
+ die("Session halted.");
+ }
+
+ function haltmsg($msg) {
+ printf("</td></tr></table><b>Database error:</b> %s<br>\n", $msg);
+ printf("<b>Oracle Error</b>: %s (%s)<br>\n",
$this->Errno,
$this->Error);
- die("Session halted.");
}
function table_names() {
Index: php-lib/php/oohforms.inc
diff -u php-lib/php/oohforms.inc:1.16 php-lib/php/oohforms.inc:1.17
--- php-lib/php/oohforms.inc:1.16 Thu Oct 21 21:31:32 1999
+++ php-lib/php/oohforms.inc Sun Oct 24 16:39:31 1999
@@ -5,7 +5,7 @@
*
* Copyright (c) 1998 by Jay Bloodworth
*
- * $Id: oohforms.inc,v 1.16 1999/10/21 19:31:32 kk Exp $
+ * $Id: oohforms.inc,v 1.17 1999/10/24 14:39:31 kk Exp $
*/
class of_element {
@@ -246,6 +246,7 @@
$el["multiple"] = true;
}
$el = new $t($el);
+ $el->type = $t; # as suggested by Michael Graham (magog <email protected>)
if ($el->isfile)
$this->isfile = true;
$this->elements[$el->name]["ob"] = $el;
Index: php-lib/php/table.inc
diff -u php-lib/php/table.inc:1.17 php-lib/php/table.inc:1.18
--- php-lib/php/table.inc:1.17 Sun Oct 24 12:21:24 1999
+++ php-lib/php/table.inc Sun Oct 24 16:39:31 1999
@@ -6,7 +6,7 @@
* Boris Erdmann, Kristian Koehntopp,
* Jeffrey Galbraith
*
- * $Id: table.inc,v 1.17 1999/10/24 10:21:24 kk Exp $
+ * $Id: table.inc,v 1.18 1999/10/24 14:39:31 kk Exp $
*
* History: 990617: Modularized entire table class. Modularity breaks larger
* objects into smaller, autonomous objects in order to
@@ -106,7 +106,7 @@
{
global $debug;
- if (!verify_2d_array($ary))
+ if (!$this->verify_2d_array($ary))
return 0;
$rows = 0;
@@ -132,7 +132,7 @@
#==========================================================================
function show_result($db, $class="")
{
- if (!verify_db($db))
+ if (!$this->verify_db($db))
return 0;
$rows = 0;
@@ -162,7 +162,7 @@
{
global $debug;
- if (!verify_2d_array($ary))
+ if (!$this->verify_2d_array($ary))
return 0;
$rows = 0;
@@ -192,7 +192,7 @@
{
global $debug;
- if (!verify_db($db))
+ if (!$this->verify_db($db))
return 0;
$rows = 0;
@@ -223,7 +223,7 @@
#==========================================================================
function show_table_heading_row($ary, $class="")
{
- if (!verify_2d_array($ary))
+ if (!$this->verify_2d_array($ary))
return 0;
if (isset($this->heading) && $this->heading)
@@ -248,14 +248,14 @@
#==========================================================================
function show_table_heading_row_result($db, $class="")
{
- if (!verify_db($db))
+ if (!$this->verify_db($db))
return 0;
if ($this->heading)
{
// (Jeff) ------------------------------
// if ($db->num_rows() > 0 && $db->next_record())
-// rows are confirmed in verify_db(), so no need to reverify
+// rows are confirmed in $this->verify_db(), so no need to reverify
// -------------------------------------
if ($db->next_record())
{
@@ -325,7 +325,7 @@
if ($debug)
printf("<p>show_table_rows()<br>\n");
- if (!verify_2d_array($ary))
+ if (!$this->verify_2d_array($ary))
return 0;
$row = 0;
@@ -358,7 +358,7 @@
if ($debug)
printf("<p>show_table_rows_result()<br>\n");
- if (!verify_db($db))
+ if (!$this->verify_db($db))
return 0;
$row = 0;
@@ -395,7 +395,7 @@
if ($debug)
printf("<p>show_table_page_rows()<br>\n");
- if (!verify_2d_array($ary))
+ if (!$this->verify_2d_array($ary))
return 0;
$row = 0;
@@ -435,7 +435,7 @@
if ($debug)
printf("<p>show_table_page_rows_result()<br>\n");
- if (!verify_db($db))
+ if (!$this->verify_db($db))
return 0;
$row = $start;
@@ -555,7 +555,7 @@
if ($debug)
printf("<p>show_table_heading_cells()<br>\n");
- if (!verify_array($data))
+ if (!$this->verify_array($data))
return 0;
$cell = 0;
@@ -591,7 +591,7 @@
if ($debug)
printf("<p>show_table_cells()<br>\n");
- if (!verify_array($data))
+ if (!$this->verify_array($data))
return 0;
$cell = 0;
@@ -654,7 +654,7 @@
$this->table_heading_cell_open($class);
## Check for column name remapping
- if (verify_array($this->map_cols))
+ if ($this->verify_array($this->map_cols))
{
reset($this->map_cols);
while(list($key, $name) = each($this->map_cols))
@@ -761,7 +761,7 @@
#==========================================================================
function verify_2d_array($ary)
{
- if (!verify_array($ary))
+ if (!$this->verify_array($ary))
return 0;
reset($ary);
@@ -839,13 +839,10 @@
while(list($key, $val) = each($data))
{
if (ereg($this->filter, $key))
- $d[] = $key;
+ $this->fields[] = $key;
}
}
- else
- {
- $d = $this->fields;
- }
+ $d = $this->fields;
if ($debug)
{
-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.
- Next message: Kristian Koehntopp: "[PHPLIB-DEV] Please check out and test"
- Previous message: Kristian Koehntopp: "[PHPLIB-DEV] cvs commit"
- Next in thread: negro: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

