[limb-svn] r6056 - 3.x/trunk/limb/dbal/src
svn at limb-project.com
svn at limb-project.com
Tue Jul 3 14:54:53 MSD 2007
Author: serega
Date: 2007-07-03 14:54:53 +0400 (Tue, 03 Jul 2007)
New Revision: 6056
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6056
Modified:
3.x/trunk/limb/dbal/src/lmbSimpleDb.class.php
Log:
-- lmbSimpleDb passed $this->conn to lmbSelectQuery constructor not in getRecordSet method since the last does not accepts such parameter actually.
-- lmbSimpleDb :: selectRecord() added. lmbSimpleDb :: getFirstRecordFrom() is now deprecated, consider using selectRecord instead.
Modified: 3.x/trunk/limb/dbal/src/lmbSimpleDb.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/lmbSimpleDb.class.php 2007-07-03 10:52:01 UTC (rev 6055)
+++ 3.x/trunk/limb/dbal/src/lmbSimpleDb.class.php 2007-07-03 10:54:53 UTC (rev 6056)
@@ -40,12 +40,12 @@
function select($table, $criteria = null, $order = array())
{
- $query = new lmbSelectQuery($table);
+ $query = new lmbSelectQuery($table, $this->conn);
if($criteria)
$query->addCriteria(lmbSQLCriteria :: objectify($criteria));
- $rs = $query->getRecordSet($this->conn);
+ $rs = $query->getRecordSet();
if(is_array($order) && sizeof($order))
$rs->sort($order);
@@ -53,20 +53,25 @@
return $rs;
}
+ function selectRecord($table, $criteria = null, $order = array())
+ {
+ $rs = $this->select($table, $criteria, $order)->paginate(0, 1);
+ if($rs->valid())
+ return $rs->current();
+ }
+
function selectAsArray($table, $criteria = null, $order = array(), $key_field = '')
{
$rs = $this->select($table, $criteria, $order);
return $rs->getArray($key_field);
}
- function getFirstRecordFrom($table_name, $criteria = null, $order = '')
+ /**
+ * @deprecated
+ */
+ function getFirstRecordFrom($table_name, $criteria = null, $order = array())
{
- $rs = $this->select($table_name, $criteria, $order);
- $rs->rewind();
- if($rs->valid())
- return $rs->current();
- else
- return new lmbSet();
+ return $this->selectRecord($table_name, $criteria, $order);
}
function count($table_name, $criteria = null)
More information about the limb-svn
mailing list