List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:July 26 2007 6:58pm
Subject:Rev 131: Added System.DateTime to MYSQL_TIME typemap for C# in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge

------------------------------------------------------------
revno: 131
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: ndbjmerge
timestamp: Thu 2007-07-26 11:58:43 -0700
message:
  Added System.DateTime to MYSQL_TIME typemap for C#
modified:
  csharp/ndbapi.i               
svn-v2:10@5fca6d9a-db22-0410-b55c-899b0a28da89-trunk-csharp%2fndb.i
  swig/ndbglobals.i              globals.i-20070228021421-qkr4cbpxymyqdrf3-7
=== modified file 'csharp/ndbapi.i'
--- a/csharp/ndbapi.i	2007-07-26 00:44:39 +0000
+++ b/csharp/ndbapi.i	2007-07-26 18:58:43 +0000
@@ -55,6 +55,22 @@
   }
  }
 */
+%typemap(cstype) MYSQL_TIME * "System.DateTime";
+%typemap(csin) MYSQL_TIME * "MYSQL_TIME.getCPtr(MYSQL_TIME.getMYSQL_TIME($csinput))"
+
+%typemap(cscode) MYSQL_TIME %{
+public static MYSQL_TIME getMYSQL_TIME(System.DateTime aDateTime) { 
+  MYSQL_TIME myTime = new MYSQL_TIME();
+  myTime.year = (uint)aDateTime.Year;
+  myTime.month = (uint)aDateTime.Month;
+  myTime.day = (uint)aDateTime.Day;
+  myTime.hour = (uint)aDateTime.Hour;
+  myTime.minute = (uint)aDateTime.Minute;
+  myTime.second = (uint)aDateTime.Second;
+  return myTime;
+}
+  %}
+
 //%typemap(in) (const char* anInputString, size_t len) {
   /* Check that we are getting a string */
  /* if (PyString_Check($input)) {
@@ -185,6 +201,7 @@
 
 %include "NdbOperation.i"
 %include "NdbScanOperation.i"
+%include "NdbIndexOperation.i"
 %include "NdbIndexScanOperation.i"
 %include "NdbEventOperation.i"
 %include "NdbRecAttr.i"

=== modified file 'swig/ndbglobals.i'
--- a/swig/ndbglobals.i	2007-06-29 15:17:26 +0000
+++ b/swig/ndbglobals.i	2007-07-26 18:58:43 +0000
@@ -27,7 +27,6 @@
 #include <NdbApi.hpp> 
 //#include <m_ctype.h>
 
-
   class BaseCallback { 
 
   public:
@@ -54,6 +53,20 @@
 
 %}
 
+typedef char my_bool;
+enum enum_mysql_timestamp_type
+{
+  MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
+  MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
+};
+
+typedef struct st_mysql_time
+{
+  unsigned int  year, month, day, hour, minute, second;
+  unsigned long second_part;
+  my_bool       neg;
+  enum enum_mysql_timestamp_type time_type;
+} MYSQL_TIME;
 
 // TODO: This is a little stupid. 
 //   Why don't we just typedef these right in the first place

Thread
Rev 131: Added System.DateTime to MYSQL_TIME typemap for C# in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmergeMonty Taylor26 Jul