summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/db.inc.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-05-19 09:18:27 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-05-19 09:18:27 +0000
commit55258ec574e3e9a0984b13cf119d725dd8ae1791 (patch)
treebbb37fe8a5d51d7eb363989108becaa5399bcd8d /frontends/php/include/db.inc.php
parent1c3253c2dddc63349e34e38d681bedeede2da8a7 (diff)
- fixed oracle sql request limitation
git-svn-id: svn://svn.zabbix.com/trunk@2859 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/db.inc.php')
-rw-r--r--frontends/php/include/db.inc.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php
index 32e20d06..7ffad959 100644
--- a/frontends/php/include/db.inc.php
+++ b/frontends/php/include/db.inc.php
@@ -22,13 +22,13 @@
// DATABASE CONFIGURATION
-// $DB_TYPE ="ORACLE";
+ $DB_TYPE ="ORACLE";
// $DB_TYPE ="POSTGRESQL";
- $DB_TYPE ="MYSQL";
+// $DB_TYPE ="MYSQL";
$DB_SERVER ="localhost";
- $DB_DATABASE ="zabbix";
- $DB_USER ="root";
- $DB_PASSWORD ="";
+// $DB_DATABASE ="zabbix";
+ $DB_USER ="scott";
+ $DB_PASSWORD ="tiger";
// END OF DATABASE CONFIGURATION
// $USER_DETAILS ="";
@@ -79,7 +79,7 @@
SELECT * FROM (SELECT ROWNUM as RN, * FROM tbl) WHERE RN BETWEEN 6 AND 15
*/
- function DBselect($query)
+ function DBselect($query, $limit='NO')
{
global $DB,$DB_TYPE;
@@ -88,6 +88,10 @@ COpt::savesqlrequest($query);
if($DB_TYPE == "MYSQL")
{
+ if(is_numeric($limit))
+ {
+ $query .= ' limit '.intval($limit);
+ }
$result=mysql_query($query,$DB);
if(!$result)
{
@@ -97,11 +101,20 @@ COpt::savesqlrequest($query);
}
if($DB_TYPE == "POSTGRESQL")
{
+ if(is_numeric($limit))
+ {
+ $query .= ' limit '.intval($limit);
+ }
$result=pg_exec($DB,$query);
return $result;
}
if($DB_TYPE == "ORACLE")
{
+ if(is_numeric($limit))
+ {
+ $query = 'select * from ('.$query.') where rownum<'.intval($limit);
+ }
+
$stid=OCIParse($DB,$query);
if(!$stid)
{