List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:December 11 2007 5:13pm
Subject:Rev 360: Added NdbColumn versions of equal methods. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel

------------------------------------------------------------
revno: 360
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Tue 2007-12-11 15:13:00 -0200
message:
  Added NdbColumn versions of equal methods.
  Added some javadocs
modified:
  interface/ndbapi/NdbOperation.i ndboperation.i-20070228021421-qkr4cbpxymyqdrf3-3
  java/com/mysql/cluster/ndbj/NdbBaseOperationEquals.java
ndbbaseoperationequa-20070517181935-98huwjarzuh25b30-6
=== modified file 'interface/ndbapi/NdbOperation.i'
--- a/interface/ndbapi/NdbOperation.i	2007-12-10 07:39:46 +0000
+++ b/interface/ndbapi/NdbOperation.i	2007-12-11 17:13:00 +0000
@@ -411,6 +411,9 @@
       }
   }
 
+  voidint equalNull(const NdbDictColumn * theColumn) {
+      return self->equal(theColumn->getName(), (char*)0);
+  }
   voidint equalNull(const char* anAttrName) {
       return self->equal(anAttrName, (char*)0);
   }
@@ -418,6 +421,21 @@
       return self->equal(anAttrId, (char*)0);
   }
 
+  voidint equalInt(const NdbDictColumn * theColumn, Int32 theValue) { 
+      return self->equal(theColumn->getName(), theValue);
+  }
+  voidint equalUint(const NdbDictColumn * theColumn, Uint32 theValue) { 
+      return self->equal(theColumn->getName(), theValue);
+  }
+  voidint equalLong(const NdbDictColumn * theColumn, Int64 theValue) { 
+      return self->equal(theColumn->getName(), theValue);
+  } 
+  voidint equalUlong(const NdbDictColumn * theColumn, Uint64 theValue) { 
+      return self->equal(theColumn->getName(), theValue);
+  }
+  voidint equalShort(const NdbDictColumn * theColumn, short theValue) { 
+      return self->equal(theColumn->getName(), theValue);
+  }
   voidint equalShort(const char* anAttrName, short theValue) { 
       return self->equal(anAttrName, (Int32)theValue);
   }
@@ -556,6 +574,15 @@
   }
 
 
+  voidint equalBytes(const NdbDictColumn * theColumn, const char* BYTE, size_t len) {
+    char * stringVal = ndbFormatString(theColumn,BYTE,len);
+    if (stringVal == NULL) 
+      return -1;
+    int retval = self->equal(theColumn->getName(),stringVal);
+    free(stringVal);
+    return retval;
+  }
+
   voidint equalBytes(const char* anAttrName, const char* BYTE, size_t len) {
     const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrName);
     char * stringVal = ndbFormatString(theColumn,BYTE,len);
@@ -574,6 +601,14 @@
     free(stringVal);
     return retval;
   }
+  voidint equalDatetime(const NdbDictColumn * theColumn, MYSQL_TIME * anInputDateTime) { 
+
+    Uint64 dtval = ndbFormatDateTime(theColumn,anInputDateTime);
+    if (dtval == 1) 
+      return dtval;
+    return self->equal(theColumn->getName(),dtval);
+
+  }
   voidint equalDatetime(const char* anAttrName, MYSQL_TIME * anInputDateTime) { 
 
     const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrName);
@@ -594,6 +629,11 @@
     return  self->equal(anAttrId,dtval);
     }
 
+  voidint equalTimestamp(const NdbDictColumn * theColumn, NdbTimestamp anInputTimestamp)
{ 
+
+    return self->equal(theColumn->getName(),anInputTimestamp);
+
+  }
   voidint equalTimestamp(const char* anAttrName, NdbTimestamp anInputTimestamp) { 
 
     return self->equal(anAttrName,anInputTimestamp);
@@ -604,6 +644,11 @@
     return  self->equal(anAttrId,anInputTimestamp);
   }
 
+  voidint equalDecimal(const NdbDictColumn * theColumn, Int64 anInputDecimal) { 
+
+    return self->equal(theColumn->getName(),anInputDecimal);
+
+  }
   voidint equalDecimal(const char* anAttrName, Int64 anInputDecimal) { 
 
     return self->equal(anAttrName,anInputDecimal);

=== modified file 'java/com/mysql/cluster/ndbj/NdbBaseOperationEquals.java'
--- a/java/com/mysql/cluster/ndbj/NdbBaseOperationEquals.java	2007-12-10 07:39:46 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbBaseOperationEquals.java	2007-12-11 17:13:00 +0000
@@ -30,8 +30,22 @@
 	 * @param val the equality value for the column (i.e., 'val' in the SQL  "WHERE
column='val')
      * @throws NdbApiException if there was a problem in the cluster when trying to find
tuples using this column.
      * @throws NdbApiRuntimeException If a bad columnName is entered
+     * @deprecated Use the NdbColumn version of this instead
 	 */
+	@Deprecated
 	public void equalInt(long columnId, int val) throws NdbApiException;
+	
+	/**
+	 * 	This method defines a search condition for a tuple using equality, i.e., a row WHERE
+	 *  the value of its attribute in position columnId is equal to the user-supplied 'val'.
+	 *  To set search conditions on multiple columns, use multiple calls to equal() for each
of the columns;
+	 *  in such cases all of them must be satisfied for the tuple to be selected.
+	 * @param columnId integer position (offset) of column number in schema definition
(columnId starts from  position '1' for the first column in a schema)
+	 * @param val the equality value for the column (i.e., 'val' in the SQL  "WHERE
column='val')
+     * @throws NdbApiException if there was a problem in the cluster when trying to find
tuples using this column.
+     * @throws NdbApiRuntimeException If a bad columnName is entered
+     * @deprecated Use equalInt instead
+	 */
 	@Deprecated
 	public void equal(long columnId, int val) throws NdbApiException;
 
@@ -45,8 +59,23 @@
 	 * @param val the equality value for the column (i.e., 'val' in the SQL  "WHERE
column='val')
      * @throws NdbApiException if there was a problem in the cluster when trying to find
tuples using this column.
      * @throws NdbApiRuntimeException If a bad columnName is entered
+     * @deprecated Use the NdbColumn version of this instead
 	 */
+	@Deprecated
 	public void equalInt(String columnName, int val) throws NdbApiException;
+	
+	/**
+	 * 	This method defines a search condition for a tuple using equality, i.e., a row where
+	 *  the value of its attribute with name columnName is equal to the user-supplied 'val'.
+	 *  To set search conditions on multiple attributes, use several calls to equal();
+	 *  in such cases all of them must be satisfied for the tuple to be selected.
+	 *
+	 * @param columnName name of the Column in the Schema
+	 * @param val the equality value for the column (i.e., 'val' in the SQL  "WHERE
column='val')
+     * @throws NdbApiException if there was a problem in the cluster when trying to find
tuples using this column.
+     * @throws NdbApiRuntimeException If a bad columnName is entered
+     * @deprecated Use equalInt instead
+	 */
 	@Deprecated
 	public void equal(String columnName, int val) throws NdbApiException;
 	/**
@@ -59,11 +88,49 @@
 	 * @param val the equality value for the column (i.e., 'val' in the SQL  "WHERE
column='val')
      * @throws NdbApiException if there was a problem in the cluster when trying to find
tuples using this column.
      * @throws NdbApiRuntimeException If a bad columnName is entered
+     * @deprecated Use the NdbColumn version of this instead
 	 */
+	@Deprecated
 	public void equalString(long columnId, String val) throws NdbApiException;
+	/**
+	 * 	This method defines a search condition for a tuple using equality, i.e., a row where
+	 *  the value of its attribute in position columnId is equal to the user-supplied 'val'.
+	 *  To set search conditions on multiple attributes, use several calls to equal();
+	 *  in such cases all of them must be satisfied for the tuple to be selected.
+	 *
+	 * @param columnId integer position (offset) of column number in schema definition
(columnId starts from  position '1' for the first column in a schema)
+	 * @param val the equality value for the column (i.e., 'val' in the SQL  "WHERE
column='val')
+     * @throws NdbApiException if there was a problem in the cluster when trying to find
tuples using this column.
+     * @throws NdbApiRuntimeException If a bad columnName is entered
+     * @deprecated Use equalString instead
+	 */
 	@Deprecated
 	public void equal(long columnId, String val) throws NdbApiException;
 
+		/**
+		 * 	This method defines a search condition for a tuple using equality, i.e., a row
where
+		 *  the value of its attribute with name columnName is equal to the user-supplied
'val'.
+		 *  To set search conditions on multiple attributes, use several calls to equal();
+		 *  in such cases all of them must be satisfied for the tuple to be selected.
+		 *
+		 * <p>The column can be of type VARCHAR, CHAR, VARBINARY or BINARY.
+		 * If it is of type VARCHAR or CHAR, the supported CHARSETs are Latin1 or utf8.
+		 * <br>Check the string column's CHARSET using the mysql client
+		 * <br>
+		 * >show create table MyTable;
+		 * <br>
+		 * This method is slightly lower performance than the equalUtf8 and equalLatin1
methods.
+		 * It uses a cached table object (that may need to be loaded from cluster, first time
it is used
+		 * or whenever the table schema is changed) to check the column CHARSET type.
+		 *
+		 * @param columnName name of the Column in the Schema
+		 * @param val the equality value for the column (i.e., 'val' in the SQL  "WHERE
column='val')
+	     * @throws NdbApiException if there was a problem in the cluster when trying to find
tuples using this column.
+	     * @throws NdbApiRuntimeException If a bad columnName is entered
+	     * @deprecated Use the NdbColumn version of this instead
+		 */
+	@Deprecated
+	public void equalString(String columnName, String val) throws NdbApiException;
 	/**
 	 * 	This method defines a search condition for a tuple using equality, i.e., a row where
 	 *  the value of its attribute with name columnName is equal to the user-supplied 'val'.
@@ -84,8 +151,8 @@
 	 * @param val the equality value for the column (i.e., 'val' in the SQL  "WHERE
column='val')
      * @throws NdbApiException if there was a problem in the cluster when trying to find
tuples using this column.
      * @throws NdbApiRuntimeException If a bad columnName is entered
+     * @deprecated Use equalString instead
 	 */
-	public void equalString(String columnName, String val) throws NdbApiException;
 	@Deprecated
 	public void equal(String columnName, String val) throws NdbApiException;
 

Thread
Rev 360: Added NdbColumn versions of equal methods. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/develMonty Taylor11 Dec