Changeset: 831b82d02b4f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=831b82d02b4f
Modified Files:
        
clients/ruby/adapter/active_record/connection_adapters/monetdb_adapter.rb
        clients/ruby/lib/MonetDB.rb
        clients/ruby/lib/demo.rb
        clients/ruby/lib/test/test_capabilities.rb
Branch: default
Log Message:

MonetDB::conn() parameters match mclient naming.


Changed "lang" to "language" and "db_name" to "database".


diffs (101 lines):

diff -r 9b2655075d06 -r 831b82d02b4f 
clients/ruby/adapter/active_record/connection_adapters/monetdb_adapter.rb
--- a/clients/ruby/adapter/active_record/connection_adapters/monetdb_adapter.rb 
Sun Jan 16 00:34:11 2011 +0100
+++ b/clients/ruby/adapter/active_record/connection_adapters/monetdb_adapter.rb 
Sun Jan 16 19:54:34 2011 +0100
@@ -28,7 +28,6 @@
   class Base
     # Establishes a connection to the database that's used by all Active 
Record objects
     def self.monetdb_connection(config) 
-       puts "ACTIVERECORD\n"
       require_library_or_gem('MonetDB')
       
       # extract connection parameters
@@ -44,9 +43,7 @@
       
       # use empty string as database name if none is specified
       database = config[:database] || ""
-      
-      p "DB:" + database
-      
+            
       dbh = MonetDB.new
       ConnectionAdapters::MonetDBAdapter.new(dbh, logger, [host, port, 
username, password, database, lang], config)
     end
diff -r 9b2655075d06 -r 831b82d02b4f clients/ruby/lib/MonetDB.rb
--- a/clients/ruby/lib/MonetDB.rb       Sun Jan 16 00:34:11 2011 +0100
+++ b/clients/ruby/lib/MonetDB.rb       Sun Jan 16 19:54:34 2011 +0100
@@ -224,29 +224,29 @@
     # Establish a new connection using named parameters.
     #                * user: username (default is monetdb)
     #                * passwd: password (default is monetdb)
-    #                * lang: language (default is sql) 
-    #                * host: server hostanme or ip  (default is localhost)
-    #                * port: server port (default is 50000)
-    #                * db_name: name of the database to connect to
+    #                * language: {sql, xquery} (default is sql) 
+    #                * host: host to connect to  (default is localhost)
+    #                * port: port to connect to (default is 50000)
+    #                * database: name of the database to connect to
     #                * auth_type: hashing function to use during 
authentication (default is SHA1)
     #
     # Conventionally named parameters are passed as an hash.
     #
     # Ruby 1.8:
-    # MonetDB::conn({ :user => "username", :passwd => "password", :db_name => 
"database"})
+    # MonetDB::conn({ :user => "username", :passwd => "password", :database => 
"database"})
     #
     # Ruby 1.9:
-    # MonetDB::conn(user: "username", passwd: "password", db_name: "database")
+    # MonetDB::conn(user: "username", passwd: "password", database: "database")
     def conn(options)      
-      user      = options[:user] || DEFAULT_USERNAME
-      passwd    = options[:passwd] || DEFAULT_PASSWORD
-      lang      = options[:lang] || DEFAULT_LANG
-      host      = options[:host] || DEFAULT_HOST
-      port      = options[:port] || DEFAULT_PORT
-      db_name   = options[:db_name] || DEFAULT_DATABASE
-      auth_type = options[:auth_type] || DEFAULT_AUTHTYPE
+      user        = options[:user] || DEFAULT_USERNAME
+      passwd      = options[:passwd] || DEFAULT_PASSWORD
+      language    = options[:language] || DEFAULT_LANG
+      host        = options[:host] || DEFAULT_HOST
+      port        = options[:port] || DEFAULT_PORT
+      database    = options[:database] || DEFAULT_DATABASE
+      auth_type   = options[:auth_type] || DEFAULT_AUTHTYPE
       
-      connect(user, passwd, lang, host, port, db_name, auth_type)
+      connect(user, passwd, language, host, port, database, auth_type)
     end
   
     # Send a <b> user submitted </b> query to the server and store the 
response.
diff -r 9b2655075d06 -r 831b82d02b4f clients/ruby/lib/demo.rb
--- a/clients/ruby/lib/demo.rb  Sun Jan 16 00:34:11 2011 +0100
+++ b/clients/ruby/lib/demo.rb  Sun Jan 16 19:54:34 2011 +0100
@@ -19,7 +19,7 @@
 
 db = MonetDB.new
 
-db.conn({ :user => "monetdb", :passwd => "monetdb", :port => 50000, :lang => 
"sql", :host => "localhost", :db_name => "ruby_test", :auth_type => "SHA1" })
+db.conn({ :user => "monetdb", :passwd => "monetdb", :port => 50000, :language 
=> "sql", :host => "localhost", :database => "ruby_test", :auth_type => "SHA1" 
})
 
 # set type_cast=true to enable MonetDB to Ruby type mapping
 #res = db.query("select * from tables, tables, tables;")
diff -r 9b2655075d06 -r 831b82d02b4f clients/ruby/lib/test/test_capabilities.rb
--- a/clients/ruby/lib/test/test_capabilities.rb        Sun Jan 16 00:34:11 
2011 +0100
+++ b/clients/ruby/lib/test/test_capabilities.rb        Sun Jan 16 19:54:34 
2011 +0100
@@ -13,7 +13,6 @@
 require 'date'
 
 
-
 class TC_MonetDBCapabilities < Test::Unit::TestCase
   # ruby rand function does not support MIN..MAX bounds.
   # This alias adds that feature.
@@ -303,7 +302,7 @@
   def test_conn_with_named_parameters    
     db = MonetDB.new()
         
-    db.conn({ :user => "monetdb", :passwd => "monetdb", :port => 50000, :host 
=> "localhost", :db_name => "ruby_test"})
+    db.conn({ :user => "monetdb", :passwd => "monetdb", :port => 50000, :host 
=> "localhost", :database => "ruby_test"})
     assert_equal(true, db.is_connected?)
     db.close
   end
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to