Date: 07/02/01
- Next message: jairo: "[phplib] Trying to test phplib"
- Previous message: Chris Johnson: "RE: [phplib] Phplib and Informix"
- Maybe in reply to: White, Bob: "[phplib] Table.inc under Oracle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
there are numerous problems with the table class and oracle. Here is a
class I wrote to extend table.inc. It should fix the problems you are
having and add some additional functionality. (I needed a pre and post
column)
-- Jesse Swensen swensenj <email protected>> From: White, Bob [mailto:rcwhite <email protected>] > To: phplib <email protected> > Subject: [phplib] Table.inc under Oracle > > > Hi All, > I have been monitoring this list fore a while and must have missed the > discussion of the problems with table.inc under oracle. All I get is a > header and no data. Is there a fix? > > Bob White > >
- application/applefile attachment: table_ora.inc
<?php /*****************************************************************************/ class OracleTable extends Table { var $row_count = 0; var $debug; var $add_pre; var $add_post; /***********************************************************************/ function show_result($db, $class="") { if($this->debug) printf("show_result()<br>\n"); $this->row_count = 0;
$this->table_open($class); if ($this->show_table_heading_row_result($db, $class)) { $this->show_table_rows_result($db, $class); } $this->table_close($class); } /***********************************************************************/ function show_table_heading_row_result($db, $class="") { if ($this->heading) { if ($db->next_record()) { $this->table_heading_row($db->Record, $class); ## Process a table row $this->table_row($this->row_count, $this->row_count, $db->Record, $class); $this->row_count++; return 1; } else { return 0; } } return 1; } /***********************************************************************/ function show_table_rows_result($db, $class="") { if ($this->debug) printf("show_table_rows_result()<br>\n"); while($db->next_record()) { ## Process a table row $this->table_row($this->row_count, $this->row_count, $db->Record, $class); $this->row_count++; } } /***********************************************************************/ function show_result_page($db, $start, $num, $class="") { if ($this->debug) printf("show_result_page()<br>\n");
$this->table_open($class); $this->show_table_page_rows_result($db, $start, $num, $class); $this->table_close($class); } /***********************************************************************/ function show_table_page_rows_result($db, $start, $num, $class="") { if ($this->debug) printf("show_table_page_rows_result()<br>\n"); $fin = $start + $num -1;
if(($this->row_count > $start)) { # && ($this->row_count > $fin) print "Can't display records starting at record number $start.<BR>"; exit; } ## We can't go backwards so if start >= row_count, we will just ## start from there. while((($start -1) > $this->row_count) && $db->next_record()) { $this->row_count++; } printf("<BR>"); if ($this->show_table_heading_row_result($db, $class)) { while(($this->row_count < $fin) && $db->next_record()) { ## Process a table row $this->table_row($this->row_count, $this->row_count, $db->Record, $class); $this->row_count++; } } } /***********************************************************************/ function table_row($row, $row_key, $data, $class="") { if ($this->debug) printf("<p>table_row()<br>\n");
$d = $this->select_colnames($data); $this->table_row_open($row, $d, $class); # call virtual function if ($this->add_pre) $this->table_row_add_pre($row, $row_key, $data, $class); $this->set_checkbox($row, $row_key, $data, $class); $this->show_table_cells($row, $row_key, $data, $class);
# call virtual function if ($this->add_post) $this->table_row_add_post($row, $row_key, $data, $class);
$this->table_row_close($row, $class); } /***********************************************************************/ function table_heading_row($data, $class="") { if (!is_array($data)) return;
$d = $this->select_colnames($data);
$this->table_row_open($row, $d, $class);
# call virtual function if ($this->add_pre) $this->table_heading_row_add_pre($data, $class);
$this->set_checkbox_heading($class); $this->show_table_heading_cells($data, $class);
# call virtual function if ($this->add_post) $this->table_heading_row_add_post($data, $class);
$this->table_row_close(0, $class); }
/***********************************************************************/ function table_row_add_pre($row, $row_key, $data, $class="") { }
/***********************************************************************/ function table_row_add_post($row, $row_key, $data, $class="") { } /***********************************************************************/ function table_heading_row_add_pre($row, $row_key, $data, $class="") { }
/***********************************************************************/ function table_heading_row_add_post($row, $row_key, $data, $class="") { }
# Don't use this function /***********************************************************************/ function verify_db($db) { print "This function does not work with Oracle. Don't use.<BR>"; exit; } } /*****************************************************************************/ ?>
--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: jairo: "[phplib] Trying to test phplib"
- Previous message: Chris Johnson: "RE: [phplib] Phplib and Informix"
- Maybe in reply to: White, Bob: "[phplib] Table.inc under Oracle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

