List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:May 5 2007 8:43am
Subject:Rev 105: Fixed up async test script for perl. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/exceptions
View as plain text  
------------------------------------------------------------
revno: 105
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: exceptions
timestamp: Sat 2007-05-05 01:43:18 -0700
message:
  Fixed up async test script for perl.
  Not using directors for perl or Ruby right now.
modified:
  perl/async.pl                  async.pl-20070323111328-n9taxfigqgv14j06-1
  ruby/ndbapi.i                  ndb.i-20070228212451-7arjxk90dkwcn5xr-3
  ruby/testasync.rb              testasync.rb-20070503085248-pb7j4e3h32mb81vs-1
=== modified file 'perl/async.pl'
--- a/perl/async.pl	2007-04-15 08:50:19 +0000
+++ b/perl/async.pl	2007-05-05 08:43:18 +0000
@@ -37,10 +37,9 @@
 
 $dbh = DBI->connect("dbi:mysql:host=localhost;read_default_group=client","root","" );
 
-$dbh->do("DROP DATABASE test_db_1");
 
-$dbh->do("CREATE DATABASE test_db_1");
-$dbh->do("USE test_db_1");
+$dbh->do("CREATE DATABASE if not exists test");
+$dbh->do("USE test");
 
 $dbh->do("DROP TABLE if exists mytablename");
 $dbh->do("CREATE TABLE
@@ -54,7 +53,7 @@
 
 print "connecting to cluster\n";
 
-$connection = new mysql::cluster::ndbapi::Ndb_cluster_connection();
+$connection = mysql::cluster::ndbapi::NdbFactory::createNdbClusterConnection();
 
 
 if ($connection->connect(5,3,1)) {
@@ -69,7 +68,7 @@
     exit -1;
 } else { print "cluster ready\n"; }
 
-$myNdb = new mysql:cluster::ndbapi::Ndb($connection,"test_db_1");
+$myNdb = $connection->getNdb("test");
 
 
 if ($myNdb->init(4) == -1) {
@@ -118,8 +117,9 @@
 	my $trans=$myTransaction;
     	$ret = $myTransaction->executeAsynchPrepare($ndb::Commit,
 		sub { $done--; 
-		#print "ASYNC CALLED\n";
-    		$myNdb->closeTransaction($trans); } );
+		print "ASYNC CALLED\n";
+    		# We want to close transactions after the callback
+    	         } );
     }
 
     if ($ret == -1) {
@@ -129,7 +129,7 @@
 }
 
 while ( $done>0 ) {
-	$myNdb->sendPollNdb(0);
+	$myNdb->sendPollNdb(3000,1);
 	sleep 1/1000;
 }
 
@@ -167,7 +167,7 @@
   
 }
 
-$myNdb->closeTransaction($myTransaction);
+$myTransaction->close();
 
 
 #Fetch records using NDBAPI
@@ -194,7 +194,7 @@
       }
       $foo=$myRecAttr->u_32_value();
 
-      $myNdb->closeTransaction($myTransaction);
+      $myTransaction->close();
 
     }
 

=== modified file 'ruby/ndbapi.i'
--- a/ruby/ndbapi.i	2007-05-03 09:00:26 +0000
+++ b/ruby/ndbapi.i	2007-05-05 08:43:18 +0000
@@ -16,6 +16,8 @@
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
+// Not using directors with ruby - they don't seem to work and the 
+// custom code is really clean anyway.
 %module ndbapi
 
 %include "globals.i"

=== modified file 'ruby/testasync.rb'
--- a/ruby/testasync.rb	2007-05-03 09:00:26 +0000
+++ b/ruby/testasync.rb	2007-05-05 08:43:18 +0000
@@ -1,6 +1,6 @@
 require 'mysql/cluster/ndbapi'
 
-class NdbCallback
+class NdbCallback 
   def initialize(myRecAttr)
     @myRecAttr=myRecAttr
   end

Thread
Rev 105: Fixed up async test script for perl. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/exceptionsMonty Taylor5 May