Commits

Anonymous committed e27efcc Merge

CWS-TOOLING: integrate CWS dba33f

Comments (0)

Files changed (398)

connectivity/inc/connectivity/PColumn.hxx

 #include <vos/ref.hxx>
 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
 #include <comphelper/proparrhlp.hxx>
 
 namespace connectivity
 		{
 			::rtl::OUString	m_aRealName;
 			::rtl::OUString m_aTableName;
+            ::rtl::OUString m_sLabel;
 			sal_Bool		m_bFunction;
 			sal_Bool		m_bDbasePrecisionChanged;
 			sal_Bool		m_bAggregateFunction;
 			OParseColumn(const ::rtl::OUString& _Name,
 					const ::rtl::OUString& _TypeName,
 					const ::rtl::OUString& _DefaultValue,
+                    const ::rtl::OUString& _Description,
 					sal_Int32		_IsNullable,
 					sal_Int32		_Precision,
 					sal_Int32		_Scale,
 			virtual void construct();
 
 			void setRealName(const ::rtl::OUString& _rName)  { m_aRealName  = _rName; }
+            void setLabel(const ::rtl::OUString& i_sLabel)   { m_sLabel  = i_sLabel; }
 			void setTableName(const ::rtl::OUString& _rName) { m_aTableName = _rName; }
 			void setFunction(sal_Bool _bFunction)			 { m_bFunction	= _bFunction; }
 			void setAggregateFunction(sal_Bool _bFunction)	 { m_bAggregateFunction	= _bFunction; }
             void setIsSearchable( sal_Bool _bIsSearchable )  { m_bIsSearchable = _bIsSearchable; }
 			void setDbasePrecisionChanged(sal_Bool _bDbasePrecisionChanged)	{ m_bDbasePrecisionChanged = _bDbasePrecisionChanged; }
 
-			::rtl::OUString getRealName() const { return  m_aRealName; }
-			::rtl::OUString getTableName() const { return  m_aTableName; }
-			sal_Bool		getFunction() const { return  m_bFunction; }
+			::rtl::OUString getRealName()   const { return  m_aRealName; }
+            ::rtl::OUString getLabel()      const { return  m_sLabel; }
+			::rtl::OUString getTableName()  const { return  m_aTableName; }
+			sal_Bool		getFunction()   const { return  m_bFunction; }
 			sal_Bool		getDbasePrecisionChanged()	const { return  m_bDbasePrecisionChanged; }
 
         public:
             static ::vos::ORef< OSQLColumns >
                 createColumnsForResultSet(
                     const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
-                    const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData
+                    const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
+                    const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns
                 );
 
-            /** creates a single OParseColumn, as described by a result set meta data instance
+            DECLARE_STL_USTRINGACCESS_MAP(int,StringMap);
+            /** creates a single OParseColumn, as described by a result set meta data instance.
+                The column names are unique.
             */
             static OParseColumn*
                 createColumnForResultSet(
                     const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
                     const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
-                    sal_Int32 _nColumnPos
+                    sal_Int32 _nColumnPos,
+                    StringMap& _rColumns
                 );
 
 		private:
 			virtual ~OOrderColumn();
 		public:
             OOrderColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,sal_Bool _bCase,sal_Bool _bAscending);
-			OOrderColumn(const ::rtl::OUString& _Name,
-					const ::rtl::OUString& _TypeName,
-					const ::rtl::OUString& _DefaultValue,
-					sal_Int32		_IsNullable,
-					sal_Int32		_Precision,
-					sal_Int32		_Scale,
-					sal_Int32		_Type,
-					sal_Bool		_IsAutoIncrement,
-					sal_Bool		_IsCurrency,
-					sal_Bool		_bCase
-					,sal_Bool _bAscending);
 
 			virtual void construct();
 

connectivity/inc/connectivity/SQLStatementHelper.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dbtools.hxx,v $
+ * $Revision: 1.37 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+#define _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+namespace rtl
+{
+    class OUStringBuffer;
+}
+//.........................................................................
+namespace dbtools
+{
+    class OOO_DLLPUBLIC_DBTOOLS ISQLStatementHelper
+    {
+    public:
+        virtual void addComment(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,::rtl::OUStringBuffer& _rOut) = 0;
+    };
+
+//.........................................................................
+}	// namespace dbtools
+//.........................................................................
+
+#endif // _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+

connectivity/inc/connectivity/TTableHelper.hxx

     {
         ::rtl::OUString sName;
         ::rtl::OUString aField6;
+        ::rtl::OUString sField12; // REMARKS
         ::rtl::OUString sField13;
         sal_Int32		nField5        
 		            ,   nField7
 			, sal_Int32		_nField7
 			, sal_Int32		_nField9
 			, sal_Int32		_nField11
+            , const ::rtl::OUString& _sField12
 			, const ::rtl::OUString& _sField13
             ,OrdinalPosition _nPosition )
             :sName( _rName )
             ,aField6(_aField6)
+            ,sField12(_sField12)
             ,sField13(_sField13)
             ,nField5(_nField5)            
             ,nField7(_nField7)

connectivity/inc/connectivity/dbtools.hxx

 //.........................................................................
 namespace dbtools
 {
+    class ISQLStatementHelper;
     typedef ::utl::SharedUNOComponent< ::com::sun::star::sdbc::XConnection > SharedConnection;
 
     enum EComposeRule
         const ::rtl::OUString& _rName
     );
 
+    /** returns the primary key columns of the table
+	*/
+	OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getPrimaryKeyColumns_throw(
+        const ::com::sun::star::uno::Any& i_aTable
+    );
+    OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getPrimaryKeyColumns_throw(
+        const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_xTable
+    );
+
 	/** get fields for a result set given by a "command descriptor"
 
 		<p>A command descriptor here means:
     OOO_DLLPUBLIC_DBTOOLS
 	::rtl::OUString createStandardCreateStatement(	const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,
 													const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+                                                    ISQLStatementHelper* _pHelper,
                                                     const ::rtl::OUString& _sCreatePattern = ::rtl::OUString());
 
 	/** creates the standard sql statement for the key part of a create table statement.
 												const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection);
 
 	/** creates the standard sql statement for the column part of a create table statement.
+        @param  _pHelper
+            Allow to add special SQL constructs.
 		@param	descriptor
 			The descriptor of the column.
 		@param	_xConnection
 			The connection.
-        @param  _bAddScale
-            The scale will also be added when the value is 0.
+        @param  _pHelper
+            Allow to add special SQL constructs.
 	*/
     OOO_DLLPUBLIC_DBTOOLS
-	::rtl::OUString createStandardColumnPart(	const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,
-												const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
-                                                const ::rtl::OUString& _sCreatePattern = ::rtl::OUString());
+	::rtl::OUString createStandardColumnPart(	const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor
+												,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection
+                                                ,ISQLStatementHelper* _pHelper = NULL
+                                                ,const ::rtl::OUString& _sCreatePattern = ::rtl::OUString());
 
 	/** creates a SQL CREATE TABLE statement
+        
 		@param	descriptor
 			The descriptor of the new table.
 		@param	_xConnection
 			The connection.
-        @param  _bAddScale
-            The scale will also be added when the value is 0.
+        @param  _pHelper
+            Allow to add special SQL constructs.
+        @param  _sCreatePattern
+            
 		@return
 			The CREATE TABLE statement.
 	*/
     OOO_DLLPUBLIC_DBTOOLS
-	::rtl::OUString createSqlCreateTableStatement(	const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,
-													const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
-                                                    const ::rtl::OUString& _sCreatePattern = ::rtl::OUString());
+	::rtl::OUString createSqlCreateTableStatement(	const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor
+													,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection
+                                                    ,ISQLStatementHelper* _pHelper = NULL
+                                                    ,const ::rtl::OUString& _sCreatePattern = ::rtl::OUString());
 
 	/** creates a SDBC column with the help of getColumns.
 		@param	_xTable

connectivity/inc/connectivity/sdbcx/VColumn.hxx

 			OColumn(	const ::rtl::OUString& _Name,
 								const ::rtl::OUString& _TypeName,
 								const ::rtl::OUString& _DefaultValue,
+                                const ::rtl::OUString& _Description,
 								sal_Int32		_IsNullable,
 								sal_Int32		_Precision,
 								sal_Int32		_Scale,

connectivity/inc/connectivity/sqliterator.hxx

 
 #include <map>
 #include <memory>
+#include <vector>
 
 namespace connectivity
 {
 	class OSQLParseNode;
 	class OSQLParser;
 
+    typedef ::std::pair<const OSQLParseNode*,const OSQLParseNode* > TNodePair;
+
 	enum OSQLStatementType {
 		SQL_STATEMENT_UNKNOWN,
 		SQL_STATEMENT_SELECT,
 
         // tries to find the correct type of the function
         sal_Int32 getFunctionReturnType(const OSQLParseNode* _pNode );
+
+        // returns a lis of all joined columns
+        ::std::vector< TNodePair >& getJoinConditions() const;
+
     private:
         /** traverses the list of table names, and filles _rTables
         */
         {
             m_aErrors = ::com::sun::star::sdbc::SQLException();
         }
+        void impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition);
 	};
 }
 

connectivity/inc/connectivity/sqlnode.hxx

             concatenation,
             char_factor,
             bit_value_fct,
+            comparison_predicate_part_2,
+            parenthesized_boolean_value_expression,
+            character_string_type,
+            other_like_predicate_part_2,
+            between_predicate_part_2,
             rule_count,             // letzter_wert
             UNKNOWN_RULE            // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID)
 		};

connectivity/qa/connectivity/tools/CRMDatabase.java

         m_database.getDataSource().createQuery( "parseable", "SELECT * FROM \"customers\"" );
         m_database.getDataSource().createQuery( "parseable native", "SELECT * FROM INFORMATION_SCHEMA.SYSTEM_VIEWS", false );
         m_database.getDataSource().createQuery( "unparseable",
-            "SELECT CAST( \"ID\" AS VARCHAR(3) ) AS \"ID_VARCHAR\" FROM \"products\"", false );
+            "SELECT {fn DAYOFMONTH ('2001-01-01')} AS \"ID_VARCHAR\" FROM \"products\"", false );
 
         validateUnparseable();
     }

connectivity/source/commontools/DateConversion.cxx

 				case DataType::TIMESTAMP:
 				{
 					DateTime aDateTime;
+                    bool bOk = false;
+                    if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE)
+                    {
+                        double nValue = 0.0;
+                       _rVal >>= nValue;
+                       aDateTime = DBTypeConversion::toDateTime(nValue);
+                       bOk = true;
+                    }
+                    else if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING)
+                    {
+                        ::rtl::OUString sValue;
+                       _rVal >>= sValue;
+                       aDateTime = DBTypeConversion::toDateTime(sValue);
+                       bOk = true;
+                    }
+                    else
+                        bOk = _rVal >>= aDateTime;
 
+                    OSL_VERIFY_RES( bOk, "DBTypeConversion::toSQLString: _rVal is not datetime!");
 					// check if this is really a timestamp or only a date
-					if ( _rVal >>= aDateTime )
+					if ( bOk )
 					{
 						if (bQuote) 
                             aRet.appendAscii("{TS '");
 				case DataType::DATE:
 				{
 					Date aDate;
-                    OSL_VERIFY_RES( _rVal >>= aDate, "DBTypeConversion::toSQLString: _rVal is not date!");
+                    bool bOk = false;
+                    if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE)
+                    {
+                        double nValue = 0.0;
+                       _rVal >>= nValue;
+                       aDate = DBTypeConversion::toDate(nValue);
+                       bOk = true;
+                    }
+                    else if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING)
+                    {
+                        ::rtl::OUString sValue;
+                       _rVal >>= sValue;
+                       aDate = DBTypeConversion::toDate(sValue);
+                       bOk = true;
+                    }
+                    else
+                        bOk = _rVal >>= aDate;
+                    OSL_VERIFY_RES( bOk, "DBTypeConversion::toSQLString: _rVal is not date!");
 					if (bQuote) 
                         aRet.appendAscii("{D '");
 					aRet.append(DBTypeConversion::toDateString(aDate));
 				case DataType::TIME:
 				{
 					Time aTime;
-                    OSL_VERIFY_RES( _rVal >>= aTime,"DBTypeConversion::toSQLString: _rVal is not time!");
+                    bool bOk = false;
+                    if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE)
+                    {
+                        double nValue = 0.0;
+                       _rVal >>= nValue;
+                       aTime = DBTypeConversion::toTime(nValue);
+                       bOk = true;
+                    }
+                    else if (_rVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING)
+                    {
+                        ::rtl::OUString sValue;
+                       _rVal >>= sValue;
+                       aTime = DBTypeConversion::toTime(sValue);
+                       bOk = true;
+                    }
+                    else
+                        bOk = _rVal >>= aTime;
+                    OSL_VERIFY_RES( bOk,"DBTypeConversion::toSQLString: _rVal is not time!");
 					if (bQuote) 
                         aRet.appendAscii("{T '");
 					aRet.append(DBTypeConversion::toTimeString(aTime));

connectivity/source/commontools/DriversConfig.cxx

 }
 
 // -----------------------------------------------------------------------------
-DriversConfig::~DriversConfig()
-{
-}
-
+DriversConfig::~DriversConfig()
+{
+}
+
 // -----------------------------------------------------------------------------
-DriversConfig::DriversConfig( const DriversConfig& _rhs )
-{
-    *this = _rhs;
-}
-
+DriversConfig::DriversConfig( const DriversConfig& _rhs )
+{
+    *this = _rhs;
+}
+
 // -----------------------------------------------------------------------------
-DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs )
-{
-    if ( this != &_rhs )
-    {
-        m_aNode = _rhs.m_aNode;
-    }
-    return *this;
-}
-
+DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs )
+{
+    if ( this != &_rhs )
+    {
+        m_aNode = _rhs.m_aNode;
+    }
+    return *this;
+}
+
 // -----------------------------------------------------------------------------
 ::rtl::OUString DriversConfig::getDriverFactoryName(const ::rtl::OUString& _sURL) const
 {

connectivity/source/commontools/TColumnsHelper.cxx

     if ( pColDesc )
     {
         Reference<XPropertySet> xPr = m_pTable;
-        Reference<XKeysSupplier> xKeysSup(xPr,UNO_QUERY);
-        Reference<XNameAccess> xPrimaryKeyColumns;
-        if ( xKeysSup.is() )
-        {
-            const Reference<XIndexAccess> xKeys = xKeysSup->getKeys();
-            if ( xKeys.is() )
-            {
-                ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
-                const sal_Int32 nKeyCount = xKeys->getCount();
-                for(sal_Int32 nKeyIter = 0; nKeyIter < nKeyCount;++nKeyIter)
-                {
-                    const Reference<XPropertySet> xKey(xKeys->getByIndex(nKeyIter),UNO_QUERY_THROW);
-                    sal_Int32 nType = 0;
-                    xKey->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE))	>>= nType;
-                    if ( nType == KeyType::PRIMARY )
-                    {
-                        const Reference<XColumnsSupplier> xColS(xKey,UNO_QUERY_THROW);
-                        xPrimaryKeyColumns = xColS->getColumns();
-                        break;
-                    }
-                } // for(sal_Int32 nKeyIter = 0; nKeyIter < nKeyCount;++)
-            }
-        }
+        const Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(xPr);
         sal_Int32 nField11 = pColDesc->nField11;
         if ( nField11 != ColumnValue::NO_NULLS && xPrimaryKeyColumns.is() && xPrimaryKeyColumns->hasByName(_rName) )
         {
         connectivity::sdbcx::OColumn* pRet = new connectivity::sdbcx::OColumn(_rName,
 												pColDesc->aField6,
 												pColDesc->sField13,
+                                                pColDesc->sField12,
 												nField11,
 												pColDesc->nField7,
 												pColDesc->nField9,
 
 	aSql += ::dbtools::composeTableName( xMetaData, m_pTable, ::dbtools::eInTableDefinitions, false, false, true );
 	aSql += ::rtl::OUString::createFromAscii(" ADD ");
-	aSql += ::dbtools::createStandardColumnPart(descriptor,m_pTable->getConnection(),m_pTable->getTypeCreatePattern());
+	aSql += ::dbtools::createStandardColumnPart(descriptor,m_pTable->getConnection(),NULL,m_pTable->getTypeCreatePattern());
 	
 	Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement(  );
 	if ( xStmt.is() )

connectivity/source/commontools/TTableHelper.cxx

 			sal_Int32		nField7 = xRow->getInt(7)
 						,	nField9 = xRow->getInt(9)
 						,	nField11= xRow->getInt(11);
-			::rtl::OUString sField13 = xRow->getString(13);
+			::rtl::OUString  sField12 = xRow->getString(12)
+                            ,sField13 = xRow->getString(13);
             nOrdinalPosition = xRow->getInt( 17 );  // ORDINAL_POSITION
-            _out_rColumns.push_back( ColumnDesc( sName,nField5,aField6,nField7,nField9,nField11,sField13, nOrdinalPosition ) );
+            _out_rColumns.push_back( ColumnDesc( sName,nField5,aField6,nField7,nField9,nField11,sField12,sField13, nOrdinalPosition ) );
         }
     }
 

connectivity/source/commontools/dbtools.cxx

 #include <com/sun/star/sdbc/XRow.hpp>
 #include <com/sun/star/sdbc/XRowSet.hpp>
 #include <com/sun/star/sdbc/XRowUpdate.hpp>
+#include <com/sun/star/sdbcx/KeyType.hpp>
 #include <com/sun/star/sdbcx/Privilege.hpp>
 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
 #include <com/sun/star/task/XInteractionHandler.hpp>
 #include <com/sun/star/task/XInteractionRequest.hpp>
 	Reference< XComponent > xDummy;
 	return getFieldsByCommandDescriptor( _rxConn, CommandType::TABLE, _rName, xDummy );
 }
+//------------------------------------------------------------------------------
+Reference< XNameAccess> getPrimaryKeyColumns_throw(const Any& i_aTable)
+{
+    const Reference< XPropertySet > xTable(i_aTable,UNO_QUERY_THROW);
+    return getPrimaryKeyColumns_throw(xTable);
+}
+//------------------------------------------------------------------------------
+Reference< XNameAccess> getPrimaryKeyColumns_throw(const Reference< XPropertySet >& i_xTable)
+{
+	Reference<XNameAccess> xKeyColumns;
+    const Reference<XKeysSupplier> xKeySup(i_xTable,UNO_QUERY);
+    if ( xKeySup.is() )
+    {
+	    const Reference<XIndexAccess> xKeys = xKeySup->getKeys();
+	    if ( xKeys.is() )
+	    {
+            ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
+            const ::rtl::OUString sPropName = rPropMap.getNameByIndex(PROPERTY_ID_TYPE);
+		    Reference<XPropertySet> xProp;
+		    const sal_Int32 nCount = xKeys->getCount();
+		    for(sal_Int32 i = 0;i< nCount;++i)
+		    {
+			    xProp.set(xKeys->getByIndex(i),UNO_QUERY_THROW);
+			    if ( xProp.is() )
+			    {
+				    sal_Int32 nKeyType = 0;
+				    xProp->getPropertyValue(sPropName) >>= nKeyType;
+				    if(KeyType::PRIMARY == nKeyType)
+				    {
+					    const Reference<XColumnsSupplier> xKeyColsSup(xProp,UNO_QUERY_THROW);
+					    xKeyColumns = xKeyColsSup->getColumns();
+					    break;
+				    }
+			    }
+		    }
+	    }
+    }
+
+	return xKeyColumns;
+}
 
 //------------------------------------------------------------------------------
 namespace
 
 void release(oslInterlockedCount& _refCount,
 			 ::cppu::OBroadcastHelper& rBHelper,
-			 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+			 Reference< XInterface >& _xInterface,
 			 ::com::sun::star::lang::XComponent* _pObject)
 {
 	if (osl_decrementInterlockedCount( &_refCount ) == 0)
 		if (!rBHelper.bDisposed && !rBHelper.bInDispose)
 		{
 			// remember the parent
-			::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xParent;
+			Reference< XInterface > xParent;
 			{
 				::osl::MutexGuard aGuard( rBHelper.rMutex );
 				xParent = _xInterface;

connectivity/source/commontools/dbtools2.cxx

 #include "connectivity/dbtools.hxx"
 #include "connectivity/dbconversion.hxx"
 #include "connectivity/dbcharset.hxx"
+#include "connectivity/SQLStatementHelper.hxx"
 #include <unotools/confignode.hxx>
 #include "resource/sharedresources.hxx"
-#ifndef CONNECTIVITY_RESOURCE_COMMON_HRC
 #include "resource/common_res.hrc"
-#endif
 #include <com/sun/star/sdbc/XConnection.hpp>
 #include <com/sun/star/sdbc/ColumnValue.hpp>
 #include <com/sun/star/sdbc/DataType.hpp>
 	using namespace connectivity;
 	using namespace comphelper;
 
-::rtl::OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,const Reference< XConnection>& _xConnection,const ::rtl::OUString& _sCreatePattern)
+::rtl::OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,const Reference< XConnection>& _xConnection,ISQLStatementHelper* _pHelper,const ::rtl::OUString& _sCreatePattern)
 {
 
 	Reference<XDatabaseMetaData> xMetaData = _xConnection->getMetaData();
 		aSql.append(sAutoIncrementValue);
 	}
 
+    if ( _pHelper )
+        _pHelper->addComment(xColProp,aSql);
+
 	return aSql.makeStringAndClear();
 }
 // -----------------------------------------------------------------------------
 
-::rtl::OUString createStandardCreateStatement(const Reference< XPropertySet >& descriptor,const Reference< XConnection>& _xConnection,const ::rtl::OUString& _sCreatePattern)
+::rtl::OUString createStandardCreateStatement(const Reference< XPropertySet >& descriptor,const Reference< XConnection>& _xConnection,ISQLStatementHelper* _pHelper,const ::rtl::OUString& _sCreatePattern)
 {
 	::rtl::OUStringBuffer aSql	= ::rtl::OUString::createFromAscii("CREATE TABLE ");
 	::rtl::OUString sCatalog,sSchema,sTable,sComposedName;
 	{
 		if ( (xColumns->getByIndex(i) >>= xColProp) && xColProp.is() )
 		{
-			aSql.append(createStandardColumnPart(xColProp,_xConnection,_sCreatePattern));
+			aSql.append(createStandardColumnPart(xColProp,_xConnection,_pHelper,_sCreatePattern));
 			aSql.appendAscii(",");
 		}
 	}
 // -----------------------------------------------------------------------------
 ::rtl::OUString createSqlCreateTableStatement(	const Reference< XPropertySet >& descriptor,
 												const Reference< XConnection>& _xConnection,
+                                                ISQLStatementHelper* _pHelper,
                                                 const ::rtl::OUString& _sCreatePattern)
 {
-	::rtl::OUString aSql = ::dbtools::createStandardCreateStatement(descriptor,_xConnection,_sCreatePattern);
+	::rtl::OUString aSql = ::dbtools::createStandardCreateStatement(descriptor,_xConnection,_pHelper,_sCreatePattern);
 	const ::rtl::OUString sKeyStmt = ::dbtools::createStandardKeyStatement(descriptor,_xConnection);
 	if ( sKeyStmt.getLength() )
 		aSql += sKeyStmt;
 					sal_Int32		nField7 = xRow->getInt(7)
 								,	nField9 = xRow->getInt(9)
 								,	nField11= xRow->getInt(11);
-					::rtl::OUString sField13 = xRow->getString(13);
+					::rtl::OUString sField12 = xRow->getString(12),
+                                    sField13 = xRow->getString(13);
 					::comphelper::disposeComponent(xRow);
 
 					sal_Bool bAutoIncrement = _bIsAutoIncrement
 					connectivity::sdbcx::OColumn* pRet = new connectivity::sdbcx::OColumn(_rName,
 												aField6,
 												sField13,
+                                                sField12,
 												nField11,
 												nField7,
 												nField9,
 	::rtl::OUString aSchema, aTable;
 	_xTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME))	>>= aSchema;
 	_xTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))		>>= aTable;
-
-    Reference<XKeysSupplier> xKeysSup(_xTable,UNO_QUERY);
-    Reference<XNameAccess> xPrimaryKeyColumns;
-    if ( xKeysSup.is() )
-    {
-        const Reference<XIndexAccess> xKeys = xKeysSup->getKeys();
-        if ( xKeys.is() )
-        {
-            const sal_Int32 nKeyCount = xKeys->getCount();
-            for(sal_Int32 nKeyIter = 0; nKeyIter < nKeyCount;++nKeyIter)
-            {
-                const Reference<XPropertySet> xKey(xKeys->getByIndex(nKeyIter),UNO_QUERY_THROW);
-                sal_Int32 nType = 0;
-                xKey->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE))	>>= nType;
-                if ( nType == KeyType::PRIMARY )
-                {
-                    const Reference<XColumnsSupplier> xColS(xKey,UNO_QUERY_THROW);
-                    xPrimaryKeyColumns = xColS->getColumns();
-                    break;
-                }
-            } // for(sal_Int32 nKeyIter = 0; nKeyIter < nKeyCount;++)
-        }
-    }
+  
+    Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(_xTable);
 
 	xProp = lcl_createSDBCXColumn(xPrimaryKeyColumns,_xConnection,aCatalog, aSchema, aTable, _rName,_rName,_bCase,_bQueryForInfo,_bIsAutoIncrement,_bIsCurrency,_nDataType);
 	if ( !xProp.is() )
 		xProp = lcl_createSDBCXColumn(xPrimaryKeyColumns,_xConnection,aCatalog, aSchema, aTable, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),_rName,_bCase,_bQueryForInfo,_bIsAutoIncrement,_bIsCurrency,_nDataType);
 		if ( !xProp.is() )
 			xProp = new connectivity::sdbcx::OColumn(_rName,
-												::rtl::OUString(),::rtl::OUString(),
+												::rtl::OUString(),::rtl::OUString(),::rtl::OUString(),
 												ColumnValue::NULLABLE_UNKNOWN,
 												0,
 												0,
 	    Reference< XDataDefinitionSupplier > xSupp( xManager->getDriverByURL( _rsUrl ), UNO_QUERY );
     	
 	    if ( xSupp.is() )
+        {
 		    xTablesSup = xSupp->getDataDefinitionByConnection( _xConnection );
-
-        // if we don't get the catalog from the original driver we have to try them all.
-	    if ( !xTablesSup.is() )
-	    { // !TODO: Why?
-		    Reference< XEnumerationAccess> xEnumAccess( xManager, UNO_QUERY_THROW );
-		    Reference< XEnumeration > xEnum( xEnumAccess->createEnumeration(), UNO_QUERY_THROW );
-		    while ( xEnum.is() && xEnum->hasMoreElements() && !xTablesSup.is() )
-		    {
-			    xEnum->nextElement() >>= xSupp;
-			    if ( xSupp.is() )
-				    xTablesSup = xSupp->getDataDefinitionByConnection( _xConnection );
-		    }
-	    }
+            OSL_ENSURE(xTablesSup.is(),"No table supplier!");
+        }
     }
     catch( const Exception& )
     {

connectivity/source/commontools/propertyids.cxx

         const sal_Char* getPROPERTY_ID_FIELDTYPE()			{ return 	"FieldType"; }
         const sal_Char* getPROPERTY_ID_VALUE()			   	{ return 	"Value"; }
         const sal_Char* getPROPERTY_ID_ACTIVE_CONNECTION()	{ return 	"ActiveConnection"; }
+        const sal_Char* getPROPERTY_ID_LABEL()		        { return 	"Label"; }
 
 	//============================================================
 	//= error messages
 				case PROPERTY_ID_HAVINGCLAUSE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_HAVINGCLAUSE()		); break; }
 				case PROPERTY_ID_ISSIGNED:					{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_ISSIGNED()			); break; }
                 case PROPERTY_ID_ISSEARCHABLE:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_ISSEARCHABLE()		); break; }
+                case PROPERTY_ID_LABEL:				        { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_LABEL()		        ); break; }
                 case PROPERTY_ID_APPLYFILTER:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_APPLYFILTER()		); break; }
                 case PROPERTY_ID_FILTER:				    { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_FILTER()			); break; }
                 case PROPERTY_ID_MASTERFIELDS:				{ rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_MASTERFIELDS()		); break; }

connectivity/source/drivers/adabas/BColumns.cxx

 				xRet = new OColumn(_rName,
 											sTypeName,
 											xRow->getString(13),
+                                            xRow->getString(12),
 											xRow->getInt(11),
 											nPrec,
 											xRow->getInt(9),

connectivity/source/drivers/adabas/adabas.xcu

             <value></value>
           </prop>
         </node>
+        <node oor:name="AddIndexAppendix" oor:op="replace">
+          <prop oor:name="Value" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
+        </node>
       </node>
       <node oor:name="Features">
         <node oor:name="UseSQL92NamingConstraints" oor:op="replace">

connectivity/source/drivers/ado/AColumn.cxx

 }
 // -------------------------------------------------------------------------
 OAdoColumn::OAdoColumn(sal_Bool _bCase,OConnection* _pConnection,_ADOColumn* _pColumn)
-	: connectivity::sdbcx::OColumn(::rtl::OUString(),::rtl::OUString(),::rtl::OUString(),0,0,0,0,sal_False,sal_False,sal_False,_bCase)
+	: connectivity::sdbcx::OColumn(::rtl::OUString(),::rtl::OUString(),::rtl::OUString(),::rtl::OUString(),0,0,0,0,sal_False,sal_False,sal_False,_bCase)
 	,m_pConnection(_pConnection)
 {
 	construct();
 				OTools::putValue( m_aColumn.get_Properties(), ::rtl::OUString::createFromAscii( "Autoincrement" ), getBOOL( rValue ) );
 				break;
 
+            case PROPERTY_ID_IM001:
 			case PROPERTY_ID_DESCRIPTION:
-				pAdoPropertyName = "Default";
+                pAdoPropertyName = "Description";
 				break;
 
 			case PROPERTY_ID_DEFAULTVALUE:
-				pAdoPropertyName = "Description";
+				pAdoPropertyName = "Default";
 				break;
 		}
 

connectivity/source/drivers/ado/ado.xcu

             <value>UserPassword</value>
           </prop>
         </node>
+        <node oor:name="SupportsColumnDescription" oor:op="replace">
+          <prop oor:name="Value" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
+        </node>
       </node>
     </node>
     <node oor:name="sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*" oor:op="replace">
             <value>mdb</value>
           </prop>
         </node>
+        <node oor:name="SupportsColumnDescription" oor:op="replace">
+          <prop oor:name="Value" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
+        </node>
       </node>
     </node>
     <node oor:name="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=*" oor:op="replace">

connectivity/source/drivers/calc/CTable.cxx

 			aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
 		}
 
-		sdbcx::OColumn* pColumn = new sdbcx::OColumn( aAlias, aTypeName, ::rtl::OUString(),
+		sdbcx::OColumn* pColumn = new sdbcx::OColumn( aAlias, aTypeName, ::rtl::OUString(),::rtl::OUString(),
 												ColumnValue::NULLABLE, nPrecision, nDecimals,
 												eType, sal_False, sal_False, bCurrency,
 												bStoresMixedCaseQuotedIdentifiers);

connectivity/source/drivers/dbase/DTable.cxx

 		Reference< XPropertySet> xCol = new sdbcx::OColumn(aColumnName,
 													aTypeName,
 													::rtl::OUString(),
+                                                    ::rtl::OUString(),
 													ColumnValue::NULLABLE,
 													nPrecision,
 													aDBFColumn.db_dez,

connectivity/source/drivers/dbase/dbase.xcu

             <value>false</value>
           </prop>
         </node>
+        <node oor:name="AddIndexAppendix" oor:op="replace">
+          <prop oor:name="Value" oor:type="xs:boolean">
+            <value>false</value>
+          </prop>
+        </node>
       </node>
       <node oor:name="Features">
         <node oor:name="UseSQL92NamingConstraints" oor:op="replace">

connectivity/source/drivers/evoab2/NColumns.cxx

 						_rName,
 						xRow->getString(6),
 						xRow->getString(13),
+                        xRow->getString(12),
 						xRow->getInt(11),
 						xRow->getInt(7),
 						xRow->getInt(9),

connectivity/source/drivers/evoab2/NStatement.cxx

 	// SQL like
 	else if( SQL_ISRULE( parseTree, like_predicate ) )
     {
-        ENSURE_OR_THROW( parseTree->count() >= 4, "unexpected like_predicate structure" );
+        ENSURE_OR_THROW( parseTree->count() == 2, "unexpected like_predicate structure" );
+        const OSQLParseNode* pPart2 = parseTree->getChild(1);
 
         if( ! SQL_ISRULE( parseTree->getChild( 0 ), column_ref) )
             m_pConnection->throwGenericSQLException(STR_QUERY_INVALID_LIKE_COLUMN,*this);
 
         ::rtl::OUString aColumnName( impl_getColumnRefColumnName_throw( *parseTree->getChild( 0 ) ) );
 
-        OSQLParseNode *pAtom      = parseTree->getChild( parseTree->count() - 2 );     // Match String
-		bool bNotLike             = parseTree->count() == 5;
+        OSQLParseNode *pAtom      = pPart2->getChild( pPart2->count() - 2 );     // Match String
+		bool bNotLike             = pPart2->getChild(0)->isToken();
 
         if( !( pAtom->getNodeType() == SQL_NODE_STRING ||
 			   pAtom->getNodeType() == SQL_NODE_NAME ||

connectivity/source/drivers/file/FColumns.cxx

 				sdbcx::OColumn* pRet = new sdbcx::OColumn(_rName,
 											xRow->getString(6),
 											xRow->getString(13),
+                                            xRow->getString(12),
 											xRow->getInt(11),
 											xRow->getInt(7),
 											xRow->getInt(9),

connectivity/source/drivers/file/FPreparedStatement.cxx

 	Reference<XPropertySet> xParaColumn = new connectivity::parse::OParseColumn(sParameterName
 													,::rtl::OUString()
 													,::rtl::OUString()
+                                                    ,::rtl::OUString()
 													,nNullable
 													,nPrecision
 													,nScale

connectivity/source/drivers/file/fcomp.cxx

 //------------------------------------------------------------------
 OOperand* OPredicateCompiler::execute_LIKE(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
 {
-	DBG_ASSERT(pPredicateNode->count() >= 4,"OFILECursor: Fehler im Parse Tree");
+	DBG_ASSERT(pPredicateNode->count() == 2,"OFILECursor: Fehler im Parse Tree");
+    const OSQLParseNode* pPart2 = pPredicateNode->getChild(1);
 
-	sal_Int32 ePredicateType;	
 	sal_Unicode cEscape = L'\0';
-	if (pPredicateNode->count() == 5)
-		ePredicateType = SQLFilterOperator::NOT_LIKE;
-	else
-		ePredicateType = SQLFilterOperator::LIKE;
+    const bool bNotLike = pPart2->getChild(0)->isToken();
 
-	OSQLParseNode* pAtom		= pPredicateNode->getChild(pPredicateNode->count()-2);
-	OSQLParseNode* pOptEscape	= pPredicateNode->getChild(pPredicateNode->count()-1);
+	OSQLParseNode* pAtom		= pPart2->getChild(pPart2->count()-2);
+	OSQLParseNode* pOptEscape	= pPart2->getChild(pPart2->count()-1);
 
 	if (!(pAtom->getNodeType() == SQL_NODE_STRING || SQL_ISRULE(pAtom,parameter)))
 	{
 	execute(pPredicateNode->getChild(0));
 	execute(pAtom);
 
-	OBoolOperator* pOperator = (ePredicateType == SQLFilterOperator::LIKE)
-													? new OOp_LIKE(cEscape)
-													: new OOp_NOTLIKE(cEscape);
+	OBoolOperator* pOperator = bNotLike
+									? new OOp_NOTLIKE(cEscape)
+									: new OOp_LIKE(cEscape);
 	m_aCodeList.push_back(pOperator);
 
 	return NULL;
 //------------------------------------------------------------------
 OOperand* OPredicateCompiler::execute_BETWEEN(OSQLParseNode* pPredicateNode) throw(SQLException, RuntimeException)
 {
-	DBG_ASSERT(pPredicateNode->count() == 6,"OFILECursor: Fehler im Parse Tree");
+	DBG_ASSERT(pPredicateNode->count() == 2,"OFILECursor: Fehler im Parse Tree");
 
 	OSQLParseNode* pColumn = pPredicateNode->getChild(0);
-	OSQLParseNode* p1stValue = pPredicateNode->getChild(3);
-	OSQLParseNode* p2ndtValue = pPredicateNode->getChild(5);
+    const OSQLParseNode* pPart2 = pPredicateNode->getChild(1);
+	OSQLParseNode* p1stValue = pPart2->getChild(2);
+	OSQLParseNode* p2ndtValue = pPart2->getChild(4);
 
 	if (
 			!(p1stValue->getNodeType() == SQL_NODE_STRING || SQL_ISRULE(p1stValue,parameter))
         m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_BETWEEN,NULL);
 	}
 
-	sal_Bool bNot = SQL_ISTOKEN(pPredicateNode->getChild(1),NOT);
+	sal_Bool bNot = SQL_ISTOKEN(pPart2->getChild(0),NOT);
 
 	OOperand* pColumnOp = execute(pColumn);
 	OOperand* pOb1 = execute(p1stValue);
 //------------------------------------------------------------------
 OOperand* OPredicateCompiler::execute_ISNULL(OSQLParseNode* pPredicateNode)	throw(SQLException, RuntimeException)
 {
-	DBG_ASSERT(pPredicateNode->count() >= 3,"OFILECursor: Fehler im Parse Tree");
-	DBG_ASSERT(SQL_ISTOKEN(pPredicateNode->getChild(1),IS),"OFILECursor: Fehler im Parse Tree");
+	DBG_ASSERT(pPredicateNode->count() == 2,"OFILECursor: Fehler im Parse Tree");
+    const OSQLParseNode* pPart2 = pPredicateNode->getChild(1);
+	DBG_ASSERT(SQL_ISTOKEN(pPart2->getChild(0),IS),"OFILECursor: Fehler im Parse Tree");
 
 	sal_Int32 ePredicateType;
-	if (SQL_ISTOKEN(pPredicateNode->getChild(2),NOT))
+	if (SQL_ISTOKEN(pPart2->getChild(1),NOT))
 		ePredicateType = SQLFilterOperator::NOT_SQLNULL;
 	else
 		ePredicateType = SQLFilterOperator::SQLNULL;
 	switch ( nTokenId )
 	{
 		case SQL_TOKEN_CHAR_LENGTH:
-		case SQL_TOKEN_CHARACTER_LENGTH:
 		case SQL_TOKEN_LENGTH:
 		case SQL_TOKEN_OCTET_LENGTH:
 		case SQL_TOKEN_ASCII:
 			switch( nTokenId )
 			{
 				case SQL_TOKEN_CHAR_LENGTH:
-				case SQL_TOKEN_CHARACTER_LENGTH:
 				case SQL_TOKEN_LENGTH:
 				case SQL_TOKEN_OCTET_LENGTH:
 					pOperator = new OOp_CharLength();

connectivity/source/drivers/flat/ETable.cxx

 			aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
 		}
 
-		sdbcx::OColumn* pColumn = new sdbcx::OColumn(aAlias,aTypeName,::rtl::OUString(),
+		sdbcx::OColumn* pColumn = new sdbcx::OColumn(aAlias,aTypeName,::rtl::OUString(),::rtl::OUString(),
 												ColumnValue::NULLABLE,
 												nPrecision,
 												nScale,

connectivity/source/drivers/hsqldb/hsqldb.xcu

             <value>true</value>
           </prop>
         </node>
+        <node oor:name="AddIndexAppendix" oor:op="replace">
+          <prop oor:name="Value" oor:type="xs:boolean">
+            <value>false</value>
+          </prop>
+        </node>
       </node>
       <node oor:name="MetaData">
         <node oor:name="SupportsTableCreation" oor:op="replace">

connectivity/source/drivers/jdbc/jdbc.xcu

             <value>oracle.jdbc.driver.OracleDriver</value>
           </prop>
         </node>
+        <node oor:name="AddIndexAppendix" oor:op="replace">
+          <prop oor:name="Value" oor:type="xs:boolean">
+            <value>false</value>
+          </prop>
+        </node>
       </node>
       <node oor:name="Features">
         <node oor:name="IgnoreCurrency" oor:op="replace">

connectivity/source/drivers/kab/KColumns.cxx

 						_rName,
 						xRow->getString(6),
 						xRow->getString(13),
+                        xRow->getString(12),
 						xRow->getInt(11),
 						xRow->getInt(7),
 						xRow->getInt(9),

connectivity/source/drivers/kab/KStatement.cxx

 			}
 		}
 	}
-	else if (pParseNode->count() == 4)
+	else if (SQL_ISRULE(pParseNode, test_for_null) || SQL_ISRULE(pParseNode, like_predicate))
 	{
-		const OSQLParseNode *pLeft = pParseNode->getChild(0),
-		                    *pMiddleLeft = pParseNode->getChild(1),
-		                    *pMiddleRight = pParseNode->getChild(2),
-		                    *pRight = pParseNode->getChild(3);
+        const OSQLParseNode *pLeft = pParseNode->getChild(0);
+        const OSQLParseNode* pPart2 = pParseNode->getChild(1);		
+        const OSQLParseNode *pMiddleLeft = pPart2->getChild(0),
+	                        *pMiddleRight = pPart2->getChild(1),
+	                        *pRight = pPart2->getChild(2);		                    
 
 		if (SQL_ISRULE(pParseNode, test_for_null))
 		{

connectivity/source/drivers/macab/MacabColumns.cxx

 						_rName,
 						xRow->getString(6),
 						xRow->getString(13),
+                        xRow->getString(12),
 						xRow->getInt(11),
 						xRow->getInt(7),
 						xRow->getInt(9),

connectivity/source/drivers/macab/MacabStatement.cxx

 			}
 		}
 	}
-	else if (pParseNode->count() == 4)
+	else if (SQL_ISRULE(pParseNode, test_for_null) || SQL_ISRULE(pParseNode, like_predicate))
 	{
-		const OSQLParseNode *pLeft = pParseNode->getChild(0),
-		                    *pMiddleLeft = pParseNode->getChild(1),
-		                    *pMiddleRight = pParseNode->getChild(2),
-		                    *pRight = pParseNode->getChild(3);
+        const OSQLParseNode *pLeft = pParseNode->getChild(0);
+        const OSQLParseNode* pPart2 = pParseNode->getChild(1);		
+        const OSQLParseNode *pMiddleLeft = pPart2->getChild(0),
+	                        *pMiddleRight = pPart2->getChild(1),
+	                        *pRight = pPart2->getChild(2);
 
 		if (SQL_ISRULE(pParseNode, test_for_null))
 		{

connectivity/source/drivers/mozab/MColumns.cxx

 				OColumn* pRet = new OColumn(_rName,
 											sTypeName,
 											xRow->getString(13),
+                                            xRow->getString(12),
 											xRow->getInt(11),
 											nPrec,
 											xRow->getInt(9),

connectivity/source/drivers/mozab/MPreparedStatement.cxx

     Reference<XPropertySet> xParaColumn = new connectivity::sdbcx::OColumn(sParameterName
                                                     ,::rtl::OUString()
                                                     ,::rtl::OUString()
+                                                    ,::rtl::OUString()
                                                     ,nNullable
                                                     ,nPrecision
                                                     ,nScale

connectivity/source/drivers/mozab/MResultSet.cxx

     }
     else if (SQL_ISRULE(parseTree,like_predicate))
     {
-        OSL_ENSURE(parseTree->count() >= 4, "Error parsing LIKE predicate");
+        OSL_ENSURE(parseTree->count() == 2, "Error parsing LIKE predicate");
 
         OSL_TRACE("analyseSQL : Got LIKE rule\n");
 
         OSQLParseNode *pColumn;
         OSQLParseNode *pAtom;
         OSQLParseNode *pOptEscape;
+        const OSQLParseNode* pPart2 = parseTree->getChild(1);		
         pColumn     = parseTree->getChild(0);                        // Match Item
-        pAtom       = parseTree->getChild(parseTree->count()-2);     // Match String
-        pOptEscape  = parseTree->getChild(parseTree->count()-1);     // Opt Escape Rule
+        pAtom       = pPart2->getChild(parseTree->count()-2);     // Match String
+        pOptEscape  = pPart2->getChild(parseTree->count()-1);     // Opt Escape Rule
+        const bool bNot = SQL_ISTOKEN(pPart2->getChild(0), NOT);
 
         if (!(pAtom->getNodeType() == SQL_NODE_STRING ||
               pAtom->getNodeType() == SQL_NODE_NAME ||
              matchString.indexOf ( MATCHCHAR ) == -1 )
         {
             // Simple string , eg. "to match"
-            if ( parseTree->count() == 5 )
+            if ( bNot )
                 op = MQueryOp::DoesNotContain;
             else
                 op = MQueryOp::Contains;
             matchString = matchString.replaceAt( 0, 1, rtl::OUString() );
             matchString = matchString.replaceAt( matchString.getLength() -1 , 1, rtl::OUString() );
 
-            if ( parseTree->count() == 5 )
+            if (bNot)
                 op = MQueryOp::DoesNotContain;
             else
                 op = MQueryOp::Contains;
         }
-        else if ( parseTree->count() == 5 )
+        else if ( bNot )
         {
             // We currently can't handle a 'NOT LIKE' when there are '%' or
             // '_' dispersed throughout
     }
     else if (SQL_ISRULE(parseTree,test_for_null))
     {
-        OSL_ENSURE(parseTree->count() >= 3,"Error in ParseTree");
-        OSL_ENSURE(SQL_ISTOKEN(parseTree->getChild(1),IS),"Error in ParseTree");
+        OSL_ENSURE(parseTree->count() == 2,"Error in ParseTree");
+        const OSQLParseNode* pPart2 = parseTree->getChild(1);		
+        OSL_ENSURE(SQL_ISTOKEN(pPart2->getChild(0),IS),"Error in ParseTree");
 
         if (!SQL_ISRULE(parseTree->getChild(0),column_ref))
         {
             m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_IS_NULL_COLUMN, *this );
         }
 
-        if (SQL_ISTOKEN(parseTree->getChild(2),NOT))
+        if (SQL_ISTOKEN(pPart2->getChild(1),NOT))
         {
             op = MQueryOp::Exists;
         }

connectivity/source/drivers/mysql/YTable.cxx

 		xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))		>>= bOldAutoIncrement;
 		descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))	>>= bAutoIncrement;
         bool bColumnNameChanged = false;
+        ::rtl::OUString sOldDesc,sNewDesc;
+        xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DESCRIPTION))		>>= sOldDesc;
+		descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DESCRIPTION))	>>= sNewDesc;
 
 		if (	nOldType != nNewType
 			||	nOldPrec != nNewPrec
 			||	nOldScale != nNewScale
 			||	nNewNullable != nOldNullable
-			||	bOldAutoIncrement != bAutoIncrement )
+			||	bOldAutoIncrement != bAutoIncrement 
+            || sOldDesc != sNewDesc )
 		{
 			// special handling because they change dthe type names to distinguish
 			// if a column should be an auto_incmrement one
 			const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString(  );
 			sSql += ::dbtools::quoteName(sQuote,colName);
 			sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
-			sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(descriptor,getConnection(),getTypeCreatePattern()));
+			sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(descriptor,getConnection(),static_cast<OTables*>(m_pTables),getTypeCreatePattern()));
 			executeStatement(sSql);
 		}
 		m_pColumns->refresh();
 	::comphelper::copyProperties(_xDescriptor,xProp);
 	xProp->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),makeAny(nNewType));
 
-    sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(xProp,getConnection(),getTypeCreatePattern()));
+    sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(xProp,getConnection(),static_cast<OTables*>(m_pTables),getTypeCreatePattern()));
 	executeStatement(sSql);
 }
 // -----------------------------------------------------------------------------

connectivity/source/drivers/mysql/YTables.cxx

 {
 	const Reference< XConnection > xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
     static const ::rtl::OUString s_sCreatePattern(RTL_CONSTASCII_USTRINGPARAM("(M,D)"));
-	const ::rtl::OUString aSql = adjustSQL(::dbtools::createSqlCreateTableStatement(descriptor,xConnection,s_sCreatePattern));
+	const ::rtl::OUString aSql = adjustSQL(::dbtools::createSqlCreateTableStatement(descriptor,xConnection,this,s_sCreatePattern));
     Reference< XStatement > xStmt = xConnection->createStatement(  );
 	if ( xStmt.is() )
 	{
 	return ::dbtools::composeTableName( m_xMetaData, _xObject, ::dbtools::eInDataManipulation, false, false, false );
 }
 // -----------------------------------------------------------------------------
-
+void OTables::addComment(const Reference< XPropertySet >& descriptor,::rtl::OUStringBuffer& _rOut)
+{
+    ::rtl::OUString sDesc;
+    descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))		>>= sDesc;
+    if ( sDesc.getLength() )
+    {
+        _rOut.appendAscii(" COMMENT '");
+        _rOut.append(sDesc);
+        _rOut.appendAscii("'");
+    }
+}

connectivity/source/drivers/mysql/mysql.xcu

             <value>com.mysql.jdbc.Driver</value>
           </prop>
         </node>
+        <node oor:name="AddIndexAppendix" oor:op="replace">
+          <prop oor:name="Value" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
+        </node>
       </node>
       <node oor:name="Features">
         <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
             <value>UserPassword</value>
           </prop>
         </node>
+        <node oor:name="SupportsColumnDescription" oor:op="replace">
+          <prop oor:name="Value" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
+        </node>
       </node>
     </node>
     <node oor:name="sdbc:mysql:odbc:*" oor:op="replace">
             <value></value>
           </prop>
         </node>
+        <node oor:name="AddIndexAppendix" oor:op="replace">
+          <prop oor:name="Value" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
+        </node>
       </node>
       <node oor:name="Features">
         <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
             <value></value>
           </prop>
         </node>
+        <node oor:name="AddIndexAppendix" oor:op="replace">
+          <prop oor:name="Value" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
+        </node>
       </node>
       <node oor:name="Features">
         <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
             <value>UserPassword</value>
           </prop>
         </node>
+        <node oor:name="SupportsColumnDescription" oor:op="replace">
+          <prop oor:name="Value" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
+        </node>
       </node>
     </node>
   </node>

connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx

 		osl_incrementInterlockedCount( &m_refCount );
 		dispose();
 	}
-	delete m_pRowStatusArray;
+	delete [] m_pRowStatusArray;
 }
 // -------------------------------------------------------------------------
 void ODatabaseMetaDataResultSet::disposing(void)