#At https://bazaar.launchpad.net/~ndb-bindings/ndb-bindings/trunk
413 Monty Taylor 2008-06-19
Removed NdbFactory from other languages.
Made NdbClusterConnection::create a static method from the SWIG/C side.
Changed NdbClusterConnection.java to proxy NdbClusterConnectionImpl.create.
removed:
interface/ndbapi/NdbFactory.i
modified:
csharp/Makefile.am
csharp/examples/asyncexample/testasync.cs
csharp/examples/test.cs
csharp/examples/test2.cs
csharp/ndbapi.i
csharp/ndbapi/ndbapi.mdp
interface/ndbapi/NdbClusterConnection.i
java/com/mysql/cluster/ndbj/NdbClusterConnection.java
lua/ndbapi.i
lua/test.lua
perl/async.pl
perl/ndbapi.i
perl/test.pl
php/ndbapi.i
python/examples/async.py
python/examples/batchupdate.py
python/examples/checkdattime.py
python/examples/compare.py
python/examples/joinperf.py
python/ndbapi.i
python/swig/module_pythoncode.i
python/tests/ClusterTestCase.py
python/tests/shared_cluster_connection.py
ruby/ndbapi.i
ruby/test.rb
ruby/testasync.rb
ruby/testdt.rb
ruby/testreaddt.rb
ruby/testselectcount.rb
xml/ndbapi.i
=== modified file 'csharp/Makefile.am'
--- a/csharp/Makefile.am 2008-04-20 18:30:16 +0000
+++ b/csharp/Makefile.am 2008-06-19 18:53:28 +0000
@@ -1,17 +1,14 @@
builddir=${top_builddir}/csharp
NDBAPI_SOURCE = $(srcdir)/ndbapi/*.cs
MGMAPI_SOURCE = $(srcdir)/mgmapi/*.cs
-NDBAPI_BUILT_SRC=AbortOption.cs NdbScanOperation.cs ExecType.cs NdbTransaction.cs Ndb_cluster_connection.cs SWIGTYPE*cs ndb.cs Ndb.cs NdbOperation.cs ndbPINVOKE.cs NdbRecAttr.cs NdbError.cs NdbFactory.cs
MYSQL_DLL = $(srcdir)/MySql.Data.dll
CLEANFILES = ndbapi.dll *exe test/*exe ndbapi.cpp MySql.Cluster.NdbApi.dll ndbapi/generated/* mgmapi/generated/* mgmapi.cpp MySql.Cluster.MgmApi.dll
lib_LTLIBRARIES = libndbcli.la libmgmcli.la
nodist_libndbcli_la_SOURCES = ndbapi.cpp
-libndbcli_la_LDFLAGS = -fpic
libndbcli_la_CPPFLAGS = $(PTHREAD_CFLAGS)
libndbcli_la_DEPENDENCIES = MySql.Cluster.NdbApi.dll
nodist_libmgmcli_la_SOURCES = mgmapi.cpp
-libmgmcli_la_LDFLAGS = -fpic
libmgmcli_la_CPPFLAGS = $(PTHREAD_CFLAGS)
libmgmcli_la_DEPENDENCIES = MySql.Cluster.MgmApi.dll
libmgmcli_la_LIBADD = ${top_builddir}/mgmpp/libmgmpp.la
@@ -21,7 +18,7 @@ EXTRA_DIST = ndbapi.i mgmapi.i $(NDBAPI_
clean-local:
@rm -rf $(builddir)/ndbapi/generated $(builddir)/mgmapi/generated
-test: test/test.exe test/test2.exe
+test: examples/test.exe examples/test2.exe
SUFFIXES = .exe .cs .i .cpp
=== modified file 'csharp/examples/asyncexample/testasync.cs'
--- a/csharp/examples/asyncexample/testasync.cs 2008-02-16 17:04:54 +0000
+++ b/csharp/examples/asyncexample/testasync.cs 2008-06-19 18:53:28 +0000
@@ -88,7 +88,7 @@ class testasync {
ndbapi.ndb_init();
- NdbClusterConnection connection = NdbFactory.createNdbClusterConnection();
+ NdbClusterConnection connection = NdbClusterConnection.create();
if (connection.connect(5,3,true) != 0) {
Console.WriteLine("Connect to cluster management server failed.");
=== modified file 'csharp/examples/test.cs'
--- a/csharp/examples/test.cs 2008-02-16 17:04:54 +0000
+++ b/csharp/examples/test.cs 2008-06-19 18:53:28 +0000
@@ -74,7 +74,7 @@ class test {
ndbapi.ndb_init();
- NdbClusterConnection connection = NdbFactory.createNdbClusterConnection();
+ NdbClusterConnection connection = NdbClusterConnection.create();
try {
connection.connect(5,3,true);
=== modified file 'csharp/examples/test2.cs'
--- a/csharp/examples/test2.cs 2008-02-16 17:04:54 +0000
+++ b/csharp/examples/test2.cs 2008-06-19 18:53:28 +0000
@@ -26,7 +26,7 @@ class test2 {
ndbapi.ndb_init();
- NdbClusterConnection connection = NdbFactory.createNdbClusterConnection();
+ NdbClusterConnection connection = NdbClusterConnection.create();
try {
connection.connect(1,1,true);
} catch (NdbApiException e) {
=== modified file 'csharp/ndbapi.i'
--- a/csharp/ndbapi.i 2008-05-22 17:05:11 +0000
+++ b/csharp/ndbapi.i 2008-06-19 18:53:28 +0000
@@ -251,7 +251,6 @@ public:
%include "ndbapi/ndbglobals.i"
-%include "ndbapi/NdbFactory.i"
%{
#include <stdio.h>
=== modified file 'csharp/ndbapi/ndbapi.mdp'
--- a/csharp/ndbapi/ndbapi.mdp 2008-01-04 19:27:41 +0000
+++ b/csharp/ndbapi/ndbapi.mdp 2008-06-19 18:53:28 +0000
@@ -31,7 +31,6 @@
<File name="generated/NdbEvent.cs" subtype="Code" buildaction="Compile" />
<File name="generated/NdbEventOperation.cs" subtype="Code" buildaction="Compile" />
<File name="generated/NdbException.cs" subtype="Code" buildaction="Compile" />
- <File name="generated/NdbFactory.cs" subtype="Code" buildaction="Compile" />
<File name="generated/NdbIndex.cs" subtype="Code" buildaction="Compile" />
<File name="generated/NdbIndexOperation.cs" subtype="Code" buildaction="Compile" />
<File name="generated/NdbIndexScanOperation.cs" subtype="Code" buildaction="Compile" />
@@ -63,4 +62,4 @@
<AsmRefVar />
<ProjectRefVar />
</MonoDevelop.Autotools.MakefileInfo>
-</Project>
\ No newline at end of file
+</Project>
=== modified file 'interface/ndbapi/NdbClusterConnection.i'
--- a/interface/ndbapi/NdbClusterConnection.i 2008-05-23 18:43:50 +0000
+++ b/interface/ndbapi/NdbClusterConnection.i 2008-06-19 18:53:28 +0000
@@ -25,7 +25,16 @@ class Ndb_cluster_connection {
public:
- // NdbFactory.getNdbClusterConnection should be used instead
+ /* NdbClusterConnection.create should be used instead in
+ * Java and C#.
+ */
+ %ndbexception("NdbApiException") {
+ $action
+ if (result == NULL) {
+ const char * msg = "Couldn't create NdbClusterConnection";
+ NDB_exception(NdbApiException,msg);
+ }
+ }
Ndb_cluster_connection(const char * connectstring = 0);
#if !defined(SWIG_RUBY_AUTORENAME)
@@ -170,11 +179,16 @@ public:
%ndbexception("NdbApiException") {
$action
- if (result) {
- const char * msg = "Cluster was not ready";
+ if (result == NULL) {
+ const char * msg = "Couldn't create NdbClusterConnection";
NDB_exception(NdbApiException,msg);
}
}
+ static Ndb_cluster_connection * create(const char * connectString=0)
+ {
+ return new Ndb_cluster_connection(connectString);
+ }
+
%ndbnoexception;
=== removed file 'interface/ndbapi/NdbFactory.i'
--- a/interface/ndbapi/NdbFactory.i 2008-04-19 18:53:30 +0000
+++ b/interface/ndbapi/NdbFactory.i 1970-01-01 00:00:00 +0000
@@ -1,110 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * ndb-bindings: Bindings for the NDB API
- * Copyright (C) 2008 MySQL
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%newobject NdbFactory::createNdbClusterConnection;
-
-%{
-
- class NdbFactory
- {
-
- public:
- static Ndb_cluster_connection *
- createNdbClusterConnection(const char * connectString = 0)
- {
- Ndb_cluster_connection * theConnection = NULL;
- if (connectString == 0) {
- theConnection = new Ndb_cluster_connection();
- } else {
- theConnection = new Ndb_cluster_connection(connectString);
- }
- return theConnection;
- }
-
- static Ndb * createNdb(Ndb_cluster_connection * theConn,
- const char* aCatalogName="",
- const char* aSchemaName="def") {
- return new Ndb(theConn,aCatalogName,aSchemaName);
- }
-
- static NdbTransaction * createTransaction(Ndb * theNdb,
- const NdbDictTable *table= 0,
- const char *keyData = 0,
- Uint32 keyLen = 0) {
- return theNdb->startTransaction(table,keyData,keyLen);
- }
-
- static NdbTransaction* createTransaction(Ndb * theNdb,
- const char* aTableName,
- const char *keyData) {
- const NdbDictDictionary *myDict = theNdb->getDictionary();
- const NdbDictTable *myTable = myDict->getTable(aTableName);
- return theNdb->startTransaction(myTable,keyData);
- }
- static NdbTransaction* createTransaction(Ndb * theNdb,
- const char* aTableName,
- int keyData) {
- const NdbDictDictionary *myDict = theNdb->getDictionary();
- const NdbDictTable *myTable = myDict->getTable(aTableName);
- return theNdb->startTransaction(myTable,(const char *) &keyData);
- }
-
-
- };
-
- %}
-
-
-class NdbFactory
-{
- // We list these here as private so that SWIG doesnt generate them
- NdbFactory();
- ~NdbFactory();
-public:
-
- %ndbexception("NdbApiException") {
-
- $action
- if (result==NULL) {
- NDB_exception(NdbApiException,"Couldn't allocate object");
- }
- }
- static Ndb_cluster_connection *
- createNdbClusterConnection(const char * connectString = 0);
-
- static Ndb * createNdb(Ndb_cluster_connection * theConn,
- const char* aCatalogName="",
- const char* aSchemaName="def");
-
- static NdbTransaction * createTransaction(Ndb * theNdb,
- const NdbDictTable *table= 0,
- const char *keyData = 0,
- Uint32 keyLen = 0);
-
- static NdbTransaction* createTransaction(Ndb * theNdb,
- const char* aTableName,
- const char *keyData);
-
- static NdbTransaction* createTransaction(Ndb * theNdb,
- const char* aTableName,
- int keyData);
-
-};
=== modified file 'java/com/mysql/cluster/ndbj/NdbClusterConnection.java'
--- a/java/com/mysql/cluster/ndbj/NdbClusterConnection.java 2008-06-10 17:21:30 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbClusterConnection.java 2008-06-19 18:53:28 +0000
@@ -155,7 +155,7 @@ public abstract class NdbClusterConnecti
static public NdbClusterConnection create(String connectString)
throws NdbApiException
{
- return new NdbClusterConnectionImpl(connectString);
+ return NdbClusterConnectionImpl.create(connectString);
}
/**
@@ -179,7 +179,7 @@ public abstract class NdbClusterConnecti
static public NdbClusterConnection create()
throws NdbApiException
{
- return new NdbClusterConnectionImpl(null);
+ return NdbClusterConnectionImpl.create();
}
=== modified file 'lua/ndbapi.i'
--- a/lua/ndbapi.i 2008-04-20 18:59:48 +0000
+++ b/lua/ndbapi.i 2008-06-19 18:53:28 +0000
@@ -50,7 +50,6 @@ static void theCallBack(int result,
#define NDB_exception_err(code,msg,err) do { SWIG_fail; } while(0);
%}
-%include "ndbapi/NdbFactory.i"
%include "ndbapi/NdbClusterConnection.i"
%include "ndbapi/Ndb.i"
%include "ndbapi/NdbDictionary.i"
=== modified file 'lua/test.lua'
--- a/lua/test.lua 2007-09-20 13:32:31 +0000
+++ b/lua/test.lua 2008-06-19 18:53:28 +0000
@@ -26,7 +26,7 @@ print "connecting to cluster\n"
ndbapi.ndb_init()
-connection = ndbapi.NdbFactory_createNdbClusterConnection("127.0.0.1")
+connection = ndbapi.NdbClusterConnection.create("127.0.0.1")
connection:connect(1,1,true)
connection:waitUntilReady(30,30)
=== modified file 'perl/async.pl'
--- a/perl/async.pl 2008-02-16 17:04:54 +0000
+++ b/perl/async.pl 2008-06-19 18:53:28 +0000
@@ -53,7 +53,7 @@ ENGINE=NDBCLUSTER
print "connecting to cluster\n";
-$connection = ndbapi::NdbFactory::createNdbClusterConnection();
+$connection = new ndbapi::NdbClusterConnection();
if ($connection->connect(5,3,1)) {
=== modified file 'perl/ndbapi.i'
--- a/perl/ndbapi.i 2008-04-10 16:18:12 +0000
+++ b/perl/ndbapi.i 2008-06-19 18:53:28 +0000
@@ -33,7 +33,6 @@ typedef int voidint;
%}
%include "perl_callback_typemap.i"
-%include "ndbapi/NdbFactory.i"
%feature("shadow") Ndb_cluster_connection::createNdb(const char* aCatalogName="", const char* aSchemaName="def")
%{
=== modified file 'perl/test.pl'
--- a/perl/test.pl 2008-04-10 16:18:12 +0000
+++ b/perl/test.pl 2008-06-19 18:53:28 +0000
@@ -54,7 +54,7 @@ print "connecting to cluster\n";
# TODO: Shouldn't we make this automatic?
ndbapi::ndb_init();
-$connection = ndbapi::NdbFactory::createNdbClusterConnection();
+$connection = new ndbapi::NdbClusterConnection();
if ($connection->connect(1,1,1)) {
=== modified file 'php/ndbapi.i'
--- a/php/ndbapi.i 2008-04-20 18:59:48 +0000
+++ b/php/ndbapi.i 2008-06-19 18:53:28 +0000
@@ -60,7 +60,6 @@ static void theCallBack(int result,
%}
-%include "ndbapi/NdbFactory.i"
%include "ndbapi/NdbClusterConnection.i"
%include "ndbapi/Ndb.i"
%include "ndbapi/NdbDictionary.i"
=== modified file 'python/examples/async.py'
--- a/python/examples/async.py 2008-04-13 21:25:51 +0000
+++ b/python/examples/async.py 2008-06-19 18:53:28 +0000
@@ -53,7 +53,7 @@ ENGINE=NDBCLUSTER
print "connecting to cluster\n"
try:
- connection = ndbapi.NdbFactory.createNdbClusterConnection();
+ connection = ndbapi.NdbClusterConnection();
connection.connect(1,1,1)
except mysql.cluster.ndbapi.NdbApiException,e:
=== modified file 'python/examples/batchupdate.py'
--- a/python/examples/batchupdate.py 2008-06-19 17:51:16 +0000
+++ b/python/examples/batchupdate.py 2008-06-19 18:53:28 +0000
@@ -43,7 +43,7 @@ print "connecting to cluster\n"
connection=None
try:
- connection = ndbapi.NdbFactory.createNdbClusterConnection()
+ connection = ndbapi.NdbClusterConnection()
connection.connect(5,3,1)
except ndbapi.NdbApiException,e:
sys.exit(-1)
=== modified file 'python/examples/checkdattime.py'
--- a/python/examples/checkdattime.py 2008-04-13 21:25:51 +0000
+++ b/python/examples/checkdattime.py 2008-06-19 18:53:28 +0000
@@ -3,7 +3,7 @@ from datetime import datetime
import sys,time
mtdate=datetime.now()
-c=ndbapi.NdbFactory.createNdbClusterConnection()
+c=ndbapi.NdbClusterConnection()
c.connect(1,1,1)
c.waitUntilReady(5,5)
=== modified file 'python/examples/compare.py'
--- a/python/examples/compare.py 2008-04-13 21:08:34 +0000
+++ b/python/examples/compare.py 2008-06-19 18:53:28 +0000
@@ -42,7 +42,6 @@ connection=None
try:
connection = ndbapi.NdbClusterConnection()
- #connection = ndbapi.NdbFactory.createNdbClusterConnection()
print "connection %s" % connection
connection.connect(5,3,1)
except ndbapi.NdbApiException,e:
=== modified file 'python/examples/joinperf.py'
--- a/python/examples/joinperf.py 2008-04-13 21:25:51 +0000
+++ b/python/examples/joinperf.py 2008-06-19 18:53:28 +0000
@@ -47,7 +47,7 @@ ENGINE=NDBCLUSTER
print "connecting to cluster\n"
try:
- connection = ndbapi.NdbFactory.createNdbClusterConnection();
+ connection = ndbapi.NdbClusterConnection();
connection.connect(1,1,1)
except ndbapi.NdbApiException,e:
=== modified file 'python/ndbapi.i'
--- a/python/ndbapi.i 2008-06-10 15:17:19 +0000
+++ b/python/ndbapi.i 2008-06-19 18:53:28 +0000
@@ -63,8 +63,6 @@ value_lookup=dict()
return ret
%}
-%include "ndbapi/NdbFactory.i"
-
%include "ndbapi/NdbClusterConnection.i"
=== modified file 'python/swig/module_pythoncode.i'
--- a/python/swig/module_pythoncode.i 2008-06-10 15:17:19 +0000
+++ b/python/swig/module_pythoncode.i 2008-06-19 18:53:28 +0000
@@ -47,7 +47,7 @@
verbose=0,timeout_for_first_alive=1,
timeout_after_first_alive=1,*args,**kwargs):
""" Provide DBAPI 2.0 support """
- connection=NdbFactory.createNdbClusterConnection(connectstring)
+ connection=NdbClusterConnection(connectstring)
connection.connect(no_retries,retry_delay_in_seconds,verbose)
connection.wait_until_ready(timeout_for_first_alive,timeout_after_first_alive)
return connection
=== modified file 'python/tests/ClusterTestCase.py'
--- a/python/tests/ClusterTestCase.py 2008-04-13 21:08:34 +0000
+++ b/python/tests/ClusterTestCase.py 2008-06-19 18:53:28 +0000
@@ -39,7 +39,7 @@ class ClusterTestCase(unittest.TestCase)
read_default_group="client")
#if conn is None:
- # conn = ndbapi.NdbFactory.createNdbClusterConnection(self.NDB_MGMD_CONNECTSTRING)
+ # conn = ndbapi.NdbClusterConnection(self.NDB_MGMD_CONNECTSTRING)
#
# conn.connect(5,3,1)
# conn.wait_until_ready(30,30)
=== modified file 'python/tests/shared_cluster_connection.py'
--- a/python/tests/shared_cluster_connection.py 2008-04-13 21:08:34 +0000
+++ b/python/tests/shared_cluster_connection.py 2008-06-19 18:53:28 +0000
@@ -1,6 +1,6 @@
from mysql.cluster import ndbapi
-conn=ndbapi.NdbFactory.createNdbClusterConnection()
+conn=ndbapi.NdbClusterConnection()
conn.connect(5,3,1)
conn.waitUntilReady(30,30)
=== modified file 'ruby/ndbapi.i'
--- a/ruby/ndbapi.i 2008-05-22 17:05:11 +0000
+++ b/ruby/ndbapi.i 2008-06-19 18:53:28 +0000
@@ -224,7 +224,6 @@ static void theCallBack(int result,
}
%}
-%include "ndbapi/NdbFactory.i"
%include "ndbapi/NdbClusterConnection.i"
%include "ndbapi/Ndb.i"
%include "ndbapi/NdbDictionary.i"
=== modified file 'ruby/test.rb'
--- a/ruby/test.rb 2007-09-19 09:54:56 +0000
+++ b/ruby/test.rb 2008-06-19 18:53:28 +0000
@@ -9,7 +9,7 @@ BATCH_SIZE=100
puts "Connecting to cluster"
-connection=Ndbapi::NdbFactory.create_ndb_cluster_connection("127.0.0.1")
+connection=Ndbapi::NdbClusterConnection.create("127.0.0.1")
begin
connection.connect(1,1,1)
=== modified file 'ruby/testasync.rb'
--- a/ruby/testasync.rb 2007-07-25 17:20:31 +0000
+++ b/ruby/testasync.rb 2008-06-19 18:53:28 +0000
@@ -18,8 +18,8 @@ BATCH_SIZE=10
puts "Connecting to cluster"
-#connection=Ndbapi::NdbFactory.createNdbClusterConnection()
-connection=Ndbapi::NdbFactory.create_ndb_cluster_connection("127.0.0.1")
+#connection=Ndbapi::NdbClusterConnection.create()
+connection=Ndbapi::NdbClusterConnection.create("127.0.0.1")
begin
connection.connect(1,1,1)
=== modified file 'ruby/testdt.rb'
--- a/ruby/testdt.rb 2007-05-07 07:57:05 +0000
+++ b/ruby/testdt.rb 2008-06-19 18:53:28 +0000
@@ -7,7 +7,7 @@ insertid=ARGV[0].to_i
puts "Connecting to cluster"
-connection=Ndbapi::NdbFactory.create_ndb_cluster_connection("127.0.0.1")
+connection=Ndbapi::NdbClusterConnection.create("127.0.0.1")
begin
connection.connect(1,1,1)
=== modified file 'ruby/testreaddt.rb'
--- a/ruby/testreaddt.rb 2007-09-19 09:54:56 +0000
+++ b/ruby/testreaddt.rb 2008-06-19 18:53:28 +0000
@@ -7,7 +7,7 @@ insertid=ARGV[0].to_i
puts "Connecting to cluster"
-connection=Ndbapi::NdbFactory.create_ndb_cluster_connection("127.0.0.1")
+connection=Ndbapi::NdbClusterConnection("127.0.0.1")
begin
connection.connect(1,1,1)
=== modified file 'ruby/testselectcount.rb'
--- a/ruby/testselectcount.rb 2007-07-25 17:20:31 +0000
+++ b/ruby/testselectcount.rb 2008-06-19 18:53:28 +0000
@@ -7,7 +7,7 @@ insertid=ARGV[0].to_i
puts "Connecting to cluster"
-connection=Ndbapi::NdbFactory.create_ndb_cluster_connection("127.0.0.1")
+connection=Ndbapi::NdbClusterConnection.create("127.0.0.1")
begin
connection.connect(1,1,1)
=== modified file 'xml/ndbapi.i'
--- a/xml/ndbapi.i 2008-04-20 18:59:48 +0000
+++ b/xml/ndbapi.i 2008-06-19 18:53:28 +0000
@@ -23,7 +23,6 @@
%include "ndbapi/ndbglobals.i"
-%include "ndbapi/NdbFactory.i"
%include "ndbapi/NdbClusterConnection.i"
%include "ndbapi/Ndb.i"
%include "ndbapi/NdbDictionary.i"
| Thread |
|---|
| • bzr commit into NDB/Bindings:trunk branch (monty:413) | Monty Taylor | 20 Jun |