aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2008-01-02 19:45:03 +0000
committerRalph Amissah <ralph@amissah.com>2008-01-02 19:45:03 +0000
commit084433a84b1d850187663e10492dda544923a681 (patch)
tree3f307efd7da95c9808bdc38dbe25d27e72b2be04
parentyear updated to 2008 - happy new year (diff)
sql, postgresql allow tcp/ip connections, parameters from rc file, sisurc.yml
-rw-r--r--CHANGELOG5
-rw-r--r--conf/sisu/sisurc.yml10
-rw-r--r--data/doc/sisu/sisu_markup_samples/sisu_manual/_sisu/sisurc.yml6
-rw-r--r--lib/sisu/v0/dbi.rb4
-rw-r--r--lib/sisu/v0/sysenv.rb13
5 files changed, 29 insertions, 9 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3ab4c973..4b09e37d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,7 +9,7 @@ Reverse Chronological:
%% STABLE MANIFEST
-%% sisu_0.63.1.orig.tar.gz (2007-12-28:52/5)
+%% sisu_0.63.1.orig.tar.gz (2008-01-02:00/3)
http://www.jus.uio.no/sisu/pkg/src/sisu_0.63.1.orig.tar.gz
sisu_0.63.1.orig.tar.gz
sisu_0.63.1-1.dsc
@@ -23,6 +23,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.63.1.orig.tar.gz
compromise: is possible to set an alternative path for processing in
sisurc.yml
+ * sql, postgresql allow tcp/ip connections... take relevant parameters from
+ resource configuration file, sisurc.yml
+
* sql (postgresql, sqlite), switch primary keys to bigint (as requested)
* copyright dates updated
diff --git a/conf/sisu/sisurc.yml b/conf/sisu/sisurc.yml
index c135f270..82915369 100644
--- a/conf/sisu/sisurc.yml
+++ b/conf/sisu/sisurc.yml
@@ -45,7 +45,8 @@ show_output_on: 'filesystem_url'
# stub: 'texinfo'
##% processing directories, main path and subdirectories (appended to $HOME), using defaults set in sysenv
#processing:
-# path: '_sisu_processing'
+# path: '~'
+# dir: '.sisu_processing~'
# metaverse: 'metaverse'
# tune: 'tune'
# latex: 'tex'
@@ -56,7 +57,6 @@ flag:
color: true # making colour default -c is toggle, and will now toggle colour off
default: '-NhwpoabxXyYv' # includes verbose; -m would in any event be run by default
i: '-hwpoyv' # includes verbose; -m run by default
- i: '-Nhwpoayv' # includes verbose; -m run by default
ii: '-NhwpoabxXyv' # includes verbose; -m run by default
iii: '-NhwpoabxXyYv' # includes verbose; -m run by default
iv: '-NhwpoabxXYDyv --import' # includes verbose; -m run by default
@@ -84,8 +84,10 @@ default:
#% sql database info, postgresql and sqlite
#db:
# postgresql:
-# user: '[username]'
-# port: '[port (default is 5432]'
+# port: # '[port (default is 5432]'
+# host: # '[if not localhost, provide host tcp/ip address or domain name]''
+# user: # '[(if different from user) provide username]'
+# password: # '[password if required]'
# sqlite:
# path: ~ # './sisu_sqlite.db'
# port: "**"
diff --git a/data/doc/sisu/sisu_markup_samples/sisu_manual/_sisu/sisurc.yml b/data/doc/sisu/sisu_markup_samples/sisu_manual/_sisu/sisurc.yml
index 183c61c1..fa0987d1 100644
--- a/data/doc/sisu/sisu_markup_samples/sisu_manual/_sisu/sisurc.yml
+++ b/data/doc/sisu/sisu_markup_samples/sisu_manual/_sisu/sisurc.yml
@@ -86,8 +86,10 @@ default:
##sql database info, postgresql and sqlite
#db:
# postgresql:
-# user: '[provide username]'
-# port: '5432'
+# port: # '[port (default is 5432]'
+# host: # '[if not localhost, provide host tcp/ip address or domain name]''
+# user: # '[(if different from user) provide username]'
+# password: # '[password if required]'
# sqlite:
# path: ~ # './sisu_sqlite.db'
# port: "**"
diff --git a/lib/sisu/v0/dbi.rb b/lib/sisu/v0/dbi.rb
index c787a60e..2e633bad 100644
--- a/lib/sisu/v0/dbi.rb
+++ b/lib/sisu/v0/dbi.rb
@@ -93,8 +93,8 @@ module SiSU_DBI
end
def read_psql
begin
- db,user,dbi=@db.psql.db,@db.psql.user,@db.psql.dbi
- @conn=DBI.connect(dbi,user,db)
+ db,user,dbi,pass=@db.psql.db,@db.psql.user,@db.psql.dbi,@db.psql.password
+ @conn=DBI.connect(dbi,user,pass)
rescue
if @opt.mod.inspect=~/--(createall|create)/
puts %{manually create the database: "#{db}" if it does not yet exist}
diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb
index b4252e28..4187f6e9 100644
--- a/lib/sisu/v0/sysenv.rb
+++ b/lib/sisu/v0/sysenv.rb
@@ -2648,6 +2648,19 @@ WOK
else ''
end
end
+ def host
+ if defined? @rc['db']['postgresql']['host'] \
+ and @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/
+ @rc['db']['postgresql']['host']
+ else ''
+ end
+ end
+ def dbi
+ if psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/
+ "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}"
+ else "DBI:Pg:database=#{psql.db};port=#{psql.port}"
+ end
+ end
self
end
def mysql