summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <hrw@openembedded.org>2006-08-24 11:46:27 +0000
committerMarcin Juszkiewicz <hrw@openembedded.org>2006-08-24 11:46:27 +0000
commit396927890b0daf83f835ffe50dcdc14e038acf74 (patch)
tree0e8531088967e69fb763db9a86749befcaae1e36 /contrib
parent70f28676088eeda6e58ee5d9246d0b3637c270b0 (diff)
feed-browser/update.php: define database name once
Diffstat (limited to 'contrib')
-rw-r--r--contrib/feed-browser/update.php31
1 files changed, 20 insertions, 11 deletions
diff --git a/contrib/feed-browser/update.php b/contrib/feed-browser/update.php
index c32e1804cc..07f4f15bc9 100644
--- a/contrib/feed-browser/update.php
+++ b/contrib/feed-browser/update.php
@@ -39,6 +39,7 @@
$start = time();
$p_count = 0;
+define('DB_FILENAME', './feeds.db');
$feeds = db_query("SELECT f_name, f_uri FROM feeds");
@@ -151,22 +152,30 @@ function insert_ipkgs ($package, $version, $depends, $section, $arch, $maintaine
function db_query($query)
{
- $db_name = "./feeds.db";
- $db_h = sqlite_open($db_name);
- $query_h = sqlite_query ($db_h, $query);
- $result = sqlite_fetch_all ($query_h, SQLITE_ASSOC);
- sqlite_close($db_h);
- return ($result);
+ $result = FALSE;
+
+ if($db_h = sqlite_open(DB_FILENAME))
+ {
+ $query_h = sqlite_query ($db_h, $query);
+ $result = sqlite_fetch_all ($query_h, SQLITE_ASSOC);
+ sqlite_close($db_h);
+ }
+
+ return $result;
}
function db_query_n($query)
{
- $db_name = "./feeds.db";
- $db_h = sqlite_open($db_name);
- $query_h = sqlite_query ($db_h, $query);
- sqlite_close($db_h);
- return ($result);
+ $result = FALSE;
+
+ if($db_h = sqlite_open(DB_FILENAME))
+ {
+ $query_h = sqlite_query ($db_h, $query);
+ sqlite_close($db_h);
+ }
+
+ return $result;
}