List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:May 2 2007 5:06am
Subject:Rev 93: Hooked csharp dir up to automake/libtool. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/exceptions
View as plain text  
------------------------------------------------------------
revno: 93
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: exceptions
timestamp: Tue 2007-05-01 22:05:05 -0700
message:
  Hooked csharp dir up to automake/libtool.
  Brought csharp up to date with other changes, except for custom exceptions,
    which it turns out are going to take a little more effort in csharp.
added:
  csharp/MySql.Data.dll          mysql.data.dll-20070502041820-zgr1aeh272ptdpwv-1
renamed:
  csharp/Makefile.in => csharp/Makefile.am
makefile.in-20070228073157-gkwqutuh9f3nq7s2-1
modified:
  configure.in                   configure.in-20070228020914-u2pk759xg7thauwf-13
  csharp/ndbapi.i               
svn-v2:10@5fca6d9a-db22-0410-b55c-899b0a28da89-trunk-csharp%2fndb.i
  csharp/test.cs                
svn-v2:1@5fca6d9a-db22-0410-b55c-899b0a28da89-trunk-csharp%2ftest.cs
  csharp/test2.cs               
svn-v2:1@5fca6d9a-db22-0410-b55c-899b0a28da89-trunk-csharp%2ftest2.cs
  csharp/Makefile.am             makefile.in-20070228073157-gkwqutuh9f3nq7s2-1
=== added file 'csharp/MySql.Data.dll'
Binary files a/csharp/MySql.Data.dll	1970-01-01 00:00:00 +0000 and
b/csharp/MySql.Data.dll	2007-05-02 05:05:05 +0000 differ
=== renamed file 'csharp/Makefile.in' => 'csharp/Makefile.am'
--- a/csharp/Makefile.in	2007-02-28 07:32:51 +0000
+++ b/csharp/Makefile.am	2007-05-02 05:05:05 +0000
@@ -1,51 +1,27 @@
-top_srcdir = @top_srcdir@
-swig_sources = @SWIG_SOURCES@
-TARGET = ndbwrap
-SRCS = ndbapi_wrap.cxx
-OBJS = ndbapi_wrap.o 
-CXX = g++
-INCLUDE_DIRS = @MYSQL_INCLUDES@
-CFLAGS =  @CFLAGS@
-#-c -Wall -fno-rtti -fno-exceptions $(INCLUDE_DIRS)  -Wreturn-type -Wtrigraphs -W
-Wformat -Wsign-compare -Wunused -g -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall
-fPIC @CFLAGS@
-
-SWIG_INCLUDES = -I${top_srcdir}/swig
-LD_FLAGS = @LDFLAGS@
-LFLAGS = -Wall -L/usr/lib/mysql
-CSHARP_SOURCES=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
-MYSQL_DLL = /usr/lib/mono/gac/MySql.Data/1.0.7.30073__8e323390df8d9ed4/MySql.Data.dll
-#MYSQL_DLL = /usr/lib/mono/gac/MySql.Data/5.0.2.0__c5687fc88969c44d/MySql.Data.dll
-
-all: test 
-
-test: test.cs ndbapi.dll
-	gmcs  -r:ndbapi.dll -r:$(MYSQL_DLL) test.cs
-
-%.dll: %.so  
+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 = MySql.Data.dll
+CLEANFILES = ndbapi.dll *exe ndbapi mgmapi ndbapi.cpp MySql.Cluster.NdbApi.dll ndbapi/*
+
+lib_LTLIBRARIES = libndbsharp.la
+libndbsharp_la_SOURCES = ndbapi.cpp
+libndbsharp_la_LDFLAGS = -fpic
+libndbsharp_la_CPPFLAGS = $(PTHREAD_CFLAGS)
+libndbsharp_la_DEPENDENCIES = MySql.Cluster.NdbApi.dll 
+
+test: test.exe test2.exe libndbsharp_la
+
+%.exe: %.cs MySql.Cluster.NdbApi.dll ndbapi.cpp
+	$(MCS)  -r:MySql.Cluster.NdbApi.dll -r:$(MYSQL_DLL) $<
+
+MySql.Cluster.NdbApi.dll: 
+	$(MCS) -target:library -out:$@ ndbapi/*.cs
+
 #$(CSHARP_SOURCES)
-	gmcs -target:library -out:$*.dll $*/*
-
-%.so: %.o
-	g++     -g -fPIC -shared  -o $@ $^ $(LD_FLAGS)
-
-#mgm.so: $(MOBJS)
-#	g++     -g -fPIC -shared  -o $@ $^ $(LD_FLAGS)
-#	g++     -g -fPIC -shared  -o _ndb.so.1.35.0  -L"/usr/lib/mysql"
-L"/usr/lib/python2.4/config"
-L"bin/boost/libs/python/build/libboost_python.so/gcc/debug/shared-linkable-true"  
$(TARGET).o     -lndbclient -lmysqlclient -lmystrings -lmysys -lz -lcrypt -lnsl -lm
-lpthread -lboost_python  -Wl,-rpath-link,.  
-#	ln -s $(TARGET).so.1.35.0 $(TARGET).so
-
-.PRECIOUS: %.cpp %.so %.dll
-%.cpp: %.i ${swig_sources}
+#.PRECIOUS: %.cpp %.so %.dll
+#/usr/bin/objcopy --set-section-flags .debug_str=contents,debug $@
+
+%.cpp: %.i ${SWIG_SOURCES}
 	@mkdir -p $*
-	swig -c++ -csharp -namespace MySql.Data.NdbApi $(INCLUDE_DIRS) $(SWIG_INCLUDES) -outdir
$* -o $@ $<
-
-%.o: %.cpp
-	$(CXX) -c $(CFLAGS) -o $@ $^
-#$(TARGET).o: $(SRCS)
-#	g++ -c  -DBOOST_PYTHON_DYNAMIC_LIB  -g -O0 -fno-inline -Wall -fPIC 
-ftemplate-depth-255  -I"bin/python-ndbapi" -I"/usr/include/mysql/ndb"
-I"/usr/include/mysql/ndb/ndbapi"   -I "/usr/include/python2.4" -I
"/home/mtaylor/src/boost/cctbx_sources/boost"  -o $(TARGET).o  $(TARGET).cpp 
-	/usr/bin/objcopy --set-section-flags .debug_str=contents,debug $@
-
-clean:
-	rm -rf *.o $(TARGET).so *.dll $(CSHARP_SOURCES) *PINVOKE* *so *cpp *exe ndbapi mgm 
-
-distclean: clean
-	rm -f Makefile
+	${SWIG} -csharp -dllimport libndbsharp -namespace MySql.Cluster.NdbApi \
+		-I$(SWIG_DIR) $(MYSQL_INCLUDES) -outdir $* -o $@ $<
 

=== modified file 'configure.in'
--- a/configure.in	2007-05-02 02:56:57 +0000
+++ b/configure.in	2007-05-02 05:05:05 +0000
@@ -11,6 +11,8 @@
 
 #AC_CHECK_PROGS(SWIG,swig)
 AC_PROG_SWIG(1.3.31)
+AC_CHECK_PROGS(MONO,mono)
+AC_CHECK_PROGS(MCS,gmcs)
 SWIG_ENABLE_CXX
 AC_CANONICAL_HOST
 ACX_PTHREAD()

=== modified file 'csharp/ndbapi.i'
--- a/csharp/ndbapi.i	2007-04-27 05:23:30 +0000
+++ b/csharp/ndbapi.i	2007-05-02 05:05:05 +0000
@@ -43,14 +43,20 @@
   }
 %}
 
+/*
 %typemap(csfinalize) NdbTransaction %{
-  ~$cslassname() {
+  ~$csclassname() {
     // This is only if we haven't managed to kill this guy yet.
     // Don't depend on this.
-    ndbReference.closeTransaction(this);
+    this.close(this);
     Dispose();
     }
 %}
+*/
+
+%{
+#define NDB_exception(excp,msg) { SWIG_CSharpException(SWIG_RuntimeError,msg); }
+%}
 
 %include "globals.i"
 %include "NdbFactory.i"

=== modified file 'csharp/test.cs'
--- a/csharp/test.cs	2007-03-20 18:38:45 +0000
+++ b/csharp/test.cs	2007-05-02 05:05:05 +0000
@@ -20,7 +20,7 @@
 using System;
 using MySql.Data.MySqlClient;
 using System.Collections.Generic;
-using MySql.Data.NdbApi; 
+using MySql.Cluster.NdbApi; 
 
 class test { 
   static public int Main(string[] args) {
@@ -38,7 +38,7 @@
     int BATCH_SIZE=1000;
     
     MySqlConnection conn = new MySqlConnection();
-    conn.ConnectionString = "Server=localhost;Uid=root;Pwd="; 
+    conn.ConnectionString = "Server=127.0.0.1;User Id=root;Password=;Connection
Timeout=15;";
     conn.Open();
     
     Console.WriteLine("Creating schema");
@@ -71,7 +71,7 @@
     
     ndbapi.ndb_init();
     
-    Ndb_cluster_connection connection = new Ndb_cluster_connection();
+    NdbClusterConnection connection = NdbFactory.createNdbClusterConnection();
     
     if (connection.connect(5,3,1) != 0) { 
       Console.WriteLine("Connect to cluster management server failed.");
@@ -95,7 +95,7 @@
     NdbTransaction myTransaction; 
     DateTime start_time = DateTime.Now;
     
-    for (int t=0;t<=System.Math.Ceiling(INSERT_NUM/BATCH_SIZE);t++) { 
+    for (int t=0;t<=System.Math.Ceiling((decimal)(INSERT_NUM/BATCH_SIZE));t++) { 
       myTransaction= myNdb.startTransaction();
       int val = (t+1)*BATCH_SIZE-INSERT_NUM;
       int offset = (val > 0 ) ? val : 0;
@@ -117,7 +117,7 @@
       if (ret == -1) { 
 	Console.WriteLine(myTransaction.getNdbError().getMessage());
       }
-      myNdb.closeTransaction(myTransaction);
+      myTransaction.close();
       
     }
     DateTime end_time = DateTime.Now; 
@@ -146,7 +146,7 @@
       
     }
 
-    myNdb.closeTransaction(myTransaction);
+    myTransaction.close();
 
     start_time=DateTime.Now;
 
@@ -173,7 +173,7 @@
         Console.WriteLine(myTransaction.getNdbError().getMessage());
       }
       uint foo=myRecAttr.u_32_value();
-      myNdb.closeTransaction(myTransaction); 
+      myTransaction.close(); 
       
     }
     end_time=DateTime.Now; 

=== modified file 'csharp/test2.cs'
--- a/csharp/test2.cs	2006-12-08 21:35:41 +0000
+++ b/csharp/test2.cs	2007-05-02 05:05:05 +0000
@@ -17,19 +17,19 @@
 */
 
 
-using MySql.Data.NdbApi; 
+using MySql.Cluster.NdbApi; 
 
 class test { 
   static public int Main(string[] args) {
    
     
-    ndb.ndb_init();
+    ndbapi.ndb_init();
     
-    Ndb_cluster_connection connection = new Ndb_cluster_connection();
+    NdbClusterConnection connection = NdbFactory.createNdbClusterConnection();
 
-    ndb.ndb_end(1);
+    ndbapi.ndb_end(1);
 
     return 0;
 
 }      
-}
\ No newline at end of file
+}

Thread
Rev 93: Hooked csharp dir up to automake/libtool. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/exceptionsMonty Taylor2 May