[Cs-webapplibs-commits] SF.net SVN: cs-webapplibs:[213] trunk/0.4/abstract/cs_singleTableHandler. a
Status: Beta
Brought to you by:
crazedsanity
|
From: <cra...@us...> - 2011-05-10 23:57:36
|
Revision: 213
http://cs-webapplibs.svn.sourceforge.net/cs-webapplibs/?rev=213&view=rev
Author: crazedsanity
Date: 2011-05-10 23:57:30 +0000 (Tue, 10 May 2011)
Log Message:
-----------
Fix a couple of bugs (typos), optional argument for retrieving records.
/abstract/cs_singleTableHandler.abstract.class.php:
* get_records_using_custom_filter():
-- fix typo with $orderByStr (one reference was $orderBYStr)
-- remove invalid $ (was "$is_string(...")
-- fix query so $filter doesn't have to contain " WHERE "
* update_record():
-- ARG CHANGE: NEW ARG: #4 ($appendToUpdateString=null)
-- optionally add an extra bit of text to the query.
Modified Paths:
--------------
trunk/0.4/abstract/cs_singleTableHandler.abstract.class.php
Modified: trunk/0.4/abstract/cs_singleTableHandler.abstract.class.php
===================================================================
--- trunk/0.4/abstract/cs_singleTableHandler.abstract.class.php 2011-04-03 18:17:47 UTC (rev 212)
+++ trunk/0.4/abstract/cs_singleTableHandler.abstract.class.php 2011-05-10 23:57:30 UTC (rev 213)
@@ -236,12 +236,12 @@
}
}
- $orderBYStr = ' ORDER BY '. $this->pkeyField;
- if($is_string($orderBy) && strlen($orderBy)) {
+ $orderByStr = ' ORDER BY '. $this->pkeyField;
+ if(is_string($orderBy) && strlen($orderBy)) {
$orderByStr = ' ORDER BY '. $orderBy;
}
- $sql = 'SELECT * FROM '. $this->tableName . $filter . $orderByStr . $limitOffsetStr;
+ $sql = 'SELECT * FROM '. $this->tableName ." WHERE ". $filter . $orderByStr . $limitOffsetStr;
try {
$data = $this->dbObj->run_query($sql, $this->pkeyField);
}
@@ -268,7 +268,7 @@
* @RETURN (int) SUCCESS: (int) is the number of records updated (should always be 1)
* @EXCEPTION FAIL: exception indicates the error.
*/
- public function update_record($recId, array $updates, $removeEmptyVals=true) {
+ public function update_record($recId, array $updates, $removeEmptyVals=true, $appendToUpdateString=null) {
if(is_numeric($recId) && $recId >= 0 && is_array($updates) && count($updates) > 0) {
$updateString = $this->gfObj->string_from_array($updates, 'update', null, $this->cleanStringArr, $removeEmptyVals);
if(is_null($updateString) || !strlen($updateString) || strlen($updateString) < 3) {
@@ -276,7 +276,7 @@
}
else {
$sql = 'UPDATE '. $this->tableName .' SET '
- . $updateString
+ . $updateString . $appendToUpdateString
.' WHERE '. $this->pkeyField .'='. $recId;
try {
$retval = $this->dbObj->run_update($sql, true);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|