aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/docs/coding-guidelines.html
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-11-23 11:52:11 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-11-23 11:52:11 +0000
commit3f69e7278c119f6122b1b82759be99365da15c89 (patch)
tree20b67a7e85f826ca99120a0696c405601233e0dd /phpBB/docs/coding-guidelines.html
parente67722c18bbfd519e6237c3c35bb45067422e7a3 (diff)
downloadforums-3f69e7278c119f6122b1b82759be99365da15c89.tar
forums-3f69e7278c119f6122b1b82759be99365da15c89.tar.gz
forums-3f69e7278c119f6122b1b82759be99365da15c89.tar.bz2
forums-3f69e7278c119f6122b1b82759be99365da15c89.tar.xz
forums-3f69e7278c119f6122b1b82759be99365da15c89.zip
document the recent change for sql_query_limit
git-svn-id: file:///svn/phpbb/trunk@6638 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/docs/coding-guidelines.html')
-rw-r--r--phpBB/docs/coding-guidelines.html9
1 files changed, 9 insertions, 0 deletions
diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
index 8785ae619d..ea5ddd9f0e 100644
--- a/phpBB/docs/coding-guidelines.html
+++ b/phpBB/docs/coding-guidelines.html
@@ -774,6 +774,14 @@ $sql = 'SELECT *
WHERE username = '" . $db-&gt;sql_escape($username) . "'";
</pre></blockquote>
+ <h3>sql_query_limit():</h3>
+
+ <p>We do not add limit statements to the sql query, but instead use <code>$db-&gt;sql_query_limit()</code>. You basically pass the query, the total number of lines to retrieve and the offset.</p>
+
+ <p><strong>Note: </strong> Since Oracle handles limits differently and because of how we implemented this handling you need to take special care if you use <code>sql_query_limit</code> with an sql query retrieving data from more than one table.</p>
+
+ <p>Make sure when using something like "SELECT x.*, y.jars" that there is not a column named jars in x; make sure that there is no overlap between an implicit column and the explicit columns.</p>
+
<h3>sql_build_array():</h3>
<p>If you need to UPDATE or INSERT data, make use of the <code>$db-&gt;sql_build_array()</code> function. This function already escapes strings and checks other types, so there is no need to do this here. The data to be inserted should go into an array - <code>$sql_ary</code> - or directly within the statement if one one or two variables needs to be inserted/updated. An example of an insert statement would be:</p>
@@ -856,6 +864,7 @@ SELECT FROM phpbb_forums WHERE forum_id <strong>&lt;&gt;</strong> 1
<p>If the given array is empty, an error will be produced.</p>
<h3>sql_build_query():</h3>
+
<p>The <code>$db-&gt;sql_build_query()</code> function is responsible for building sql statements for select and select distinct queries if you need to JOIN on more than one table or retrieving data from more than one table while doing a JOIN. This needs to be used to make sure the resulting statement is working on all supported db's. Instead of explaining every possible combination, i will give a short example:</p>
<blockquote><pre>