[pLog-svn] r2120 - plog/branches/plog-1.1-ben/class/database
ork at devel.plogworld.net
ork at devel.plogworld.net
Tue May 31 00:20:39 GMT 2005
Author: ork
Date: 2005-05-31 00:20:39 +0000 (Tue, 31 May 2005)
New Revision: 2120
Modified:
plog/branches/plog-1.1-ben/class/database/db.class.php
Log:
added _buildOrderCondition()
Modified: plog/branches/plog-1.1-ben/class/database/db.class.php
===================================================================
--- plog/branches/plog-1.1-ben/class/database/db.class.php 2005-05-31 00:19:56 UTC (rev 2119)
+++ plog/branches/plog-1.1-ben/class/database/db.class.php 2005-05-31 00:20:39 UTC (rev 2120)
@@ -113,7 +113,7 @@
}
if( $orderColumn != null ) {
- $query .= ' ORDER BY ' . $orderColumn;
+ $query .= Db::_buildOrderCondition( $orderColumn );
}
if( $limit != null ) {
@@ -151,7 +151,25 @@
return $tableName;
}
+ function _buildOrderCondition( $orderColumn )
+ {
+ preg_match( '/^(.)(.*)$/', $orderColumn, $matches );
+ $queryPart = ' ORDER BY ';
+ switch( $firstValueCharacter ) {
+ case '-':
+ $orderColumn = $matches[2];
+ $direction = ' DESC';
+ case '+':
+ $orderColumn = $matches[2];
+ default:
+ $direction = '';
+ $queryPart .= $orderColumn . $direction;
+ }
+ return $queryPart;
+ }
+
+
function _buildWhereCondition( $columnName, $columnValue )
{
preg_match( '/^(.)(.*)$/', $columnValue, $matches );
More information about the pLog-svn
mailing list