[phpwebapp-commits] CVS: web_app/database package.DB.php,1.5,1.6 class.TableRS.php,1.5,1.6 class.Sta
Brought to you by:
dashohoxha
|
From: Dashamir H. <das...@us...> - 2003-09-09 05:02:08
|
Update of /cvsroot/phpwebapp/web_app/database
In directory sc8-pr-cvs1:/tmp/cvs-serv17598/database
Modified Files:
package.DB.php class.TableRS.php class.StaticRS.php
class.Recordset.php class.PagedRS.php
Log Message:
Index: package.DB.php
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/database/package.DB.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** package.DB.php 25 Aug 2003 13:18:32 -0000 1.5
--- package.DB.php 8 Sep 2003 13:18:24 -0000 1.6
***************
*** 55,58 ****
--- 55,59 ----
* can create and use other connections as well, or override this one.
*/
+ include_once CONFIG_PATH."const.DB.php";
$cnn = new $CnnType;
}
Index: class.TableRS.php
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/database/class.TableRS.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** class.TableRS.php 25 Aug 2003 13:18:32 -0000 1.5
--- class.TableRS.php 8 Sep 2003 13:18:24 -0000 1.6
***************
*** 21,25 ****
! include_once DB_PATH."class.Recordset.php";
/**
--- 21,25 ----
! include_once DB_PATH."class.EditableRS.php";
/**
Index: class.StaticRS.php
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/database/class.StaticRS.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** class.StaticRS.php 25 Aug 2003 13:18:32 -0000 1.5
--- class.StaticRS.php 8 Sep 2003 13:18:24 -0000 1.6
***************
*** 44,48 ****
}
! function Open()
{
if ($this->opened)
--- 44,48 ----
}
! function Open($conn =UNDEFINED)
{
if ($this->opened)
***************
*** 51,55 ****
return; //don't open it a second time
}
! if ($this->query<>"") Recordset::Open();
$this->opened = true;
}
--- 51,55 ----
return; //don't open it a second time
}
! if ($this->query<>"") Recordset::Open($conn);
$this->opened = true;
}
Index: class.Recordset.php
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/database/class.Recordset.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** class.Recordset.php 25 Aug 2003 13:18:32 -0000 1.7
--- class.Recordset.php 8 Sep 2003 13:18:24 -0000 1.8
***************
*** 103,107 ****
$this->ID = $id;
$this->query = $query;
! $this->cnn = ($conn==UNDEFINED ? $cnn : $conn);
$this->content = array();
$this->count = 0;
--- 103,114 ----
$this->ID = $id;
$this->query = $query;
! if ($conn==UNDEFINED)
! {
! $this->cnn = &$cnn;
! }
! else
! {
! $this->cnn = $conn;
! }
$this->content = array();
$this->count = 0;
***************
*** 110,117 ****
}
! /** Executes the query and puts the result into $this->content. */
! function Open($q =UNDEFINED)
{
- if ($q<>UNDEFINED) $this->query = $q;
$query = $this->query;
if ($query==UNDEFINED) return;
--- 117,126 ----
}
! /**
! * Executes the query and puts the result into $this->content.
! * If $conn is given, it is used instead of its own connection.
! */
! function Open($conn =UNDEFINED)
{
$query = $this->query;
if ($query==UNDEFINED) return;
***************
*** 120,124 ****
$query = WebApp::replaceVars($query);
! $result = $this->cnn->execQuery($query, $this->ID);
if (is_array($result))
{
--- 129,141 ----
$query = WebApp::replaceVars($query);
! if ($conn==UNDEFINED)
! {
! $result = $this->cnn->execQuery($query, $this->ID);
! }
! else
! {
! $result = $conn->execQuery($query, $this->ID);
! }
!
if (is_array($result))
{
***************
*** 126,129 ****
--- 143,147 ----
$this->count = count($result);
$this->pos = 0;
+ return;
}
else
Index: class.PagedRS.php
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/database/class.PagedRS.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** class.PagedRS.php 25 Aug 2003 13:18:32 -0000 1.6
--- class.PagedRS.php 8 Sep 2003 13:18:24 -0000 1.7
***************
*** 70,80 ****
/** Executes the query and puts the result into $this->content. */
! function Open($cp ="default", $rp ="default", $query ="default")
{
! global $cnn;
!
! if ($query<>"default") $this->query = $query;
! if ($rp<>"default") $this->recs_per_page = $rp;
! if ($cp=="default")
{
//default is to get it from SVars
--- 70,76 ----
/** Executes the query and puts the result into $this->content. */
! function Open($cp =UNDEFINED, $conn =UNDEFINED)
{
! if ($cp==UNDEFINED)
{
//default is to get it from SVars
***************
*** 87,91 ****
$this->nr_of_recs = $this->get_nr_of_recs();
$nr_of_pages = ceil($this->nr_of_recs / $this->recs_per_page);
! if ($this->current_page>$nr_of_pages) $this->current_page=$nr_of_pages;
//modify and execute the query
--- 83,87 ----
$this->nr_of_recs = $this->get_nr_of_recs();
$nr_of_pages = ceil($this->nr_of_recs / $this->recs_per_page);
! if ($this->current_page > $nr_of_pages) $this->current_page = $nr_of_pages;
//modify and execute the query
***************
*** 93,97 ****
$query = WebApp::replaceVars($this->query);
$query .= " LIMIT $first_rec_idx, ".$this->recs_per_page;
! $result = $this->cnn->execQuery($query);
$this->content = $result;
--- 89,100 ----
$query = WebApp::replaceVars($this->query);
$query .= " LIMIT $first_rec_idx, ".$this->recs_per_page;
! if ($conn==UNDEFINED)
! {
! $result = $this->cnn->execQuery($query, $this->ID);
! }
! else
! {
! $result = $conn->execQuery($query, $this->ID);
! }
$this->content = $result;
|