|
Index: class.t3lib_db.php
|
|
===================================================================
|
|
RCS file: /cvsroot/typo3/TYPO3core/t3lib/class.t3lib_db.php,v
|
|
retrieving revision 1.19
|
|
diff -u -r1.19 class.t3lib_db.php
|
|
--- class.t3lib_db.php 27 Dec 2005 13:18:20 -0000 1.19
|
|
+++ class.t3lib_db.php 11 Feb 2006 15:10:41 -0000
|
|
@@ -259,6 +259,35 @@
|
|
);
|
|
}
|
|
|
|
+
|
|
+ /**
|
|
+ * Creates and executes a SELECT SQL-statement for recursive datat structures
|
|
+ * Using this function specifically allow us to handle the LIMIT feature independently of DB.
|
|
+ *
|
|
+ *
|
|
+ * @param string List of fields to select from the local table. This is what comes right after "SELECT ...". Required value. As of recursive Datastructure local and foreigen table ar the same, in the query the foreigen_tabel will be named as ft
|
|
+ * @param string mm_table, table where the relation to the foreigen_tabel is stored
|
|
+ * @param string Optional additional WHERE clauses put in the end of the query. NOTICE: You must escape values in this argument with $this->quoteStr() yourself! DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
|
|
+ * @param string Optional GROUP BY field(s), if none, supply blank string.
|
|
+ * @param string Optional ORDER BY field(s), if none, supply blank string.
|
|
+ * @param string Optional LIMIT value ([begin,]max), if none, supply blank string.
|
|
+ * @return pointer MySQL result pointer / DBAL object
|
|
+ */
|
|
+ function exec_SELECT_mm_rec_query($select,$local_table,$mm_table,$whereClause='',$groupBy='',$orderBy='',$limit='') {
|
|
+ $mmWhere = $local_table ? $local_table.'.uid='.$mm_table.'.uid_local' : '';
|
|
+
|
|
+ $mmWhere.= ' AND ft.uid='.$mm_table.'.uid_foreign';
|
|
+ #debug ($mmWhere.$whereClause);
|
|
+ return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
|
|
+ $select,
|
|
+ ($local_table ? $local_table.',' : '').$mm_table.($local_table ? ','.$local_table.' as ft ' : ''),
|
|
+ $mmWhere.' '.$whereClause, // whereClauseMightContainGroupOrderBy
|
|
+ $groupBy,
|
|
+ $orderBy,
|
|
+ $limit
|
|
+ );
|
|
+ }
|
|
+
|
|
/**
|
|
* Executes a select based on input query parts array
|
|
*
|