[geeklog-cvs] geeklog: pg function
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Tue Jan 26 15:53:40 EST 2010
changeset 7632:8581fcb9b0b9
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/8581fcb9b0b9
user: stan <yankees26an at gmail.com>
date: Wed Jul 15 12:03:31 2009 -0400
description:
pg function
diffstat:
public_html/admin/install/index.php | 16 ++++++++++++++++
public_html/directory.php | 3 +--
2 files changed, 17 insertions(+), 2 deletions(-)
diffs (39 lines):
diff -r 36a990997aa1 -r 8581fcb9b0b9 public_html/admin/install/index.php
--- a/public_html/admin/install/index.php Mon Jul 13 13:45:55 2009 -0400
+++ b/public_html/admin/install/index.php Wed Jul 15 12:03:31 2009 -0400
@@ -416,6 +416,22 @@
require_once $dbconfig_path;
require_once $siteconfig_path;
require_once $_CONF['path_system'] . 'lib-database.php';
+
+ //Create a func to check for table existance
+ DB_query("CREATE OR REPLACE FUNCTION check_table(varchar, varchar)
+ RETURNS boolean AS $$
+ DECLARE
+ v_cnt integer;
+ v_tbl boolean;
+ BEGIN
+ SELECT count(1) INTO v_cnt FROM pg_tables where tablename = $1 and
+ schemaname = $2;
+ IF v_cnt > 0 THEN
+ v_tbl = 'true';
+ END IF;
+ return v_tbl;
+ END;
+ $$ LANGUAGE 'plpgsql'");
// Check if GL is already installed
if (INST_checkTableExists('vars')) {
diff -r 36a990997aa1 -r 8581fcb9b0b9 public_html/directory.php
--- a/public_html/directory.php Mon Jul 13 13:45:55 2009 -0400
+++ b/public_html/directory.php Wed Jul 15 12:03:31 2009 -0400
@@ -189,8 +189,7 @@
}
}
- if($_DB_dbms=='pgsql'){$result = DB_query ("SELECT EXTRACT(Year from date) AS year FROM {$_TABLES['stories']}");}
- else{$result = DB_query ("SELECT MIN(YEAR(date)) AS year FROM {$_TABLES['stories']}"); }
+ $result = DB_query ("SELECT EXTRACT(Year from date) AS year FROM {$_TABLES['stories']}");
$A = DB_fetchArray ($result);
if ($prevyear < $A['year']) {
$prevyear = 0;
More information about the geeklog-cvs
mailing list