List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:May 7 2007 7:57am
Subject:Rev 110: Fixed ruby test programs to use new create_ndb instead of get_ndb. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge
View as plain text  
------------------------------------------------------------
revno: 110
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: ndbjmerge
timestamp: Mon 2007-05-07 00:57:05 -0700
message:
  Fixed ruby test programs to use new create_ndb instead of get_ndb.
added:
  ruby/testdt.rb                 testdt.rb-20070507075655-1hn3m97fi3qli389-1
modified:
  ruby/test.rb                   test.rb-20070228212451-7arjxk90dkwcn5xr-4
  ruby/testasync.rb              testasync.rb-20070503085248-pb7j4e3h32mb81vs-1
=== added file 'ruby/testdt.rb'
--- a/ruby/testdt.rb	1970-01-01 00:00:00 +0000
+++ b/ruby/testdt.rb	2007-05-07 07:57:05 +0000
@@ -0,0 +1,44 @@
+require 'mysql/cluster/ndbapi'
+require 'date'
+
+Ndbapi::ndb_init
+
+insertid=ARGV[0].to_i
+
+puts "Connecting to cluster"
+
+connection=Ndbapi::NdbFactory.create_ndb_cluster_connection("127.0.0.1")
+
+begin
+  connection.connect(1,1,1)
+  connection.wait_until_ready(30, 30)
+
+rescue NdbApiException => e
+  puts "ERROR:" + e
+  exit 
+end
+
+
+myNdb = connection.create_ndb("test")
+
+myNdb.init(4) 
+
+puts "running tests"
+
+myTransaction = myNdb.start_transaction
+
+myOperation = myTransaction.get_ndb_operation("testprojdt")
+myOperation.insert_tuple
+
+puts "Inserting" , insertid
+
+myOperation.equal("id",insertid)
+myOperation.set_string("name","monty")
+myOperation.set_timestamp("ts",Time.now.to_i)
+d=DateTime.now
+puts d
+myOperation.set_datetime("dt",d)
+
+myTransaction.execute(Ndbapi::Commit)
+
+myTransaction.close

=== modified file 'ruby/test.rb'
--- a/ruby/test.rb	2007-05-06 04:28:40 +0000
+++ b/ruby/test.rb	2007-05-07 07:57:05 +0000
@@ -9,7 +9,6 @@
 
 puts "Connecting to cluster"
 
-#connection=Ndbapi::NdbFactory.createNdbClusterConnection()
 connection=Ndbapi::NdbFactory.create_ndb_cluster_connection("127.0.0.1")
 
 begin
@@ -22,7 +21,7 @@
 end
 
 
-myNdb = Ndbapi::Ndb.new(connection,"test")
+myNdb = connection.create_ndb("test")
 
 myNdb.init(4) 
 

=== modified file 'ruby/testasync.rb'
--- a/ruby/testasync.rb	2007-05-05 08:43:18 +0000
+++ b/ruby/testasync.rb	2007-05-07 07:57:05 +0000
@@ -30,7 +30,7 @@
   exit 
 end
 
-myNdb = Ndbapi::Ndb.new(connection,"test")
+myNdb = connection.create_ndb("test")
 
 myNdb.init(4) 
 

Thread
Rev 110: Fixed ruby test programs to use new create_ndb instead of get_ndb. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmergeMonty Taylor7 May