Date: Friday, November 25, 2005 @ 16:04:47
  Author: gilles
    Path: /cvsroot/carob/carob

   Added: include/ResultSetMetaData.hpp (1.1) include/TypeConstants.hpp
          (1.1) src/ResultSetMetaData.cpp (1.1)
Modified: Makefile (1.19 -> 1.20) include/DriverResultSet.hpp (1.9 ->
          1.10) include/Field.hpp (1.4 -> 1.5) include/TypeTag.hpp (1.4 ->
          1.5) src/Field.cpp (1.4 -> 1.5)
 Removed: include/TypeTagConstants.hpp (1.3)

Added ResultSetMetadata:
- added getters and setters on Field members
- renamed TypeTagConstants.hpp to TypeConstants.hpp to integrate SQL types in 
it and to keep a meaningfull name


-------------------------------+
 Makefile                      |    1 
 include/DriverResultSet.hpp   |   13 +
 include/Field.hpp             |  144 +++++++++++++++++---
 include/ResultSetMetaData.hpp |  288 ++++++++++++++++++++++++++++++++++++++++
 include/TypeConstants.hpp     |   81 +++++++++++
 include/TypeTag.hpp           |    2 
 include/TypeTagConstants.hpp  |   49 ------
 src/Field.cpp                 |   36 ++---
 src/ResultSetMetaData.cpp     |  155 +++++++++++++++++++++
 9 files changed, 682 insertions(+), 87 deletions(-)


Index: carob/Makefile
diff -u carob/Makefile:1.19 carob/Makefile:1.20
--- carob/Makefile:1.19 Wed Nov 23 15:17:52 2005
+++ carob/Makefile      Fri Nov 25 16:04:47 2005
@@ -46,6 +46,7 @@
                                          ${SRCDIR}/ConnectionPool.o\
                                          ${SRCDIR}/Request.o\
                                          
${SRCDIR}/RequestWithResultSetParameters.o\
+                                         ${SRCDIR}/ResultSetMetaData.o\
                                          ${SRCDIR}/DriverResultSet.o\
                                          ${SRCDIR}/Field.o\
                                          ${SRCDIR}/Statement.o\
Index: carob/include/DriverResultSet.hpp
diff -u carob/include/DriverResultSet.hpp:1.9 
carob/include/DriverResultSet.hpp:1.10
--- carob/include/DriverResultSet.hpp:1.9       Thu Nov 24 12:17:10 2005
+++ carob/include/DriverResultSet.hpp   Fri Nov 25 16:04:47 2005
@@ -99,6 +99,7 @@
 class DriverResultSet
 {
 friend class Statement;
+friend class ResultSetMetaData;
 public:
   /**
    * Creates a DriverResultSet by deserializing infos from the given connection
@@ -261,12 +262,20 @@
 /**
  * Structure for storing the result of an execute() command.
  * This result is a list of either ResultSet or updateCount. So the result
- * representation will be a list of <this structure> elements
+ * representation will be a list of \<this structure\> elements
  */
 typedef struct
 {
+  /** Whether the value is a ResultSet (true) or an updateCount (false) */
   bool isResultSet;
-  union RSorUC { DriverResultSet* resultSetPtr; int updateCount; } value;
+  /** Value itself. Can be either a DriverResultSet or an updateCount */
+  union RSorUC
+  {
+    /** Pointer (to avoid copy of large objects) to a DriverResultSet object */
+    DriverResultSet* resultSetPtr;
+    /** Number of column concerned by the update */
+    int32_t updateCount;
+  } value;
 } ResultSetOrUpdateCount;
 
 #endif /*DRIVERRESULTSET_H_*/
Index: carob/include/Field.hpp
diff -u carob/include/Field.hpp:1.4 carob/include/Field.hpp:1.5
--- carob/include/Field.hpp:1.4 Wed Nov 23 17:30:45 2005
+++ carob/include/Field.hpp     Fri Nov 25 16:04:47 2005
@@ -44,24 +44,134 @@
        Field(const DriverSocket& sock) throw (SocketIOException,
       UnexpectedException);
        virtual ~Field() {};
+
+  /**
+   * Returns the fieldLabel value.
+   * @return the fieldLabel
+   */
+  wstring getFieldLabel() const { return field_label; }
+  /**
+   * Gets the field name.
+   * @return a <code>wstring</code> containing the field name
+   */
+  wstring getFieldName() const { return field_name; }
+  /**
+   * Gets the full name: "tableName.fieldName"
+   * @return a <code>String</code> containing the full field name
+   */
+  wstring getFullName() { return table_name + L"." + field_name; }
+  /**
+   * Get the number of decimal digits.
+   * @return precision
+   */
+  int32_t getPrecision() { return precision; }
+  /**
+   * Gets the number of digits to right of the decimal point.
+   * @return scale
+   */
+  int32_t getScale() { return scale; }
+  /**
+   * Returns the JDBC type code.
+   * 
+   * @return int Type according to java.sql.Types, reflected in
+   * TypeConstants.hpp
+   * @see TypeConstants.hpp
+   */
+  int32_t getSqlType() { return sql_type; }
+  /**
+   * Gets the table name.
+   * @return table name
+   */
+  wstring getTableName() { return table_name; }
+  /**
+   * Retrieves the database-specific type name.
+   * @return SQL type name
+   */
+  wstring getTypeName() { return type_name; }
+  /**
+   * Returns the Java class used by the mapping.
+   * Not very meanfull for carob, but keeps java driver code reflexion
+   */
+  wstring getColumnClassName() { return column_class_name; }
+  /**
+   * Indicates the normal maximum width in characters.
+   * @return column display size
+   */
+  int32_t getColumnDisplaySize() { return column_display_size; }
+  /**
+   * Indicates whether the column (field) is automatically numbered, thus
+   * read-only.
+   */
+  bool isAutoIncrement() { return is_auto_increment; }
+  /**
+   * Indicates whether a column's case matters.
+   * @return true if case sensitive
+   */
+  bool isCaseSensitive() { return is_case_sensitive; }
+  /**
+   * Indicates whether the column is a cash value.
+   * @return true if the column is a currency
+   */
+  bool isCurrency() { return is_currency; }
+  /**
+   * Indicates whether a write will definitely succeed.
+   * @return definitely writable
+   */
+  bool isDefinitelyWritable() { return is_definitely_writable; }
+  /**
+   * Indicates the nullability of values
+   * @return the nullability status of the given column; one of 
+   * <code>columnNoNulls</code>, <code>columnNullable</code> or 
+   * <code>columnNullableUnknown</code>
+   * @see ResultSetMetadata.hpp
+   */
+  int isNullable() { return is_nullable; }
+  /**
+   * Indicates whether the column is definitely not writable.
+   * @return is readonly
+   */
+  bool isReadOnly() { return is_read_only; }
+  /**
+   * Indicates whether the column can be used in a where clause.
+   * @return is searchable
+   */
+  bool isSearchable() { return is_searchable; }
+  /**
+   * Indicates whether values in the column are signed numbers.
+   * @return is signed
+   */
+  bool isSigned() { return is_signed; }
+  /**
+   * Indicates whether it is possible for a write on the column to succeed.
+   * @return is writable
+   */
+  bool isWritable() { return is_writable; }
+
+  /**
+   * Returns the full name of the column
+   * @return full name
+   * @see #getFullName()
+   */
+  wstring toString() { return getFullName(); }
+
 private:
-  wstring             tableName;
-  bool                tableNameNotNull;
-  wstring             fieldName;
-  wstring             fieldLabel;
-  int32_t             columnDisplaySize;
-  int32_t             sqlType;
-  wstring             typeName;
-  wstring             columnClassName;
-  bool                isAutoIncrement;
-  bool                isCaseSensitive;
-  bool                isCurrency;
-  int32_t             isNullable;
-  bool                isReadOnly;
-  bool                isWritable;
-  bool                isDefinitelyWritable;
-  bool                isSearchable;
-  bool                isSigned;
+  wstring             table_name;
+  bool                table_name_not_null;
+  wstring             field_name;
+  wstring             field_label;
+  int32_t             column_display_size;
+  int32_t             sql_type;
+  wstring             type_name;
+  wstring             column_class_name;
+  bool                is_auto_increment;
+  bool                is_case_sensitive;
+  bool                is_currency;
+  int32_t             is_nullable;
+  bool                is_read_only;
+  bool                is_writable;
+  bool                is_definitely_writable;
+  bool                is_searchable;
+  bool                is_signed;
   int32_t             precision;
   int32_t             scale;
 };
Index: carob/include/ResultSetMetaData.hpp
diff -u /dev/null carob/include/ResultSetMetaData.hpp:1.1
--- /dev/null   Fri Nov 25 16:04:47 2005
+++ carob/include/ResultSetMetaData.hpp Fri Nov 25 16:04:47 2005
@@ -0,0 +1,288 @@
+/**
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2005 Emic Networks
+ * Contact: [EMAIL PROTECTED]
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Initial developer(s): Gilles Rayrat
+ * Contributor(s): 
+ */
+
+#ifndef RESULTSETMETADATA_HPP_
+#define RESULTSETMETADATA_HPP_
+
+#include "CarobException.hpp"
+#include "DriverResultSet.hpp"
+
+//Nullability constants
+/**
+ * The constant indicating that a
+ * column does not allow <code>NULL</code> values.
+ */
+#define columnNoNulls             0
+/**
+ * The constant indicating that a
+ * column allows <code>NULL</code> values.
+ */
+#define columnNullable            1
+/**
+ * The constant indicating that the
+ * nullability of a column's values is unknown.
+ */
+#define columnNullableUnknown     2
+
+/**
+ * ResultSet metadata provided for pretty printing of the ResultSet by a
+ * console.
+ */
+class ResultSetMetaData
+{
+public:
+  /**
+   * Constructs a ResultSetMetaData from a DriverResultSet.
+   * @param rs DriverResultSet to be associated to this MetaData
+   * @exception DriverException if the given result set is NULL
+   */
+       ResultSetMetaData(DriverResultSet* rs) throw (DriverException, 
+      UnexpectedException);
+      
+       virtual ~ResultSetMetaData() {};
+  /**
+   * Returns the number of columns in this <code>ResultSet</code> object.
+   * @return the number of columns
+   */
+  int32_t               getColumnCount() { return resultSetPtr->nbOfColumns; }
+  /**
+   * Indicates whether the designated column is automatically numbered, thus
+   * read-only.
+   * @param column the first column is 1, the second is 2, ...
+   * @return <code>true</code> if so; <code>false</code> otherwise
+   * @exception DriverException if a the given column number is out of range
+   */
+  bool                  isAutoIncrement(int column) throw (DriverException, 
+                            UnexpectedException);
+  /**
+   * Indicates whether a column's case matters.
+   * @param column the first column is 1, the second is 2, ...
+   * @return <code>true</code> if so; <code>false</code> otherwise
+   * @exception DriverException if a the given column number is out of range
+   */
+  bool                  isCaseSensitive(int column) throw (DriverException,
+                            UnexpectedException);
+
+  /**
+   * Indicates whether the designated column can be used in a where clause.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return <code>true</code> if so; <code>false</code> otherwise
+   * @exception DriverException if a the given column number is out of range
+   */
+  bool                  isSearchable(int column) throw (DriverException,
+                            UnexpectedException);
+
+  /**
+   * Indicates whether the designated column is a cash value.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return <code>true</code> if so; <code>false</code> otherwise
+   * @exception DriverException if a the given column number is out of range
+   */
+  bool                  isCurrency(int column) throw (DriverException,
+                            UnexpectedException);
+
+  /**
+   * Indicates the nullability of values in the designated column.    
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return the nullability status of the given column; one of
+   *         <code>columnNoNulls</code>, <code>columnNullable</code> or 
+   *         <code>columnNullableUnknown</code>
+   * @exception DriverException if a the given column number is out of range
+   */
+  int                   isNullable(int column) throw (DriverException,
+                            UnexpectedException);
+
+  /**
+   * Indicates whether values in the designated column are signed numbers.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return <code>true</code> if so; <code>false</code> otherwise
+   * @exception DriverException if a the given column number is out of range
+   */
+  bool                  isSigned(int column) throw (DriverException,
+                            UnexpectedException);
+
+  /**
+   * Indicates the designated column's normal maximum width in characters.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return the normal maximum number of characters allowed as the width
+   *          of the designated column
+   * @exception DriverException if a the given column number is out of range
+   */
+  int                   getColumnDisplaySize(int column) throw 
(DriverException,
+                            UnexpectedException);
+
+  /**
+   * Gets the designated column's suggested title for use in printouts and
+   * displays.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return the suggested column title
+   * @exception DriverException if a the given column number is out of range
+   */
+  wstring               getColumnLabel(int column) throw (DriverException, 
+                            UnexpectedException);  
+
+  /**
+   * Get the designated column's name.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return column name
+   * @exception DriverException if a the given column number is out of range
+   */
+  wstring               getColumnName(int column) throw (DriverException, 
+                            UnexpectedException);
+
+  /**
+   * Get the designated column's table's schema.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return schema name or "" if not applicable
+   * @exception DriverException if a the given column number is out of range
+   */
+  wstring               getSchemaName(int column) throw (DriverException, 
+                            UnexpectedException);
+
+  /**
+   * Get the designated column's number of decimal digits.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return precision
+   * @exception DriverException if a the given column number is out of range
+   */
+  int                   getPrecision(int column) throw (DriverException, 
+                            UnexpectedException);
+
+  /**
+   * Gets the designated column's number of digits to right of the decimal 
point.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return scale
+   * @exception DriverException if a the given column number is out of range
+   */
+  int                   getScale(int column) throw (DriverException, 
+                            UnexpectedException); 
+
+  /**
+   * Gets the designated column's table name. 
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return table name or "" if not applicable
+   * @exception DriverException if a the given column number is out of range
+   */
+  wstring               getTableName(int column) throw (DriverException, 
+                            UnexpectedException);
+
+  /**
+   * Gets the designated column's table's catalog name.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return the name of the catalog for the table in which the given column
+   *          appears or "" if not applicable
+   * @exception DriverException if a the given column number is out of range
+   */
+  wstring               getCatalogName(int column) throw (DriverException, 
+                            UnexpectedException);
+
+  /**
+   * Retrieves the designated column's SQL type.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return SQL type
+   * @exception DriverException if a the given column number is out of range
+   * @see TypeConstants.hpp
+   */
+  int                   getColumnType(int column) throw (DriverException, 
+                            UnexpectedException);
+
+  /**
+   * Retrieves the designated column's database-specific type name.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return type name used by the database. If the column type is
+   * a user-defined type, then a fully-qualified type name is returned.
+   * @exception DriverException if a the given column number is out of range
+   */
+  wstring               getColumnTypeName(int column) throw (DriverException, 
+                            UnexpectedException);
+
+  /**
+   * Indicates whether the designated column is definitely not writable.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return <code>true</code> if so; <code>false</code> otherwise
+   * @exception DriverException if a the given column number is out of range
+   */
+  bool                  isReadOnly(int column) throw (DriverException, 
+                            UnexpectedException);
+
+  /**
+   * Indicates whether it is possible for a write on the designated column to 
succeed.
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return <code>true</code> if so; <code>false</code> otherwise
+   * @exception DriverException if a the given column number is out of range
+   */
+  bool                  isWritable(int column) throw (DriverException, 
+                            UnexpectedException);
+
+  /**
+   * Indicates whether a write on the designated column will definitely 
succeed.  
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return <code>true</code> if so; <code>false</code> otherwise
+   * @exception DriverException if a the given column number is out of range
+   */
+  bool                  isDefinitelyWritable(int column) throw 
(DriverException, 
+                            UnexpectedException);
+
+   /**
+   * Returns the fully-qualified name of the Java class.
+   * Not very meanfull for carob, but keeps java driver code reflexion
+   *
+   * @param column the first column is 1, the second is 2, ...
+   * @return the fully-qualified name of the class in the Java programming
+   *         language.
+   * @exception DriverException if a the given column number is out of range
+   */
+  wstring getColumnClassName(int column) throw (DriverException, 
+                            UnexpectedException);
+
+private:
+  /**
+   * Pointer to the corresponding result set. Must be set at construction and 
+   * should never be NULL
+   */
+  DriverResultSet*      resultSetPtr;
+  /**
+   * Utility function: checks that the given column number is between 1 and 
+   * ResultSet's <code>nbOfColumns</code> and throws and exception if not.
+   */
+  void ResultSetMetaData::checkColumnIndex(int column) throw (DriverException,
+    UnexpectedException);
+};
+
+
+#endif /*RESULTSETMETADATA_HPP_*/
Index: carob/include/TypeConstants.hpp
diff -u /dev/null carob/include/TypeConstants.hpp:1.1
--- /dev/null   Fri Nov 25 16:04:47 2005
+++ carob/include/TypeConstants.hpp     Fri Nov 25 16:04:47 2005
@@ -0,0 +1,81 @@
+/**
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2005 Emic Networks
+ * Contact: [EMAIL PROTECTED]
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Initial developer(s): Gilles Rayrat
+ * Contributor(s): 
+ */
+//Type Tag Constants
+#define TT_TYPE_ERROR         -1
+#define TT_STRING             0
+#define TT_BIGDECIMAL         1
+#define TT_BOOLEAN            2
+#define TT_INTEGER            3
+#define TT_LONG               4
+#define TT_FLOAT              5
+#define TT_DOUBLE             6
+#define TT_BYTE_ARRAY         7
+#define TT_SQL_DATE           8
+#define TT_SQL_TIME           9
+#define TT_SQL_TIMESTAMP      10
+#define TT_CLOB               11
+#define TT_BLOB               12
+#define TT_JAVA_SERIALIZABLE  13
+#define TT_RESULTSET          14
+#define TT_NULL_RESULTSET     15
+#define TT_FIELD              16
+#define TT_COL_TYPES          17
+#define TT_ROW                18
+#define TT_NOT_EXCEPTION      19
+#define TT_EXCEPTION          20
+#define TT_BACKEND_EXCEPTION  21
+#define TT_CORE_EXCEPTION     22
+#define TT_CONTROLLER_READY   23
+#define TT_UNDEFINED          24
+
+#define TT_NUMBER_OF_TYPES    26
+
+// SQL Types constants
+#define SQLT_BIT              -7
+#define SQLT_TINYINT          -6
+#define SQLT_SMALLINT         5
+#define SQLT_INTEGER          4
+#define SQLT_BIGINT           -5
+#define SQLT_FLOAT            6
+#define SQLT_REAL             7
+#define SQLT_DOUBLE           8
+#define SQLT_NUMERIC          2
+#define SQLT_DECIMAL          3
+#define SQLT_CHAR             1
+#define SQLT_VARCHAR          12
+#define SQLT_LONGVARCHAR      -1
+#define SQLT_DATE             91
+#define SQLT_TIME             92
+#define SQLT_TIMESTAMP        93
+#define SQLT_BINARY           -2
+#define SQLT_VARBINARY        -3
+#define SQLT_LONGVARBINARY    -4
+//#define SQLT_NULL             0
+#define SQLT_OTHER            1111
+#define SQLT_JAVA_OBJECT      2000
+#define SQLT_DISTINCT         2001
+#define SQLT_STRUCT           2002
+#define SQLT_ARRAY            2003
+#define SQLT_BLOB             2004
+#define SQLT_CLOB             2005
+#define SQLT_REF              2006
+#define SQLT_DATALINK         70
+#define SQLT_BOOLEAN          16
Index: carob/include/TypeTag.hpp
diff -u carob/include/TypeTag.hpp:1.4 carob/include/TypeTag.hpp:1.5
--- carob/include/TypeTag.hpp:1.4       Wed Sep 21 12:08:15 2005
+++ carob/include/TypeTag.hpp   Fri Nov 25 16:04:47 2005
@@ -30,7 +30,7 @@
 // code "TypeTag.java" in order to be sure to stick to the java definitions.
 // For that, the java source should be re-formated to allow easy (perl?) 
 // parsing of the file
-#include "TypeTagConstants.hpp"
+#include "TypeConstants.hpp"
 
 using namespace std;
 
Index: carob/include/TypeTagConstants.hpp
diff -u carob/include/TypeTagConstants.hpp:1.3 
carob/include/TypeTagConstants.hpp:removed
--- carob/include/TypeTagConstants.hpp:1.3      Mon Oct 17 11:50:37 2005
+++ carob/include/TypeTagConstants.hpp  Fri Nov 25 16:04:47 2005
@@ -1,49 +0,0 @@
-/**
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: [EMAIL PROTECTED]
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s): 
- */
-
-#define TT_TYPE_ERROR         -1
-#define TT_STRING             0
-#define TT_BIGDECIMAL         1
-#define TT_BOOLEAN            2
-#define TT_INTEGER            3
-#define TT_LONG               4
-#define TT_FLOAT              5
-#define TT_DOUBLE             6
-#define TT_BYTE_ARRAY         7
-#define TT_SQL_DATE           8
-#define TT_SQL_TIME           9
-#define TT_SQL_TIMESTAMP      10
-#define TT_CLOB               11
-#define TT_BLOB               12
-#define TT_JAVA_SERIALIZABLE  13
-#define TT_RESULTSET          14
-#define TT_NULL_RESULTSET     15
-#define TT_FIELD              16
-#define TT_COL_TYPES          17
-#define TT_ROW                18
-#define TT_NOT_EXCEPTION      19
-#define TT_EXCEPTION          20
-#define TT_BACKEND_EXCEPTION  21
-#define TT_CORE_EXCEPTION     22
-#define TT_CONTROLLER_READY   23
-#define TT_UNDEFINED          24
-
-#define TT_NUMBER_OF_TYPES    26
Index: carob/src/Field.cpp
diff -u carob/src/Field.cpp:1.4 carob/src/Field.cpp:1.5
--- carob/src/Field.cpp:1.4     Wed Nov 23 17:30:45 2005
+++ carob/src/Field.cpp Fri Nov 25 16:04:47 2005
@@ -24,26 +24,26 @@
 Field::Field(const DriverSocket& sockPtr) throw (SocketIOException,
     UnexpectedException)
 {
-  sockPtr>>tableNameNotNull;
-  if (tableNameNotNull)
+  sockPtr>>table_name_not_null;
+  if (table_name_not_null)
   {
-    sockPtr>>tableName;
+    sockPtr>>table_name;
   }
-  sockPtr>>fieldName;
-  sockPtr>>fieldLabel;
-  sockPtr>>columnDisplaySize;
-  sockPtr>>sqlType;
-  sockPtr>>typeName;
-  sockPtr>>columnClassName;
-  sockPtr>>isAutoIncrement;
-  sockPtr>>isCaseSensitive;
-  sockPtr>>isCurrency;
-  sockPtr>>isNullable;
-  sockPtr>>isReadOnly;
-  sockPtr>>isWritable;
-  sockPtr>>isDefinitelyWritable;
-  sockPtr>>isSearchable;
-  sockPtr>>isSigned;
+  sockPtr>>field_name;
+  sockPtr>>field_label;
+  sockPtr>>column_display_size;
+  sockPtr>>sql_type;
+  sockPtr>>type_name;
+  sockPtr>>column_class_name;
+  sockPtr>>is_auto_increment;
+  sockPtr>>is_case_sensitive;
+  sockPtr>>is_currency;
+  sockPtr>>is_nullable;
+  sockPtr>>is_read_only;
+  sockPtr>>is_writable;
+  sockPtr>>is_definitely_writable;
+  sockPtr>>is_searchable;
+  sockPtr>>is_signed;
   sockPtr>>precision;
   sockPtr>>scale;
 }
Index: carob/src/ResultSetMetaData.cpp
diff -u /dev/null carob/src/ResultSetMetaData.cpp:1.1
--- /dev/null   Fri Nov 25 16:04:47 2005
+++ carob/src/ResultSetMetaData.cpp     Fri Nov 25 16:04:47 2005
@@ -0,0 +1,155 @@
+/**
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2005 Emic Networks
+ * Contact: [EMAIL PROTECTED]
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Initial developer(s): Gilles Rayrat
+ * Contributor(s): 
+ */
+#include "ResultSetMetaData.hpp"
+
+ResultSetMetaData::ResultSetMetaData(DriverResultSet* rs)
+    throw (DriverException, UnexpectedException)
+{
+  if (rs == NULL)
+    throw DriverException(L"Null resultSet, cannot get column count");
+  resultSetPtr = rs;
+}
+void ResultSetMetaData::checkColumnIndex(int column) throw (DriverException,
+    UnexpectedException)
+{
+  if ((column < 1) || (column > resultSetPtr->nbOfColumns))
+    throw DriverException(L"Invalid column index " + toWString(column));
+}
+bool ResultSetMetaData::isAutoIncrement(int column) throw (DriverException,
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->isAutoIncrement();
+}
+bool ResultSetMetaData::isCaseSensitive(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->isCaseSensitive();
+}
+bool ResultSetMetaData::isSearchable(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->isSearchable();
+}
+bool ResultSetMetaData::isCurrency(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->isCurrency();
+}
+int ResultSetMetaData::isNullable(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->isNullable();
+}
+bool ResultSetMetaData::isSigned(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->isSigned();
+}
+int ResultSetMetaData::getColumnDisplaySize(int column) throw 
(DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->getColumnDisplaySize();
+}
+wstring ResultSetMetaData::getColumnLabel(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->getFieldName();
+}
+wstring ResultSetMetaData::getColumnName(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->getFieldName();
+}
+wstring ResultSetMetaData::getSchemaName(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->getFullName();
+}
+int ResultSetMetaData::getPrecision(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->getPrecision();
+}
+int ResultSetMetaData::getScale(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->getScale();
+}
+wstring ResultSetMetaData::getTableName(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->getTableName();
+}
+wstring ResultSetMetaData::getCatalogName(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return (L"");
+}
+int ResultSetMetaData::getColumnType(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->getSqlType();
+}
+wstring ResultSetMetaData::getColumnTypeName(int column) throw 
(DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->getTypeName();
+}
+bool ResultSetMetaData::isReadOnly(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->isReadOnly();
+}
+bool ResultSetMetaData::isWritable(int column) throw (DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->isWritable();
+}
+bool ResultSetMetaData::isDefinitelyWritable(int column) throw 
(DriverException, 
+    UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->isDefinitelyWritable();
+}
+wstring ResultSetMetaData::getColumnClassName(int column)
+    throw (DriverException, UnexpectedException)
+{
+  checkColumnIndex(column);
+  return resultSetPtr->fields[column - 1]->getColumnClassName();
+}

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to