From 9505b365d61de22172877829de3690fb4d0b1330 Mon Sep 17 00:00:00 2001 From: jengo Date: Thu, 25 Jan 2001 06:09:08 +0000 Subject: [PATCH] Moved sql_limit() to the db classes and renamed it to limit() --- phpgwapi/inc/class.common.inc.php | 9 ++------- phpgwapi/inc/class.db_mysql.inc.php | 10 ++++++++++ phpgwapi/inc/class.db_pgsql.inc.php | 10 ++++++++++ phpgwapi/inc/class.nextmatchs.inc.php | 6 ++++++ 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index 678685787e..297a4b3bc6 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -447,13 +447,8 @@ } } - function navbar($called_directly = True) - { - // This is only temp, until will change everything to use the new method - if ($called_directly) { - echo '
Warning: You can no longer call navbar() directly, use echo parse_navbar() from now on.
'; - } - + function navbar() + { global $phpgw_info, $phpgw; $phpgw_info["navbar"]["home"]["title"] = "Home"; diff --git a/phpgwapi/inc/class.db_mysql.inc.php b/phpgwapi/inc/class.db_mysql.inc.php index 4cbc90e899..6b08ef0ead 100644 --- a/phpgwapi/inc/class.db_mysql.inc.php +++ b/phpgwapi/inc/class.db_mysql.inc.php @@ -97,6 +97,16 @@ class db { return mysql_close($this->Link_ID); } + function limit($start,$offset) + { + if ($start == 0) { + $s = "limit $start"; + } else { + $s = "limit $start,$offset"; + } + return $s; + } + /* public: discard the query result */ function free() { @mysql_free_result($this->Query_ID); diff --git a/phpgwapi/inc/class.db_pgsql.inc.php b/phpgwapi/inc/class.db_pgsql.inc.php index f2b847fc82..b85fff4dda 100644 --- a/phpgwapi/inc/class.db_pgsql.inc.php +++ b/phpgwapi/inc/class.db_pgsql.inc.php @@ -61,6 +61,16 @@ class db { } } + function limit($start,$offset) + { + if ($start == 0) { + $s = "limit $offset"; + } else { + $s = "limit $offset,$start"; + } + return $s; + } + // This only affects systems not using persistant connections function disconnect() { diff --git a/phpgwapi/inc/class.nextmatchs.inc.php b/phpgwapi/inc/class.nextmatchs.inc.php index cff9012e3a..32f98675d6 100644 --- a/phpgwapi/inc/class.nextmatchs.inc.php +++ b/phpgwapi/inc/class.nextmatchs.inc.php @@ -324,8 +324,14 @@ class nextmatchs // Postgre and MySQL switch the vars in limit. This will make it easier // if there are any other databases that pull this. + + // NOTE!! This is is NO longer used. Use db->limit() instead. + // This is here for people to get there code up to date. + function sql_limit($start) { + echo "
WARNING: Do not use sql_limit() anymore. Use db->limit() from now on.
"; + global $phpgw_info; $max = $phpgw_info["user"]["preferences"]["common"]["maxmatchs"];