Commit ee8db412 authored by Martin Samson's avatar Martin Samson

Fixes timezone when you are not in the east emisphere. Not everybody using...

Fixes timezone when you are not in the east emisphere. Not everybody using MonetDB lives in the netherlands :)
parent 534f6f5a
......@@ -29,17 +29,14 @@ require 'MonetDB'
module ActiveRecord
class Base
# Establishes a connection to the database that's used by all Active Record objects
def self.monetdb_connection(config)
#TODO: is this required?
#require_library_or_gem('MonetDB')
def self.monetdb_connection(config)
# extract connection parameters
config = config.symbolize_keys
host = config[:host] || "127.0.0.1"
port = config[:port] || 50000
username = config[:username].to_s if config[:username] || "monetdb"
password = config[:password].to_s if config[:password] || "monetdb"
username = config[:username].to_s if config[:username]
password = config[:password].to_s if config[:password]
# Use "sql" as default language if none is specified
lang = config[:lang] || "sql"
......
......@@ -442,15 +442,10 @@ class MonetDBConnection
# Sets the time zone according to the Operating System settings
def set_timezone()
tz = Time.new
tz_offset = tz.gmt_offset / @@HOUR
if tz_offset <= 9 # verify minute count!
tz_offset = "'+0" + tz_offset.to_s + ":00'"
else
tz_offset = "'+" + tz_offset.to_s + ":00'"
end
tz_offset = "'%+03d:00'" % (tz.gmt_offset / @@HOUR)
query_tz = "sSET TIME ZONE INTERVAL " + tz_offset + " HOUR TO MINUTE;"
# Perform the query directly within the method
send(query_tz)
response = receive
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment