diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-06-15 05:33:03 +0200 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-06-15 05:33:03 +0200 |
commit | fc156984589e119eabc10b60e828880c09e39707 (patch) | |
tree | 0c26fa4ceddc84a8001d229fdb367c8f66806d3c /connectivity | |
parent | 5895b4ff6a06e2e002aaa6c61a2faf0cb58ddc9e (diff) | |
parent | 634bd66a83cffb00d41d434e77c80eef06a0c813 (diff) |
calctabcolor: rebased to DEV300_m82.
Diffstat (limited to 'connectivity')
55 files changed, 1826 insertions, 721 deletions
diff --git a/connectivity/inc/connectivity/PColumn.hxx b/connectivity/inc/connectivity/PColumn.hxx index 8f22de0be964..547cc8fb9970 100644 --- a/connectivity/inc/connectivity/PColumn.hxx +++ b/connectivity/inc/connectivity/PColumn.hxx @@ -33,6 +33,7 @@ #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 @@ -49,6 +50,7 @@ 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; @@ -64,6 +66,7 @@ namespace connectivity 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, @@ -75,15 +78,17 @@ namespace connectivity 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: @@ -92,16 +97,20 @@ namespace connectivity 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: @@ -125,17 +134,6 @@ namespace connectivity 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(); diff --git a/connectivity/inc/connectivity/SQLStatementHelper.hxx b/connectivity/inc/connectivity/SQLStatementHelper.hxx new file mode 100644 index 000000000000..0d1bb97c7b7f --- /dev/null +++ b/connectivity/inc/connectivity/SQLStatementHelper.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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_ + diff --git a/connectivity/inc/connectivity/TTableHelper.hxx b/connectivity/inc/connectivity/TTableHelper.hxx index 9f0a644e0b6d..f99a106bce37 100644 --- a/connectivity/inc/connectivity/TTableHelper.hxx +++ b/connectivity/inc/connectivity/TTableHelper.hxx @@ -45,6 +45,7 @@ namespace connectivity { ::rtl::OUString sName; ::rtl::OUString aField6; + ::rtl::OUString sField12; // REMARKS ::rtl::OUString sField13; sal_Int32 nField5 , nField7 @@ -60,10 +61,12 @@ namespace connectivity , 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) diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx index 1503291ef9b7..9b93830aeefe 100644 --- a/connectivity/inc/connectivity/dbtools.hxx +++ b/connectivity/inc/connectivity/dbtools.hxx @@ -87,6 +87,7 @@ namespace rtl //......................................................................... namespace dbtools { + class ISQLStatementHelper; typedef ::utl::SharedUNOComponent< ::com::sun::star::sdbc::XConnection > SharedConnection; enum EComposeRule @@ -225,6 +226,15 @@ namespace dbtools 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: @@ -661,6 +671,7 @@ namespace dbtools 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. @@ -674,32 +685,39 @@ namespace dbtools 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 diff --git a/connectivity/inc/connectivity/sdbcx/VColumn.hxx b/connectivity/inc/connectivity/sdbcx/VColumn.hxx index 2c9fa31a2d7e..0a8c5498cf60 100644 --- a/connectivity/inc/connectivity/sdbcx/VColumn.hxx +++ b/connectivity/inc/connectivity/sdbcx/VColumn.hxx @@ -84,6 +84,7 @@ namespace connectivity 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, diff --git a/connectivity/inc/connectivity/sqliterator.hxx b/connectivity/inc/connectivity/sqliterator.hxx index 3b7db6968671..5152b7221f85 100644 --- a/connectivity/inc/connectivity/sqliterator.hxx +++ b/connectivity/inc/connectivity/sqliterator.hxx @@ -40,6 +40,7 @@ #include <map> #include <memory> +#include <vector> namespace connectivity { @@ -47,6 +48,8 @@ namespace connectivity class OSQLParseNode; class OSQLParser; + typedef ::std::pair<const OSQLParseNode*,const OSQLParseNode* > TNodePair; + enum OSQLStatementType { SQL_STATEMENT_UNKNOWN, SQL_STATEMENT_SELECT, @@ -279,6 +282,10 @@ namespace connectivity // 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 */ @@ -351,6 +358,7 @@ namespace connectivity { m_aErrors = ::com::sun::star::sdbc::SQLException(); } + void impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition); }; } diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx index 5f1d7137e678..fa283cb5cf04 100644 --- a/connectivity/inc/connectivity/sqlnode.hxx +++ b/connectivity/inc/connectivity/sqlnode.hxx @@ -226,6 +226,11 @@ namespace connectivity 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) }; diff --git a/connectivity/prj/build.lst b/connectivity/prj/build.lst index dd386c7c7161..0b15c06acf15 100644 --- a/connectivity/prj/build.lst +++ b/connectivity/prj/build.lst @@ -1,4 +1,4 @@ -cn connectivity : shell l10n comphelper MOZ:moz SO:moz_prebuilt svl UNIXODBC:unixODBC unoil javaunohelper HSQLDB:hsqldb QADEVOOO:qadevOOo officecfg NSS:nss NULL +cn connectivity : shell l10n comphelper MOZ:moz SO:moz_prebuilt svl UNIXODBC:unixODBC unoil javaunohelper HSQLDB:hsqldb qadevOOo officecfg NSS:nss NULL cn connectivity usr1 - all cn_mkout NULL cn connectivity\inc nmake - all cn_inc NULL cn connectivity\com\sun\star\sdbcx\comp\hsqldb nmake - all cn_jhsqldbdb cn_hsqldb cn_inc NULL diff --git a/connectivity/qa/connectivity/tools/CRMDatabase.java b/connectivity/qa/connectivity/tools/CRMDatabase.java index c35faac75ff7..a1b457884948 100644 --- a/connectivity/qa/connectivity/tools/CRMDatabase.java +++ b/connectivity/qa/connectivity/tools/CRMDatabase.java @@ -285,7 +285,7 @@ public class CRMDatabase 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(); } diff --git a/connectivity/qa/connectivity/tools/makefile.mk b/connectivity/qa/connectivity/tools/makefile.mk index 0f3c9c84b92e..07490532a1b1 100644 --- a/connectivity/qa/connectivity/tools/makefile.mk +++ b/connectivity/qa/connectivity/tools/makefile.mk @@ -38,7 +38,6 @@ all: @echo "Java not available. Build skipped" .ELSE -.IF "$(BUILD_QADEVOOO)" == "YES" #----- compile .java files ----------------------------------------- JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunnerLight.jar @@ -61,8 +60,6 @@ ALL : ALLTAR ALL: ALLDEP .ENDIF -.ENDIF - .ENDIF # "$(SOLAR_JAVA)" == "" .INCLUDE : target.mk diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx index a09260782fd6..9f5be37f208f 100644 --- a/connectivity/source/commontools/DateConversion.cxx +++ b/connectivity/source/commontools/DateConversion.cxx @@ -126,9 +126,27 @@ using namespace ::com::sun::star::beans; 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 '"); @@ -142,7 +160,24 @@ using namespace ::com::sun::star::beans; 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)); @@ -152,7 +187,24 @@ using namespace ::com::sun::star::beans; 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)); diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx index f99c637fa396..48c2736cd05a 100755 --- a/connectivity/source/commontools/DriversConfig.cxx +++ b/connectivity/source/commontools/DriversConfig.cxx @@ -136,26 +136,26 @@ DriversConfig::DriversConfig(const uno::Reference< lang::XMultiServiceFactory >& } // ----------------------------------------------------------------------------- -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 { diff --git a/connectivity/source/commontools/TColumnsHelper.cxx b/connectivity/source/commontools/TColumnsHelper.cxx index d6b26dffbe92..325fcfbd0f42 100644 --- a/connectivity/source/commontools/TColumnsHelper.cxx +++ b/connectivity/source/commontools/TColumnsHelper.cxx @@ -121,29 +121,7 @@ sdbcx::ObjectType OColumnsHelper::createObject(const ::rtl::OUString& _rName) 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) ) { @@ -152,6 +130,7 @@ sdbcx::ObjectType OColumnsHelper::createObject(const ::rtl::OUString& _rName) connectivity::sdbcx::OColumn* pRet = new connectivity::sdbcx::OColumn(_rName, pColDesc->aField6, pColDesc->sField13, + pColDesc->sField12, nField11, pColDesc->nField7, pColDesc->nField9, @@ -207,7 +186,7 @@ sdbcx::ObjectType OColumnsHelper::appendObject( const ::rtl::OUString& _rForName 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() ) diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx index f44b08fa15b7..7d020e9fc4a6 100644 --- a/connectivity/source/commontools/TTableHelper.cxx +++ b/connectivity/source/commontools/TTableHelper.cxx @@ -210,9 +210,10 @@ namespace 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 ) ); } } diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 0b7cb5b5df58..05bcf997268f 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -60,8 +60,10 @@ #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> @@ -528,6 +530,46 @@ Reference< XNameAccess> getTableFields(const Reference< XConnection>& _rxConn,co 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 @@ -2051,7 +2093,7 @@ namespace connectivity 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) @@ -2061,7 +2103,7 @@ void release(oslInterlockedCount& _refCount, 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; diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index 7cf12345ae67..c9a878fe1840 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -30,11 +30,10 @@ #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> @@ -71,7 +70,7 @@ namespace dbtools 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(); @@ -186,11 +185,14 @@ namespace dbtools 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; @@ -223,7 +225,7 @@ namespace dbtools { if ( (xColumns->getByIndex(i) >>= xColProp) && xColProp.is() ) { - aSql.append(createStandardColumnPart(xColProp,_xConnection,_sCreatePattern)); + aSql.append(createStandardColumnPart(xColProp,_xConnection,_pHelper,_sCreatePattern)); aSql.appendAscii(","); } } @@ -364,9 +366,10 @@ namespace // ----------------------------------------------------------------------------- ::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; @@ -411,7 +414,8 @@ namespace 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 @@ -471,6 +475,7 @@ namespace connectivity::sdbcx::OColumn* pRet = new connectivity::sdbcx::OColumn(_rName, aField6, sField13, + sField12, nField11, nField7, nField9, @@ -526,28 +531,7 @@ Reference<XPropertySet> createSDBCXColumn(const Reference<XPropertySet>& _xTable _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() ) @@ -555,7 +539,7 @@ Reference<XPropertySet> createSDBCXColumn(const Reference<XPropertySet>& _xTable 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, @@ -665,19 +649,9 @@ Reference< XTablesSupplier> getDataDefinitionByURLAndConnection( 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& ) diff --git a/connectivity/source/commontools/propertyids.cxx b/connectivity/source/commontools/propertyids.cxx index f1e31a2c7f0e..b6bae373a7db 100644 --- a/connectivity/source/commontools/propertyids.cxx +++ b/connectivity/source/commontools/propertyids.cxx @@ -93,6 +93,7 @@ namespace dbtools 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 @@ -180,6 +181,7 @@ namespace dbtools 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; } diff --git a/connectivity/source/drivers/adabas/BColumns.cxx b/connectivity/source/drivers/adabas/BColumns.cxx index 8fc009917fb2..bb0363792c12 100644 --- a/connectivity/source/drivers/adabas/BColumns.cxx +++ b/connectivity/source/drivers/adabas/BColumns.cxx @@ -96,6 +96,7 @@ sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) xRet = new OColumn(_rName, sTypeName, xRow->getString(13), + xRow->getString(12), xRow->getInt(11), nPrec, xRow->getInt(9), diff --git a/connectivity/source/drivers/adabas/adabas.xcu b/connectivity/source/drivers/adabas/adabas.xcu index 20c811bd2d5a..b92067235e15 100755 --- a/connectivity/source/drivers/adabas/adabas.xcu +++ b/connectivity/source/drivers/adabas/adabas.xcu @@ -65,6 +65,11 @@ <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"> diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx index bb4b985e3bfc..aa287c185b26 100644 --- a/connectivity/source/drivers/ado/AColumn.cxx +++ b/connectivity/source/drivers/ado/AColumn.cxx @@ -65,7 +65,7 @@ void WpADOColumn::Create() } // ------------------------------------------------------------------------- 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(); @@ -183,12 +183,13 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r 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; } diff --git a/connectivity/source/drivers/ado/ado.xcu b/connectivity/source/drivers/ado/ado.xcu index 5859d5eecf3e..50c29cf7ba2e 100755 --- a/connectivity/source/drivers/ado/ado.xcu +++ b/connectivity/source/drivers/ado/ado.xcu @@ -134,6 +134,11 @@ <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"> @@ -228,6 +233,11 @@ <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"> diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index 1d19c05a46c0..a4e5f35825f5 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -347,14 +347,15 @@ void lcl_SetValue( ORowSetValue& rValue, const Reference<XSpreadsheet>& xSheet, switch (nType) { case DataType::VARCHAR: - if ( eCellType == CellContentType_TEXT ) + if ( eCellType == CellContentType_EMPTY ) + rValue.setNull(); + else { + // #i25840# still let Calc convert numbers to text const Reference<XText> xText( xCell, UNO_QUERY ); if ( xText.is() ) rValue = xText->getString(); - } // if ( eCellType == CellContentType_TEXT ) - else - rValue.setNull(); + } break; case DataType::DECIMAL: if ( eCellType == CellContentType_VALUE ) @@ -525,7 +526,7 @@ void OCalcTable::fillColumns() 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); diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 15da50651250..8544e4affda7 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -449,6 +449,7 @@ OSL_TRACE("column type: %c",aDBFColumn.db_typ); Reference< XPropertySet> xCol = new sdbcx::OColumn(aColumnName, aTypeName, ::rtl::OUString(), + ::rtl::OUString(), ColumnValue::NULLABLE, nPrecision, aDBFColumn.db_dez, diff --git a/connectivity/source/drivers/dbase/dbase.xcu b/connectivity/source/drivers/dbase/dbase.xcu index 5e6e7596c3fe..f5de1d53ab0e 100755 --- a/connectivity/source/drivers/dbase/dbase.xcu +++ b/connectivity/source/drivers/dbase/dbase.xcu @@ -50,6 +50,11 @@ <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"> diff --git a/connectivity/source/drivers/evoab2/NColumns.cxx b/connectivity/source/drivers/evoab2/NColumns.cxx index ddad36e52262..d1854e62181d 100644 --- a/connectivity/source/drivers/evoab2/NColumns.cxx +++ b/connectivity/source/drivers/evoab2/NColumns.cxx @@ -66,6 +66,7 @@ sdbcx::ObjectType OEvoabColumns::createObject(const ::rtl::OUString& _rName) _rName, xRow->getString(6), xRow->getString(13), + xRow->getString(12), xRow->getInt(11), xRow->getInt(7), xRow->getInt(9), diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx index 77598f97380c..feca8f55aeff 100644 --- a/connectivity/source/drivers/evoab2/NStatement.cxx +++ b/connectivity/source/drivers/evoab2/NStatement.cxx @@ -381,15 +381,16 @@ EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree ) // 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 || diff --git a/connectivity/source/drivers/file/FColumns.cxx b/connectivity/source/drivers/file/FColumns.cxx index 7c70d4c4372d..3c3929a80c50 100644 --- a/connectivity/source/drivers/file/FColumns.cxx +++ b/connectivity/source/drivers/file/FColumns.cxx @@ -64,6 +64,7 @@ sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) 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), diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index 080b2a592aef..68e23360331b 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -511,6 +511,7 @@ UINT32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Refere Reference<XPropertySet> xParaColumn = new connectivity::parse::OParseColumn(sParameterName ,::rtl::OUString() ,::rtl::OUString() + ,::rtl::OUString() ,nNullable ,nPrecision ,nScale diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index 9cf9874dbf10..eeaec1ff40f1 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.cxx @@ -288,17 +288,14 @@ OOperand* OPredicateCompiler::execute_COMPARE(OSQLParseNode* pPredicateNode) th //------------------------------------------------------------------ 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))) { @@ -322,9 +319,9 @@ OOperand* OPredicateCompiler::execute_LIKE(OSQLParseNode* pPredicateNode) throw( 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; @@ -332,11 +329,12 @@ OOperand* OPredicateCompiler::execute_LIKE(OSQLParseNode* pPredicateNode) throw( //------------------------------------------------------------------ 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)) @@ -346,7 +344,7 @@ OOperand* OPredicateCompiler::execute_BETWEEN(OSQLParseNode* pPredicateNode) thr 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); @@ -411,11 +409,12 @@ OOperand* OPredicateCompiler::execute_BETWEEN(OSQLParseNode* pPredicateNode) thr //------------------------------------------------------------------ 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; @@ -635,7 +634,6 @@ OOperand* OPredicateCompiler::executeFunction(OSQLParseNode* pPredicateNode) 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: @@ -677,7 +675,6 @@ OOperand* OPredicateCompiler::executeFunction(OSQLParseNode* pPredicateNode) 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(); diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 2d46c3be5bf3..eff2464ce533 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -304,7 +304,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) 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, diff --git a/connectivity/source/drivers/hsqldb/hsqldb.xcu b/connectivity/source/drivers/hsqldb/hsqldb.xcu index e5ab3cc4ba14..f97b5e357179 100755 --- a/connectivity/source/drivers/hsqldb/hsqldb.xcu +++ b/connectivity/source/drivers/hsqldb/hsqldb.xcu @@ -50,6 +50,11 @@ <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"> diff --git a/connectivity/source/drivers/jdbc/jdbc.xcu b/connectivity/source/drivers/jdbc/jdbc.xcu index 59fb95460aa2..f4f599a701d9 100755 --- a/connectivity/source/drivers/jdbc/jdbc.xcu +++ b/connectivity/source/drivers/jdbc/jdbc.xcu @@ -189,6 +189,11 @@ <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"> diff --git a/connectivity/source/drivers/kab/KColumns.cxx b/connectivity/source/drivers/kab/KColumns.cxx index d75e782aed7b..4adcbe304c82 100644 --- a/connectivity/source/drivers/kab/KColumns.cxx +++ b/connectivity/source/drivers/kab/KColumns.cxx @@ -66,6 +66,7 @@ sdbcx::ObjectType KabColumns::createObject(const ::rtl::OUString& _rName) _rName, xRow->getString(6), xRow->getString(13), + xRow->getString(12), xRow->getInt(11), xRow->getInt(7), xRow->getInt(9), diff --git a/connectivity/source/drivers/kab/KStatement.cxx b/connectivity/source/drivers/kab/KStatement.cxx index 4164ffe0ee52..f0069fc6875e 100644 --- a/connectivity/source/drivers/kab/KStatement.cxx +++ b/connectivity/source/drivers/kab/KStatement.cxx @@ -185,12 +185,13 @@ KabCondition *KabCommonStatement::analyseWhereClause(const OSQLParseNode *pParse } } } - 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)) { diff --git a/connectivity/source/drivers/macab/MacabColumns.cxx b/connectivity/source/drivers/macab/MacabColumns.cxx index 9eccf1a11b73..c1ba3f1fe6d0 100755 --- a/connectivity/source/drivers/macab/MacabColumns.cxx +++ b/connectivity/source/drivers/macab/MacabColumns.cxx @@ -66,6 +66,7 @@ sdbcx::ObjectType MacabColumns::createObject(const ::rtl::OUString& _rName) _rName, xRow->getString(6), xRow->getString(13), + xRow->getString(12), xRow->getInt(11), xRow->getInt(7), xRow->getInt(9), diff --git a/connectivity/source/drivers/macab/MacabStatement.cxx b/connectivity/source/drivers/macab/MacabStatement.cxx index 8ee24921667a..9960ea7a4d97 100755 --- a/connectivity/source/drivers/macab/MacabStatement.cxx +++ b/connectivity/source/drivers/macab/MacabStatement.cxx @@ -188,12 +188,13 @@ MacabCondition *MacabCommonStatement::analyseWhereClause(const OSQLParseNode *pP } } } - 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)) { diff --git a/connectivity/source/drivers/mozab/MColumns.cxx b/connectivity/source/drivers/mozab/MColumns.cxx index 17b418899f45..42a33bbc2a98 100644 --- a/connectivity/source/drivers/mozab/MColumns.cxx +++ b/connectivity/source/drivers/mozab/MColumns.cxx @@ -74,6 +74,7 @@ sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) OColumn* pRet = new OColumn(_rName, sTypeName, xRow->getString(13), + xRow->getString(12), xRow->getInt(11), nPrec, xRow->getInt(9), diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx index 38caad53b551..5aad943b151a 100644 --- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx +++ b/connectivity/source/drivers/mozab/MPreparedStatement.cxx @@ -450,6 +450,7 @@ sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Re Reference<XPropertySet> xParaColumn = new connectivity::sdbcx::OColumn(sParameterName ,::rtl::OUString() ,::rtl::OUString() + ,::rtl::OUString() ,nNullable ,nPrecision ,nScale diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx index 9602a35a8b29..c7c85770419e 100644 --- a/connectivity/source/drivers/mozab/MResultSet.cxx +++ b/connectivity/source/drivers/mozab/MResultSet.cxx @@ -882,7 +882,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT } 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"); @@ -895,9 +895,11 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT 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 || @@ -945,7 +947,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT matchString.indexOf ( MATCHCHAR ) == -1 ) { // Simple string , eg. "to match" - if ( parseTree->count() == 5 ) + if ( bNot ) op = MQueryOp::DoesNotContain; else op = MQueryOp::Contains; @@ -961,12 +963,12 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT 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 @@ -1020,15 +1022,16 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT } 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; } diff --git a/connectivity/source/drivers/mysql/YTable.cxx b/connectivity/source/drivers/mysql/YTable.cxx index 72383be76c58..06be64f83313 100644 --- a/connectivity/source/drivers/mysql/YTable.cxx +++ b/connectivity/source/drivers/mysql/YTable.cxx @@ -220,12 +220,16 @@ void SAL_CALL OMySQLTable::alterColumnByName( const ::rtl::OUString& colName, co 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 @@ -281,7 +285,7 @@ void SAL_CALL OMySQLTable::alterColumnByName( const ::rtl::OUString& colName, co 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(); @@ -310,7 +314,7 @@ void OMySQLTable::alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rCo ::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); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx index b337ddc92390..80bb2baf58c0 100644 --- a/connectivity/source/drivers/mysql/YTables.cxx +++ b/connectivity/source/drivers/mysql/YTables.cxx @@ -204,7 +204,7 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) { 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() ) { @@ -230,4 +230,14 @@ void OTables::appendNew(const ::rtl::OUString& _rsNewTable) 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("'"); + } +} diff --git a/connectivity/source/drivers/mysql/mysql.xcu b/connectivity/source/drivers/mysql/mysql.xcu index 2fc59be5bdc3..afc5c0d07f5d 100755 --- a/connectivity/source/drivers/mysql/mysql.xcu +++ b/connectivity/source/drivers/mysql/mysql.xcu @@ -45,6 +45,11 @@ <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"> @@ -94,6 +99,11 @@ <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"> @@ -109,6 +119,11 @@ <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"> @@ -183,6 +198,11 @@ <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"> @@ -227,6 +247,11 @@ <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> diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx index 80aacacef576..751ab7cf2988 100644 --- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx @@ -97,7 +97,7 @@ ODatabaseMetaDataResultSet::~ODatabaseMetaDataResultSet() osl_incrementInterlockedCount( &m_refCount ); dispose(); } - delete m_pRowStatusArray; + delete [] m_pRowStatusArray; } // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSet::disposing(void) diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx index da29bcf08c17..7055bd273370 100644 --- a/connectivity/source/drivers/odbcbase/OResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx @@ -162,7 +162,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) : // ------------------------------------------------------------------------- OResultSet::~OResultSet() { - delete m_pRowStatusArray; + delete [] m_pRowStatusArray; delete m_pSkipDeletedSet; } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx index b892e6336b19..43de55e3505c 100644 --- a/connectivity/source/drivers/odbcbase/OTools.cxx +++ b/connectivity/source/drivers/odbcbase/OTools.cxx @@ -391,6 +391,7 @@ void OTools::bindValue( OConnection* _pConnection, case SQL_TIMESTAMP: *pLen = sizeof(TIMESTAMP_STRUCT); *((TIMESTAMP_STRUCT*)_pData) = *(TIMESTAMP_STRUCT*)_pValue; + break; } } catch ( ... ) diff --git a/connectivity/source/inc/mysql/YTables.hxx b/connectivity/source/inc/mysql/YTables.hxx index 421012e3678e..ec19ac83140b 100644 --- a/connectivity/source/inc/mysql/YTables.hxx +++ b/connectivity/source/inc/mysql/YTables.hxx @@ -28,12 +28,14 @@ #define CONNECTIVITY_MYSQL_TABLES_HXX #include "connectivity/sdbcx/VCollection.hxx" +#include "connectivity/SQLStatementHelper.hxx" #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> namespace connectivity { namespace mysql { - class OTables : public sdbcx::OCollection + class OTables : public sdbcx::OCollection, + public ::dbtools::ISQLStatementHelper { ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; @@ -76,6 +78,9 @@ namespace connectivity @param _sSql in/out */ static ::rtl::OUString adjustSQL(const ::rtl::OUString& _sSql); + + // ISQLStatementHelper + virtual void addComment(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,::rtl::OUStringBuffer& _rOut); }; } } diff --git a/connectivity/source/inc/propertyids.hxx b/connectivity/source/inc/propertyids.hxx index 1f7252158918..b28278b0477d 100644 --- a/connectivity/source/inc/propertyids.hxx +++ b/connectivity/source/inc/propertyids.hxx @@ -133,7 +133,7 @@ pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaCon #define PROPERTY_ID_INVALID_INDEX 41 #define PROPERTY_ID_HY010 43 - // FREE +#define PROPERTY_ID_LABEL 44 #define PROPERTY_ID_DELIMITER 45 #define PROPERTY_ID_FORMATKEY 46 #define PROPERTY_ID_LOCALE 47 diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx index 21e78ec61fea..43e38f5a1674 100644 --- a/connectivity/source/parse/PColumn.cxx +++ b/connectivity/source/parse/PColumn.cxx @@ -42,12 +42,14 @@ using namespace connectivity::parse; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; // ------------------------------------------------------------------------- OParseColumn::OParseColumn(const Reference<XPropertySet>& _xColumn,sal_Bool _bCase) : connectivity::sdbcx::OColumn( getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))) + , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))) @@ -69,6 +71,7 @@ OParseColumn::OParseColumn(const Reference<XPropertySet>& _xColumn,sal_Bool OParseColumn::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, @@ -79,6 +82,7 @@ OParseColumn::OParseColumn( const ::rtl::OUString& _Name, ) : connectivity::sdbcx::OColumn(_Name, _TypeName, _DefaultValue, + _Description, _IsNullable, _Precision, _Scale, @@ -97,25 +101,52 @@ OParseColumn::OParseColumn( const ::rtl::OUString& _Name, // ------------------------------------------------------------------------- ::vos::ORef< OSQLColumns > OParseColumn::createColumnsForResultSet( const Reference< XResultSetMetaData >& _rxResMetaData, - const Reference< XDatabaseMetaData >& _rxDBMetaData ) + const Reference< XDatabaseMetaData >& _rxDBMetaData,const Reference< XNameAccess>& i_xQueryColumns ) { sal_Int32 nColumnCount = _rxResMetaData->getColumnCount(); ::vos::ORef< OSQLColumns > aReturn( new OSQLColumns ); aReturn->get().reserve( nColumnCount ); + StringMap aColumnMap; for ( sal_Int32 i = 1; i <= nColumnCount; ++i ) - aReturn->get().push_back( createColumnForResultSet( _rxResMetaData, _rxDBMetaData, i ) ); + { + OParseColumn* pColumn = createColumnForResultSet( _rxResMetaData, _rxDBMetaData, i,aColumnMap ); + aReturn->get().push_back( pColumn ); + if ( i_xQueryColumns.is() && i_xQueryColumns->hasByName(pColumn->getRealName()) ) + { + Reference<XPropertySet> xColumn(i_xQueryColumns->getByName(pColumn->getRealName()),UNO_QUERY_THROW); + ::rtl::OUString sLabel; + xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_LABEL)) >>= sLabel; + if ( sLabel.getLength() ) + pColumn->setLabel(sLabel); + } + } return aReturn; } // ------------------------------------------------------------------------- OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSetMetaData >& _rxResMetaData, - const Reference< XDatabaseMetaData >& _rxDBMetaData, sal_Int32 _nColumnPos ) + const Reference< XDatabaseMetaData >& _rxDBMetaData, sal_Int32 _nColumnPos,StringMap& _rColumns ) { + ::rtl::OUString sLabel = _rxResMetaData->getColumnLabel( _nColumnPos ); + // retrieve the name of the column + // check for duplicate entries + if(_rColumns.find(sLabel) != _rColumns.end()) + { + ::rtl::OUString sAlias(sLabel); + sal_Int32 searchIndex=1; + while(_rColumns.find(sAlias) != _rColumns.end()) + { + (sAlias = sLabel) += ::rtl::OUString::valueOf(searchIndex++); + } + sLabel = sAlias; + } + _rColumns.insert(StringMap::value_type(sLabel,0)); OParseColumn* pColumn = new OParseColumn( - _rxResMetaData->getColumnLabel( _nColumnPos ), + sLabel, _rxResMetaData->getColumnTypeName( _nColumnPos ), ::rtl::OUString(), + ::rtl::OUString(), _rxResMetaData->isNullable( _nColumnPos ), _rxResMetaData->getPrecision( _nColumnPos ), _rxResMetaData->getScale( _nColumnPos ), @@ -133,6 +164,7 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe ) ); pColumn->setIsSearchable( _rxResMetaData->isSearchable( _nColumnPos ) ); pColumn->setRealName(_rxResMetaData->getColumnName( _nColumnPos )); + pColumn->setLabel(sLabel); return pColumn; } @@ -149,7 +181,7 @@ void OParseColumn::construct() registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME), PROPERTY_ID_REALNAME, 0, &m_aRealName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DBASEPRECISIONCHANGED), PROPERTY_ID_DBASEPRECISIONCHANGED, 0, &m_bDbasePrecisionChanged, ::getCppuType(reinterpret_cast<sal_Bool*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISSEARCHABLE), PROPERTY_ID_ISSEARCHABLE, 0, &m_bIsSearchable, ::getCppuType(reinterpret_cast< sal_Bool*>(NULL))); - + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_LABEL), PROPERTY_ID_LABEL, 0, &m_sLabel, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } // ----------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* OParseColumn::createArrayHelper() const @@ -169,6 +201,7 @@ OOrderColumn::OOrderColumn( const Reference<XPropertySet>& _xColumn : connectivity::sdbcx::OColumn( getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))) + , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))) , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))) @@ -183,33 +216,6 @@ OOrderColumn::OOrderColumn( const Reference<XPropertySet>& _xColumn construct(); } // ------------------------------------------------------------------------- -OOrderColumn::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 - ) : connectivity::sdbcx::OColumn(_Name, - _TypeName, - _DefaultValue, - _IsNullable, - _Precision, - _Scale, - _Type, - _IsAutoIncrement, - sal_False, - _IsCurrency, - _bCase) - , m_bAscending(_bAscending) -{ - construct(); -} -// ------------------------------------------------------------------------- OOrderColumn::~OOrderColumn() { } diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index 4151314d36eb..84e9aa2532ff 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -145,7 +145,7 @@ using namespace connectivity; %union { connectivity::OSQLParseNode * pParseNode; } -%type <pParseNode> '(' ')' ',' ':' ';' '?' '[' ']' '{' '}' '.' +%type <pParseNode> '(' ')' ',' ':' ';' '?' '[' ']' '{' '}' '.' 'K' 'M' 'G' 'T' 'P' %token <pParseNode> SQL_TOKEN_STRING SQL_TOKEN_ACCESS_DATE SQL_TOKEN_INT SQL_TOKEN_REAL_NUM %token <pParseNode> SQL_TOKEN_INTNUM SQL_TOKEN_APPROXNUM SQL_TOKEN_NOT SQL_TOKEN_NAME @@ -188,7 +188,7 @@ using namespace connectivity; /* ODBC KEYWORDS */ %token <pParseNode> SQL_TOKEN_CALL SQL_TOKEN_D SQL_TOKEN_FN SQL_TOKEN_T SQL_TOKEN_TS SQL_TOKEN_OJ /* string functions */ -%token <pParseNode> SQL_TOKEN_ASCII SQL_TOKEN_BIT_LENGTH SQL_TOKEN_CHAR SQL_TOKEN_CHAR_LENGTH SQL_TOKEN_CHARACTER_LENGTH +%token <pParseNode> SQL_TOKEN_ASCII SQL_TOKEN_BIT_LENGTH SQL_TOKEN_CHAR SQL_TOKEN_CHAR_LENGTH SQL_TOKEN_SQL_TOKEN_INTNUM %token <pParseNode> SQL_TOKEN_CONCAT %token <pParseNode> SQL_TOKEN_DIFFERENCE SQL_TOKEN_INSERT SQL_TOKEN_LCASE SQL_TOKEN_LEFT SQL_TOKEN_LENGTH SQL_TOKEN_LOCATE %token <pParseNode> SQL_TOKEN_LOCATE_2 SQL_TOKEN_LTRIM SQL_TOKEN_POSITION SQL_TOKEN_REPEAT SQL_TOKEN_REPLACE @@ -210,6 +210,13 @@ using namespace connectivity; %token <pParseNode> SQL_TOKEN_EVERY SQL_TOKEN_INTERSECTION SQL_TOKEN_FUSION SQL_TOKEN_COLLECT SQL_TOKEN_VAR_POP SQL_TOKEN_VAR_SAMP %token <pParseNode> SQL_TOKEN_STDDEV_SAMP SQL_TOKEN_STDDEV_POP +%token <pParseNode> SQL_TOKEN_RANK SQL_TOKEN_DENSE_RANK SQL_TOKEN_PERCENT_RANK SQL_TOKEN_CUME_DIST SQL_TOKEN_PERCENTILE_CONT SQL_TOKEN_PERCENTILE_DISC SQL_TOKEN_WITHIN SQL_TOKEN_ARRAY_AGG +%token <pParseNode> SQL_TOKEN_CASE SQL_TOKEN_THEN SQL_TOKEN_END SQL_TOKEN_NULLIF SQL_TOKEN_COALESCE SQL_TOKEN_WHEN SQL_TOKEN_ELSE +%token <pParseNode> SQL_TOKEN_BEFORE SQL_TOKEN_AFTER SQL_TOKEN_INSTEAD SQL_TOKEN_EACH SQL_TOKEN_REFERENCING SQL_TOKEN_BEGIN SQL_TOKEN_ATOMIC SQL_TOKEN_TRIGGER SQL_TOKEN_ROW SQL_TOKEN_STATEMENT +%token <pParseNode> SQL_TOKEN_NEW SQL_TOKEN_OLD +%token <pParseNode> SQL_TOKEN_VALUE SQL_TOKEN_CURRENT_CATALOG SQL_TOKEN_CURRENT_DEFAULT_TRANSFORM_GROUP SQL_TOKEN_CURRENT_PATH SQL_TOKEN_CURRENT_ROLE SQL_TOKEN_CURRENT_SCHEMA SQL_TOKEN_CURRENT_USER +%token <pParseNode> SQL_TOKEN_SESSION_USER SQL_TOKEN_SYSTEM_USER SQL_TOKEN_VARCHAR SQL_TOKEN_VARBINARY SQL_TOKEN_VARYING SQL_TOKEN_OBJECT SQL_TOKEN_NCLOB SQL_TOKEN_NATIONAL +%token <pParseNode> SQL_TOKEN_LARGE SQL_TOKEN_CLOB SQL_TOKEN_BLOB SQL_TOKEN_BIGINT SQL_TOKEN_BINARY SQL_TOKEN_WITHOUT SQL_TOKEN_BOOLEAN SQL_TOKEN_INTERVAL /* operators */ %left SQL_TOKEN_NAME %left <pParseNode> SQL_TOKEN_OR @@ -242,10 +249,10 @@ using namespace connectivity; %type <pParseNode> update_statement_searched target_commalist target opt_where_clause %type <pParseNode> select_statement selection table_exp from_clause table_ref_commalist table_ref %type <pParseNode> where_clause opt_group_by_clause column_ref_commalist opt_having_clause -%type <pParseNode> search_condition predicate comparison_predicate between_predicate -%type <pParseNode> like_predicate opt_escape test_for_null in_predicate -%type <pParseNode> all_or_any_predicate any_all_some existence_test subquery -%type <pParseNode> scalar_exp_commalist parameter_ref literal +%type <pParseNode> search_condition predicate comparison_predicate comparison_predicate_part_2 between_predicate between_predicate_part_2 +%type <pParseNode> like_predicate opt_escape test_for_null null_predicate_part_2 in_predicate in_predicate_part_2 character_like_predicate_part_2 other_like_predicate_part_2 +%type <pParseNode> all_or_any_predicate any_all_some existence_test subquery quantified_comparison_predicate_part_2 +%type <pParseNode> scalar_exp_commalist parameter_ref literal parenthesized_boolean_value_expression %type <pParseNode> column_ref data_type column cursor parameter range_variable user /*like_check*/ /* neue Regeln bei OJ */ %type <pParseNode> derived_column as_clause table_name num_primary term num_value_exp @@ -257,8 +264,8 @@ using namespace connectivity; %type <pParseNode> qualified_join value_exp query_term join_type outer_join_type join_condition boolean_term %type <pParseNode> boolean_factor truth_value boolean_test boolean_primary named_columns_join join_spec %type <pParseNode> cast_operand cast_target factor datetime_value_exp /*interval_value_exp*/ datetime_term datetime_factor -%type <pParseNode> datetime_primary datetime_value_fct time_zone time_zone_specifier /*interval_term*/ /*interval_qualifier*/ -%type <pParseNode> /*start_field*/ non_second_datetime_field /*end_field*/ /*single_datetime_field*/ extract_field datetime_field time_zone_field +%type <pParseNode> datetime_primary datetime_value_fct time_zone time_zone_specifier /*interval_term*/ interval_qualifier +%type <pParseNode> start_field non_second_datetime_field end_field single_datetime_field extract_field datetime_field time_zone_field %type <pParseNode> extract_source char_length_exp octet_length_exp bit_length_exp select_sublist string_value_exp %type <pParseNode> char_value_exp concatenation char_factor char_primary string_value_fct char_substring_fct fold %type <pParseNode> form_conversion char_translation trim_fct trim_operands trim_spec bit_value_fct bit_substring_fct op_column_commalist @@ -270,6 +277,15 @@ using namespace connectivity; %type <pParseNode> column_def odbc_fct_spec odbc_call_spec odbc_fct_type op_parameter union_statement %type <pParseNode> op_odbc_call_parameter odbc_parameter_commalist odbc_parameter function_args_commalist function_arg %type <pParseNode> catalog_name schema_name table_node numeric_function string_function function_name date_function table_primary_as_range_column opt_as +%type <pParseNode> ordered_set_function inverse_distribution_function hypothetical_set_function hypothetical_set_function_value_expression_list rank_function_type within_group_specification inverse_distribution_function_type array_aggregate_function inverse_distribution_function_argument +%type <pParseNode> case_expression else_clause result_expression result case_abbreviation case_specification searched_when_clause simple_when_clause searched_case simple_case +%type <pParseNode> when_operand_list when_operand case_operand +%type <pParseNode> trigger_definition trigger_name trigger_action_time trigger_event transition_table_or_variable_list triggered_action trigger_column_list triggered_when_clause triggered_SQL_statement SQL_procedure_statement old_transition_variable_name new_transition_variable_name +%type <pParseNode> op_referencing op_trigger_columnlist op_triggered_action_for opt_row trigger_for SQL_procedure_statement_list transition_table_or_variable old_transition_table_name new_transition_table_name transition_table_name +%type <pParseNode> searched_when_clause_list simple_when_clause_list predefined_type opt_char_set_spec opt_collate_clause character_string_type national_character_string_type +%type <pParseNode> binary_string_type numeric_type boolean_type datetime_type interval_type opt_paren_precision paren_char_length opt_paren_char_large_length paren_character_large_object_length +%type <pParseNode> large_object_length opt_multiplier character_large_object_type national_character_large_object_type binary_large_object_string_type opt_with_or_without_time_zone +%type <pParseNode> approximate_numeric_type exact_numeric_type opt_paren_precision_scale %% /* Parse Tree an OSQLParser zurueckliefern @@ -282,25 +298,20 @@ sql_single_statement: | sql ';' { xxx_pGLOBAL_SQLPARSER->setParseTree( $1 ); } ; -/* -sql_list: - sql_ ';' - {$$ = SQL_NEW_LISTRULE; - $$->append($1); - pSqlParseTreeRoot = $1; -- obsolete - Ergebnis in yyval! rdm } - | sql_list sql ';' - {$1->append($2); - $$ = $1;} - ; -*/ - /* schema definition language */ /* Note: other ``sql:sal_Unicode() rules appear later in the grammar */ -/*** + sql: - schema + manipulative_statement + | schema_element + { + $$ = SQL_NEW_RULE; + $$->append($1); + } ; + +/*** op_authorization: {$$ = SQL_NEW_RULE;} @@ -336,7 +347,7 @@ schema: ; opt_schema_element_list: - /* empty * / {$$ = SQL_NEW_RULE;} + {$$ = SQL_NEW_RULE;} | schema_glement_list ; @@ -349,17 +360,12 @@ schema_element_list: $$ = $1;} ; */ -sql: - schema_element - {$$ = SQL_NEW_RULE; - $$->append($1); - } - ; schema_element: base_table_def | view_def | privilege_def + | trigger_definition ; base_table_def: @@ -676,9 +682,6 @@ sql_not: /* manipulative statements */ -sql: manipulative_statement - ; - manipulative_statement: commit_statement /* | delete_statement_positioned*/ @@ -953,6 +956,10 @@ opt_as: /* empty */ {$$ = SQL_NEW_RULE;} | SQL_TOKEN_AS ; +opt_row: + /* empty */ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_ROW + ; table_primary_as_range_column: {$$ = SQL_NEW_RULE;} | opt_as SQL_TOKEN_NAME op_column_commalist @@ -1073,7 +1080,15 @@ boolean_primary: YYERROR; } ; - +parenthesized_boolean_value_expression: + '(' search_condition ')' + { // boolean_primary: rule 2 + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; boolean_test: boolean_primary | boolean_primary SQL_TOKEN_IS sql_not truth_value @@ -1124,7 +1139,13 @@ predicate: | in_predicate | like_predicate ; - +comparison_predicate_part_2: + comparison row_value_constructor + { + $$ = SQL_NEW_RULE; // comparison_predicate: rule 1 + $$->append($1); + $$->append($2); + } comparison_predicate: row_value_constructor comparison row_value_constructor { @@ -1165,17 +1186,8 @@ comparison: | SQL_LESSEQ | SQL_GREATEQ ; -between_predicate: - row_value_constructor sql_not SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor - {$$ = SQL_NEW_RULE; // between_predicate: rule 1 - $$->append($1); - $$->append($2); - $$->append($3); - $$->append($4); - $$->append($5); - $$->append($6); - } - | sql_not SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor +between_predicate_part_2: + sql_not SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor { if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // between_predicate: rule 2 { @@ -1186,7 +1198,13 @@ between_predicate: { OSQLParseNode* pTemp = $$; $$ = pTemp->removeAt((sal_uInt32)0); - $$->insert(1,$1); + OSQLParseNode* pColumnRef = $$->removeAt((sal_uInt32)0); + $$->insert(0,$1); + OSQLParseNode* pBetween_predicate = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::between_predicate)); + pBetween_predicate->append(pColumnRef); + pBetween_predicate->append($$); + $$ = pBetween_predicate; + delete pTemp; delete $4; } @@ -1197,46 +1215,58 @@ between_predicate: } } else - YYERROR; + { + $$ = SQL_NEW_RULE; // between_predicate: rule 1 + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + } +between_predicate: + row_value_constructor between_predicate_part_2 + { + $$ = SQL_NEW_RULE; // between_predicate: rule 1 + $$->append($1); + $$->append($2); } + | between_predicate_part_2 ; - -like_predicate: - row_value_constructor SQL_TOKEN_NOT SQL_TOKEN_LIKE string_value_exp opt_escape +character_like_predicate_part_2: + sql_not SQL_TOKEN_LIKE string_value_exp opt_escape { $$ = SQL_NEW_RULE; // like_predicate: rule 1 $$->append($1); $$->append($2); $$->append($3); $$->append($4); - $$->append($5); } - | row_value_constructor SQL_TOKEN_LIKE string_value_exp opt_escape + ; +other_like_predicate_part_2: + sql_not SQL_TOKEN_LIKE value_exp_primary opt_escape { - $$ = SQL_NEW_RULE; // like_predicate: rule 2 + $$ = SQL_NEW_RULE; // like_predicate: rule 1 $$->append($1); $$->append($2); $$->append($3); $$->append($4); } - | row_value_constructor SQL_TOKEN_NOT SQL_TOKEN_LIKE value_exp_primary opt_escape + ; +like_predicate: + row_value_constructor character_like_predicate_part_2 { - $$ = SQL_NEW_RULE; // like_predicate: rule 3 + $$ = SQL_NEW_RULE; // like_predicate: rule 1 $$->append($1); $$->append($2); - $$->append($3); - $$->append($4); - $$->append($5); } - | row_value_constructor SQL_TOKEN_LIKE value_exp_primary opt_escape + | row_value_constructor other_like_predicate_part_2 { - $$ = SQL_NEW_RULE; // like_predicate: rule 4 + $$ = SQL_NEW_RULE; // like_predicate: rule 3 $$->append($1); $$->append($2); - $$->append($3); - $$->append($4); } - | sql_not SQL_TOKEN_LIKE string_value_exp opt_escape + | character_like_predicate_part_2 { if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // like_predicate: rule 5 { @@ -1246,19 +1276,19 @@ like_predicate: $$ = SQL_NEW_RULE; $$->append(pColumnRef); $$->append($1); - $$->append($2); - if (xxx_pGLOBAL_SQLPARSER->buildLikeRule($$,$3,$4)) - $$->append($4); - else + OSQLParseNode* p2nd = $1->removeAt(2); + OSQLParseNode* p3rd = $1->removeAt(2); + if ( !xxx_pGLOBAL_SQLPARSER->buildLikeRule($1,p2nd,p3rd) ) { delete $$; YYABORT; } + $1->append(p3rd); } else YYERROR; } - | sql_not SQL_TOKEN_LIKE value_exp_primary opt_escape + | other_like_predicate_part_2 { if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) // like_predicate: rule 6 { @@ -1268,14 +1298,14 @@ like_predicate: $$ = SQL_NEW_RULE; $$->append(pColumnRef); $$->append($1); - $$->append($2); - if (xxx_pGLOBAL_SQLPARSER->buildLikeRule($$,$3,$4)) - $$->append($4); - else + OSQLParseNode* p2nd = $1->removeAt(2); + OSQLParseNode* p3rd = $1->removeAt(2); + if ( !xxx_pGLOBAL_SQLPARSER->buildLikeRule($1,p2nd,p3rd) ) { delete $$; YYABORT; } + $1->append(p3rd); } else YYERROR; @@ -1298,16 +1328,23 @@ opt_escape: } ; +null_predicate_part_2: + SQL_TOKEN_IS sql_not SQL_TOKEN_NULL + { + $$ = SQL_NEW_RULE; // test_for_null: rule 1 + $$->append($1); + $$->append($2); + $$->append($3); + } + ; test_for_null: - row_value_constructor SQL_TOKEN_IS sql_not truth_value + row_value_constructor null_predicate_part_2 { $$ = SQL_NEW_RULE; // test_for_null: rule 1 $$->append($1); $$->append($2); - $$->append($3); - $$->append($4); } - | SQL_TOKEN_IS sql_not truth_value + | null_predicate_part_2 { if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck())// test_for_null: rule 2 { @@ -1317,8 +1354,6 @@ test_for_null: $$ = SQL_NEW_RULE; $$->append(pColumnRef); $$->append($1); - $$->append($2); - $$->append($3); } else YYERROR; @@ -1336,16 +1371,23 @@ in_predicate_value: $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); } ; +in_predicate_part_2: + sql_not SQL_TOKEN_IN in_predicate_value + { + $$ = SQL_NEW_RULE;// in_predicate: rule 1 + $$->append($1); + $$->append($2); + $$->append($3); + } + ; in_predicate: - row_value_constructor sql_not SQL_TOKEN_IN in_predicate_value + row_value_constructor in_predicate_part_2 { $$ = SQL_NEW_RULE;// in_predicate: rule 1 $$->append($1); $$->append($2); - $$->append($3); - $$->append($4); } - | sql_not SQL_TOKEN_IN in_predicate_value + | in_predicate_part_2 { if ( xxx_pGLOBAL_SQLPARSER->inPredicateCheck() )// in_predicate: rule 2 { @@ -1355,24 +1397,28 @@ in_predicate: $$ = SQL_NEW_RULE; $$->append(pColumnRef); $$->append($1); - $$->append($2); - $$->append($3); - // hello } else YYERROR; } ; +quantified_comparison_predicate_part_2: + comparison any_all_some subquery + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; all_or_any_predicate: - row_value_constructor comparison any_all_some subquery + row_value_constructor quantified_comparison_predicate_part_2 { $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); - $$->append($3); - $$->append($4); } - | comparison any_all_some subquery + | quantified_comparison_predicate_part_2 { if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) { @@ -1382,8 +1428,6 @@ all_or_any_predicate: $$ = SQL_NEW_RULE; $$->append(pColumnRef); $$->append($1); - $$->append($2); - $$->append($3); } else YYERROR; @@ -1576,7 +1620,7 @@ char_length_exp: $$->append($3); $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); } - | SQL_TOKEN_CHARACTER_LENGTH '(' value_exp ')' + | SQL_TOKEN_SQL_TOKEN_INTNUM '(' value_exp ')' { $$ = SQL_NEW_RULE; $$->append($1); @@ -1682,10 +1726,19 @@ unsigned_value_spec: ; general_value_spec: parameter - | SQL_TOKEN_USER - | SQL_TOKEN_NULL - | SQL_TOKEN_FALSE - | SQL_TOKEN_TRUE + | SQL_TOKEN_USER + /* | SQL_TOKEN_NULL*/ + | SQL_TOKEN_FALSE + | SQL_TOKEN_TRUE + | SQL_TOKEN_VALUE + | SQL_TOKEN_CURRENT_CATALOG + | SQL_TOKEN_CURRENT_DEFAULT_TRANSFORM_GROUP + | SQL_TOKEN_CURRENT_PATH + | SQL_TOKEN_CURRENT_ROLE + | SQL_TOKEN_CURRENT_SCHEMA + | SQL_TOKEN_CURRENT_USER + | SQL_TOKEN_SESSION_USER + | SQL_TOKEN_SYSTEM_USER ; set_fct_spec: general_set_fct @@ -1962,7 +2015,7 @@ odbc_fct_type: ; general_set_fct: - set_fct_type '(' opt_all_distinct value_exp ')' + set_fct_type '(' opt_all_distinct function_arg ')' { $$ = SQL_NEW_RULE; $$->append($1); @@ -1979,7 +2032,7 @@ general_set_fct: $$->append($3 = newNode("*", SQL_NODE_PUNCTUATION)); $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); } - | SQL_TOKEN_COUNT '(' opt_all_distinct value_exp ')' + | SQL_TOKEN_COUNT '(' opt_all_distinct function_arg ')' { $$ = SQL_NEW_RULE; $$->append($1); @@ -1988,6 +2041,8 @@ general_set_fct: $$->append($4); $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); } + | ordered_set_function + | array_aggregate_function ; set_fct_type: SQL_TOKEN_AVG @@ -2006,6 +2061,87 @@ set_fct_type: | SQL_TOKEN_INTERSECTION ; +ordered_set_function: + hypothetical_set_function + | inverse_distribution_function + ; +hypothetical_set_function: + rank_function_type '(' hypothetical_set_function_value_expression_list ')' within_group_specification + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($5); + } + | rank_function_type '(' hypothetical_set_function_value_expression_list SQL_TOKEN_BY value_exp_commalist ')' within_group_specification + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($7); + } + ; + +within_group_specification: + { + $$ = SQL_NEW_RULE; + } + | SQL_TOKEN_WITHIN SQL_TOKEN_GROUP '(' opt_order_by_clause ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +hypothetical_set_function_value_expression_list: + value_exp_commalist + ; + +inverse_distribution_function: + inverse_distribution_function_type '('inverse_distribution_function_argument ')' within_group_specification + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +inverse_distribution_function_argument: + num_value_exp + ; +inverse_distribution_function_type: + SQL_TOKEN_PERCENTILE_CONT + | SQL_TOKEN_PERCENTILE_DISC + ; + +array_aggregate_function: + SQL_TOKEN_ARRAY_AGG '(' value_exp opt_order_by_clause ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; + +rank_function_type: + SQL_TOKEN_RANK + | SQL_TOKEN_DENSE_RANK + | SQL_TOKEN_PERCENT_RANK + | SQL_TOKEN_CUME_DIST + ; outer_join_type: SQL_TOKEN_LEFT %prec SQL_TOKEN_LEFT { @@ -2051,7 +2187,7 @@ join_type: } ; cross_union: - table_ref /*[SQL_TOKEN_CROSS]*/ SQL_TOKEN_CROSS SQL_TOKEN_JOIN table_ref + table_ref SQL_TOKEN_CROSS SQL_TOKEN_JOIN table_ref { $$ = SQL_NEW_RULE; $$->append($1); @@ -2063,7 +2199,7 @@ cross_union: qualified_join: /* wenn SQL_TOKEN_NATURAL, dann keine join_spec */ - table_ref /*[SQL_TOKEN_NATURAL]*/ SQL_TOKEN_NATURAL join_type SQL_TOKEN_JOIN table_ref + table_ref SQL_TOKEN_NATURAL join_type SQL_TOKEN_JOIN table_ref { $$ = SQL_NEW_RULE; $$->append($1); @@ -2178,6 +2314,7 @@ value_exp_primary: | column_ref | set_fct_spec | scalar_subquery + | case_expression | '(' value_exp ')' { $$ = SQL_NEW_RULE; @@ -2401,83 +2538,39 @@ non_second_datetime_field: | SQL_TOKEN_HOUR | SQL_TOKEN_MINUTE ; -/*start_field: - non_second_datetime_field +start_field: + non_second_datetime_field opt_paren_precision { $$ = SQL_NEW_RULE; $$->append($1); - } - | non_second_datetime_field '(' SQL_TOKEN_INTNUM ')' - { - $$ = SQL_NEW_RULE; - $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); - $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($2); } ; end_field: non_second_datetime_field + | SQL_TOKEN_SECOND opt_paren_precision { $$ = SQL_NEW_RULE; $$->append($1); - } - | SQL_TOKEN_SECOND - { - $$ = SQL_NEW_RULE; - $$->append($1); - } - | SQL_TOKEN_SECOND '(' SQL_TOKEN_INTNUM ')' - { - $$ = SQL_NEW_RULE; - $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); - $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($2); } ; -*/ -/* + single_datetime_field: - non_second_datetime_field + non_second_datetime_field opt_paren_precision { $$ = SQL_NEW_RULE; $$->append($1); + $$->append($2); } - | non_second_datetime_field '(' SQL_TOKEN_INTNUM ')' - { - $$ = SQL_NEW_RULE; - $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); - $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); - } - | SQL_TOKEN_SECOND - { - $$ = SQL_NEW_RULE; - $$->append($1); - } - | SQL_TOKEN_SECOND '(' SQL_TOKEN_INTNUM ')' - { - $$ = SQL_NEW_RULE; - $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); - $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); - } - | SQL_TOKEN_SECOND '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' + | SQL_TOKEN_SECOND opt_paren_precision_scale { $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); - $$->append($3); - $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION)); - $$->append($5); - $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($2); } ; -*/ -/* + interval_qualifier: start_field SQL_TOKEN_TO end_field { @@ -2486,13 +2579,9 @@ interval_qualifier: $$->append($2); $$->append($3); } - | single_datetime_field - { - $$ = SQL_NEW_RULE; - $$->append($1); - } + | single_datetime_field ; -*/ + function_arg_commalist2: function_arg ',' function_arg {$$ = SQL_NEW_COMMALISTRULE; @@ -2546,6 +2635,21 @@ function_arg: $$->append($2); $$->append($3); } + | value_exp SQL_TOKEN_USING value_exp comparison value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | value_exp SQL_TOKEN_BY value_exp_commalist + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } ; function_args_commalist: function_arg @@ -2952,59 +3056,384 @@ column_val: } ; data_type: - SQL_TOKEN_CHARACTER - | SQL_TOKEN_CHARACTER '(' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + predefined_type + ; +opt_char_set_spec: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_CHARACTER SQL_TOKEN_SET SQL_TOKEN_NAME + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_NUMERIC - | SQL_TOKEN_NUMERIC '(' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + } + ; +opt_collate_clause: + {$$ = SQL_NEW_RULE;} + | collate_clause + ; +predefined_type: + character_string_type opt_char_set_spec opt_collate_clause + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_NUMERIC '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + } + | national_character_string_type opt_collate_clause + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + } + | binary_string_type + | numeric_type + | boolean_type + | datetime_type + | interval_type + ; +character_string_type: + SQL_TOKEN_CHARACTER opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_CHAR opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_CHARACTER SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); $$->append($3); - $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION)); - $$->append($5); - $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_DECIMAL - | SQL_TOKEN_DECIMAL '(' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + } + | SQL_TOKEN_CHAR SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_DECIMAL '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + } + | SQL_TOKEN_VARCHAR paren_char_length + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + } + | character_large_object_type + ; +opt_paren_precision: + {$$ = SQL_NEW_RULE;} + | paren_char_length + ; +paren_char_length: + '(' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +opt_paren_char_large_length: + {$$ = SQL_NEW_RULE;} + | paren_character_large_object_length + ; +paren_character_large_object_length: + '(' large_object_length ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; + +large_object_length: + SQL_TOKEN_INTNUM opt_multiplier + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +opt_multiplier: + {$$ = SQL_NEW_RULE;} + | 'K' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("K", SQL_NODE_PUNCTUATION)); + } + | 'M' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("M", SQL_NODE_PUNCTUATION)); + } + | 'G' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("G", SQL_NODE_PUNCTUATION)); + } + | 'T' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("T", SQL_NODE_PUNCTUATION)); + } + | 'P' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("P", SQL_NODE_PUNCTUATION)); + } + ; +character_large_object_type: + SQL_TOKEN_CHARACTER SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); $$->append($3); - $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($4); + } + | SQL_TOKEN_CHAR SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_CLOB opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +national_character_string_type: + SQL_TOKEN_NATIONAL SQL_TOKEN_CHARACTER opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_NATIONAL SQL_TOKEN_CHAR opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_NCHAR opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_NATIONAL SQL_TOKEN_CHARACTER SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_NATIONAL SQL_TOKEN_CHAR SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_NCHAR SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | national_character_large_object_type + ; +national_character_large_object_type: + SQL_TOKEN_NATIONAL SQL_TOKEN_CHARACTER SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); $$->append($5); - $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_INTEGER - | SQL_TOKEN_SMALLINT - | SQL_TOKEN_FLOAT - | SQL_TOKEN_FLOAT '(' SQL_TOKEN_INTNUM ')' - {$$ = SQL_NEW_RULE; + } + | SQL_TOKEN_NCHAR SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_NCLOB opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +binary_string_type: + SQL_TOKEN_BINARY opt_paren_precision + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_BINARY SQL_TOKEN_VARYING paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_VARBINARY paren_char_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | binary_large_object_string_type + ; +binary_large_object_string_type: + SQL_TOKEN_BINARY SQL_TOKEN_LARGE SQL_TOKEN_OBJECT opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_BLOB opt_paren_char_large_length + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +numeric_type: + exact_numeric_type + | approximate_numeric_type + ; +opt_paren_precision_scale: + {$$ = SQL_NEW_RULE;} + | '(' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +exact_numeric_type: + SQL_TOKEN_NUMERIC opt_paren_precision_scale + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_DECIMAL opt_paren_precision_scale + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_DEC opt_paren_precision_scale + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_SMALLINT + | SQL_TOKEN_INTEGER + | SQL_TOKEN_INT + | SQL_TOKEN_BIGINT + ; +approximate_numeric_type: + SQL_TOKEN_FLOAT '(' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; $$->append($1); $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); $$->append($3); - $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} - | SQL_TOKEN_REAL - | SQL_TOKEN_DOUBLE SQL_TOKEN_PRECISION - {$$ = SQL_NEW_RULE; + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_FLOAT + | SQL_TOKEN_REAL + | SQL_TOKEN_DOUBLE + | SQL_TOKEN_DOUBLE SQL_TOKEN_PRECISION + { + $$ = SQL_NEW_RULE; $$->append($1); - $$->append($2);} + $$->append($2); + } + ; +boolean_type: + SQL_TOKEN_BOOLEAN +; +datetime_type: + SQL_TOKEN_DATE + | SQL_TOKEN_TIME opt_paren_precision opt_with_or_without_time_zone + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_TIMESTAMP opt_paren_precision opt_with_or_without_time_zone + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +opt_with_or_without_time_zone: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_WITH SQL_TOKEN_TIME SQL_TOKEN_ZONE + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_WITHOUT SQL_TOKEN_TIME SQL_TOKEN_ZONE + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +interval_type: + SQL_TOKEN_INTERVAL interval_qualifier + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } ; - /* the various things you can name */ column: @@ -3028,7 +3457,141 @@ column: $$ = newNode(xxx_pGLOBAL_SQLPARSER->TokenIDToStr(nNod), SQL_NODE_NAME); } ; - +case_expression: + case_abbreviation + | case_specification + ; +case_abbreviation: + SQL_TOKEN_NULLIF '(' value_exp_commalist ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_COALESCE '(' value_exp ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_COALESCE '(' value_exp_commalist ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +case_specification: + simple_case + | searched_case + ; +simple_case: + SQL_TOKEN_CASE case_operand simple_when_clause_list else_clause SQL_TOKEN_END + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + ; +searched_case: + SQL_TOKEN_CASE searched_when_clause_list else_clause SQL_TOKEN_END + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; +simple_when_clause_list: + simple_when_clause + { + $$ = SQL_NEW_LISTRULE; + $$->append($1); + } + | searched_when_clause_list simple_when_clause + { + $1->append($2); + $$ = $1; + } + ; +simple_when_clause: + SQL_TOKEN_WHEN when_operand_list SQL_TOKEN_THEN result + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; +when_operand_list: + when_operand + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | when_operand_list ',' when_operand + {$1->append($3); + $$ = $1;} + ; +when_operand: + row_value_constructor_elem + | comparison_predicate_part_2 + | between_predicate_part_2 + | in_predicate_part_2 + | character_like_predicate_part_2 + | null_predicate_part_2 +; +searched_when_clause_list: + searched_when_clause + { + $$ = SQL_NEW_LISTRULE; + $$->append($1); + } + | searched_when_clause_list searched_when_clause + { + $1->append($2); + $$ = $1; + } + ; +searched_when_clause: + SQL_TOKEN_WHEN search_condition SQL_TOKEN_THEN result + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; +else_clause: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_ELSE result + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +result: + result_expression + | SQL_TOKEN_NULL + ; +result_expression: + value_exp + ; +case_operand: + row_value_constructor_elem + ; + cursor: SQL_TOKEN_NAME {$$ = SQL_NEW_RULE; $$->append($1);} @@ -3093,6 +3656,195 @@ sql: } | '(' sql ')' /* checking predicats */ ; +trigger_definition: + SQL_TOKEN_CREATE SQL_TOKEN_TRIGGER trigger_name trigger_action_time trigger_event SQL_TOKEN_ON table_name op_referencing triggered_action + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6); + $$->append($7); + $$->append($8); + $$->append($9); + } + ; +op_referencing: + { + $$ = SQL_NEW_RULE; + } + | SQL_TOKEN_REFERENCING transition_table_or_variable_list + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +trigger_action_time: + SQL_TOKEN_BEFORE + | SQL_TOKEN_AFTER + | SQL_TOKEN_INSTEAD SQL_TOKEN_OF + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } +; +trigger_event: + SQL_TOKEN_INSERT + | SQL_TOKEN_DELETE + | SQL_TOKEN_UPDATE op_trigger_columnlist + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +op_trigger_columnlist: + { + $$ = SQL_NEW_RULE; + } + | SQL_TOKEN_OF trigger_column_list + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +trigger_column_list: + column_commalist + ; +triggered_action: + op_triggered_action_for triggered_when_clause triggered_SQL_statement + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +op_triggered_action_for: + { + $$ = SQL_NEW_RULE; + } + | SQL_TOKEN_FOR SQL_TOKEN_EACH trigger_for + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +trigger_for: + SQL_TOKEN_ROW + | SQL_TOKEN_STATEMENT + ; +triggered_when_clause: + { + $$ = SQL_NEW_RULE; + } + | SQL_TOKEN_WHEN parenthesized_boolean_value_expression + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +triggered_SQL_statement: + SQL_procedure_statement + | SQL_TOKEN_BEGIN SQL_TOKEN_ATOMIC SQL_procedure_statement_list ';' SQL_TOKEN_END + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4 = newNode(";", SQL_NODE_PUNCTUATION)); + $$->append($5); + } + ; +SQL_procedure_statement_list: + SQL_procedure_statement + { + $$ = SQL_NEW_LISTRULE; + $$->append($1); + } + | SQL_procedure_statement_list ';' SQL_procedure_statement + { + $1->append($3); + $$ = $1; + } + ; +SQL_procedure_statement: + sql + ; + +transition_table_or_variable_list: + transition_table_or_variable + { + $$ = SQL_NEW_LISTRULE; + $$->append($1); + } + | transition_table_or_variable_list transition_table_or_variable + { + $1->append($2); + $$ = $1; + } + ; + +transition_table_or_variable: + SQL_TOKEN_OLD opt_row opt_as old_transition_variable_name + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_NEW opt_row opt_as new_transition_variable_name + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_OLD SQL_TOKEN_TABLE opt_as old_transition_table_name + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_NEW SQL_TOKEN_TABLE opt_as new_transition_table_name + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } +; +old_transition_table_name: + transition_table_name +; +new_transition_table_name: + transition_table_name +; +transition_table_name: + SQL_TOKEN_NAME +; +old_transition_variable_name: + SQL_TOKEN_NAME +; +new_transition_variable_name: + SQL_TOKEN_NAME +; +trigger_name: + SQL_TOKEN_NAME +; %% @@ -3507,7 +4259,7 @@ sal_Int16 OSQLParser::buildNode(OSQLParseNode*& pAppend,OSQLParseNode* pCompare, pColumnRef->append(new OSQLInternalNode(m_sFieldName,SQL_NODE_NAME)); OSQLParseNode* pComp = NULL; if ( SQL_ISTOKEN( pCompare, BETWEEN) && pLiteral2 ) - pComp = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::between_predicate)); + pComp = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::between_predicate_part_2)); else pComp = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::comparison_predicate)); diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index 275bd5b34619..c6723dfd6869 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -86,15 +86,11 @@ OSQLScanner* xxx_pGLOBAL_SQLSCAN = NULL; SQLyylval.pParseNode = new OSQLInternalNode(text, token); #define SQL_NEW_KEYWORD(token) \ - SQLyylval.pParseNode = new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, (token)); + SQLyylval.pParseNode = new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, (token)); return token; -#define SQL_NEW_NAME SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_NAME) -#define SQL_NEW_INTNUM SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_INTNUM) -#define SQL_NEW_APPROXNUM SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_APPROXNUM) -#define SQL_NEW_STRING SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_STRING) -#define SQL_NEW_COMPARISON SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_COMPARISON) -#define SQL_NEW_AMMSC SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_AMMSC) -#define SQL_NEW_DATE SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_ACCESS_DATE) +#define SQL_NEW_INTNUM SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_INTNUM); return SQL_TOKEN_INTNUM; +#define SQL_NEW_APPROXNUM SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_APPROXNUM); return SQL_TOKEN_APPROXNUM; +#define SQL_NEW_DATE SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_ACCESS_DATE); return SQL_TOKEN_ACCESS_DATE; #define YY_INPUT(buf,result,max_size) \ { \ @@ -122,231 +118,280 @@ OSQLScanner* xxx_pGLOBAL_SQLSCAN = NULL; %option never-interactive %% -[Aa][Bb][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_ABS); return SQL_TOKEN_ABS; } -[Aa][Cc][Oo][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_ACOS); return SQL_TOKEN_ACOS; } -[Aa][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_ALL); return SQL_TOKEN_ALL; } -[Aa][Ll][Tt][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_ALTER); return SQL_TOKEN_ALTER; } -[Aa][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_AND); return SQL_TOKEN_AND; } -[Aa][Nn][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_ANY); return SQL_TOKEN_ANY; } -[Aa][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_AS); return SQL_TOKEN_AS; } -[Aa][Ss][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_ASC); return SQL_TOKEN_ASC; } -[Aa][Ss][Cc][Ii][Ii] {SQL_NEW_KEYWORD(SQL_TOKEN_ASCII); return SQL_TOKEN_ASCII; } -[Aa][Ss][Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_ASIN); return SQL_TOKEN_ASIN; } -[Aa][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_AT); return SQL_TOKEN_AT; } -[Aa][Tt][Aa][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_ATAN); return SQL_TOKEN_ATAN; } -[Aa][Tt][Aa][Nn]2 {SQL_NEW_KEYWORD(SQL_TOKEN_ATAN2); return SQL_TOKEN_ATAN2; } -[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_AUTHORIZATION); return SQL_TOKEN_AUTHORIZATION; } -[Aa][Vv][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_AVG); return SQL_TOKEN_AVG; } - -[Bb][Ee][Tt][Ww][Ee][Ee][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_BETWEEN); return SQL_TOKEN_BETWEEN; } -[Bb][Ii][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_BIT); return SQL_TOKEN_BIT; } -[Bb][Ii][Tt]_[Ll][Ee][Nn][Gg][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_BIT_LENGTH); return SQL_TOKEN_BIT_LENGTH; } -[Bb][Oo][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_BOTH); return SQL_TOKEN_BOTH; } -[Bb][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_BY); return SQL_TOKEN_BY; } - -[Cc][Aa][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_CALL); return SQL_TOKEN_CALL; } -[Cc][Aa][Ss][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_CAST); return SQL_TOKEN_CAST; } -[Cc][Hh][Aa][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_CHAR); return SQL_TOKEN_CHAR; } -[Cc][Hh][Aa][Rr][Aa][Cc][Tt][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_CHARACTER); return SQL_TOKEN_CHARACTER; } -[Cc][Hh][Aa][Rr]([Aa][Cc][Tt][Ee][Rr])?_[Ll][Ee][Nn][Gg][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_CHAR_LENGTH); return SQL_TOKEN_CHAR_LENGTH; } -[Cc][Hh][Ee][Cc][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_CHECK); return SQL_TOKEN_CHECK; } -[Cc][Ee][Ii][Ll][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_CEILING); return SQL_TOKEN_CEILING; } -[Cc][Oo][Ll][Ll][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_COLLATE); return SQL_TOKEN_COLLATE; } -COLLECT {SQL_NEW_KEYWORD(SQL_TOKEN_COLLECT); return SQL_TOKEN_COLLECT; } -[Cc][Oo][Mm][Mm][Ii][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_COMMIT); return SQL_TOKEN_COMMIT; } -[Cc][Oo][Nn][Cc][Aa][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_CONCAT); return SQL_TOKEN_CONCAT; } -[Cc][Oo][Nn][Tt][Ii][Nn][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CONTINUE); return SQL_TOKEN_CONTINUE; } -[Cc][Oo][Nn][Vv][Ee][Rr][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_CONVERT); return SQL_TOKEN_CONVERT; } -[Cc][Oo][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_COS); return SQL_TOKEN_COS; } -[Cc][Oo][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_COT); return SQL_TOKEN_COT; } -[Cc][Oo][Uu][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_COUNT); return SQL_TOKEN_COUNT; } -[Cc][Rr][Ee][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CREATE); return SQL_TOKEN_CREATE; } -[Cc][Rr][Oo][Ss][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_CROSS); return SQL_TOKEN_CROSS; } -[Cc][Uu][Rr][Rr][Ee][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT); return SQL_TOKEN_CURRENT; } -[Cc][Uu][Rr][Rr][Ee][Nn][Tt]_[Dd][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_DATE); return SQL_TOKEN_CURRENT_DATE; } -[Cc][Uu][Rr][Dd][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CURDATE); return SQL_TOKEN_CURDATE; } -[Cc][Uu][Rr][Rr][Ee][Nn][Tt]_[Tt][Ii][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIME); return SQL_TOKEN_CURRENT_TIME; } -[Cc][Uu][Rr][Tt][Ii][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CURTIME); return SQL_TOKEN_CURTIME; } -[Cc][Uu][Rr][Rr][Ee][Nn][Tt]_[Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIMESTAMP); return SQL_TOKEN_CURRENT_TIMESTAMP; } -[Cc][Uu][Rr][Ss][Oo][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_CURSOR); return SQL_TOKEN_CURSOR; } - -[Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_D); return SQL_TOKEN_D; } -[Dd][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DATE); return SQL_TOKEN_DATE; } -[Dd][Aa][Tt][Ee][Dd][Ii][Ff][Ff] {SQL_NEW_KEYWORD(SQL_TOKEN_DATEDIFF); return SQL_TOKEN_DATEDIFF; } -[Dd][Aa][Tt][Ee][Vv][Aa][Ll][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DATEVALUE); return SQL_TOKEN_DATEVALUE; } -[Dd][Aa][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_DAY); return SQL_TOKEN_DAY; } -[Dd][Aa][Yy][Nn][Aa][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DAYNAME); return SQL_TOKEN_DAYNAME; } -[Dd][Aa][Yy][Oo][Ff][Mm][Oo][Nn][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFMONTH); return SQL_TOKEN_DAYOFMONTH; } -[Dd][Aa][Yy][Oo][Ff][Ww][Ee][Ee][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFWEEK); return SQL_TOKEN_DAYOFWEEK; } -[Dd][Aa][Yy][Oo][Ff][Yy][Ee][Aa][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFYEAR); return SQL_TOKEN_DAYOFYEAR; } -[Dd][Ee][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_DEC); return SQL_TOKEN_DEC; } -[Dd][Ee][Cc][Ii][Mm][Aa][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_DECIMAL); return SQL_TOKEN_DECIMAL; } -[Dd][Ee][Cc][Ll][Aa][Rr][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DECLARE); return SQL_TOKEN_DECLARE; } -[Dd][Ee][Ff][Aa][Uu][Ll][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_DEFAULT); return SQL_TOKEN_DEFAULT; } -[Dd][Ee][Gg][Rr][Ee][Ee][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_DEGREES); return SQL_TOKEN_DEGREES; } -[Dd][Ee][Ll][Ee][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DELETE); return SQL_TOKEN_DELETE; } -[Dd][Ee][Ss][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_DESC); return SQL_TOKEN_DESC; } -[Dd][Ii][Ff][Ff][Ee][Rr][Ee][Nn][Cc][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DIFFERENCE); return SQL_TOKEN_DIFFERENCE; } -[Dd][Ii][Ss][Tt][Ii][Nn][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_DISTINCT); return SQL_TOKEN_DISTINCT; } -[Dd][Oo][Uu][Bb][Ll][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DOUBLE); return SQL_TOKEN_DOUBLE; } -[Dd][Rr][Oo][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_DROP); return SQL_TOKEN_DROP; } - -EVERY {SQL_NEW_KEYWORD(SQL_TOKEN_EVERY); return SQL_TOKEN_EVERY; } -[Ee][Ss][Cc][Aa][Pp][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_ESCAPE); return SQL_TOKEN_ESCAPE; } -[Ee][Xx][Cc][Ee][Pp][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_EXCEPT); return SQL_TOKEN_EXCEPT; } -[Ee][Xx][Ii][Ss][Tt][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_EXISTS); return SQL_TOKEN_EXISTS; } -[Ee][Xx][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_EXP); return SQL_TOKEN_EXP; } -[Ee][Xx][Tt][Rr][Aa][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_EXTRACT); return SQL_TOKEN_EXTRACT; } - -[Ff][Aa][Ll][Ss][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_FALSE); return SQL_TOKEN_FALSE; } -[Ff][Ee][Tt][Cc][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_FETCH); return SQL_TOKEN_FETCH; } -[Ff][Ll][Oo][Aa][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_FLOAT); return SQL_TOKEN_FLOAT; } -[Ff][Ll][Oo][Oo][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_FLOOR); return SQL_TOKEN_FLOOR; } -[Ff][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_FN); return SQL_TOKEN_FN; } -[Ff][Oo][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_FOR); return SQL_TOKEN_FOR; } -[Ff][Oo][Rr][Ee][Ii][Gg][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_FOREIGN); return SQL_TOKEN_FOREIGN; } -[Ff][Oo][Uu][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_FOUND); return SQL_TOKEN_FOUND; } -[Ff][Rr][Oo][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_FROM); return SQL_TOKEN_FROM; } -[Ff][Uu][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_FULL); return SQL_TOKEN_FULL; } -FUSION {SQL_NEW_KEYWORD(SQL_TOKEN_FUSION); return SQL_TOKEN_FUSION; } - -[Gg][Rr][Aa][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_GRANT); return SQL_TOKEN_GRANT; } -[Gg][Rr][Oo][Uu][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_GROUP); return SQL_TOKEN_GROUP; } - -[Hh][Aa][Vv][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_HAVING); return SQL_TOKEN_HAVING; } -[Hh][Oo][Uu][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_HOUR); return SQL_TOKEN_HOUR; } - -[Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_IN); return SQL_TOKEN_IN; } -[Ii][Nn][Nn][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_INNER); return SQL_TOKEN_INNER; } -[Ii][Nn][Ss][Ee][Rr][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_INSERT); return SQL_TOKEN_INSERT; } -[Ii][Nn][Tt]([Ee][Gg][Ee][Rr])? {SQL_NEW_KEYWORD(SQL_TOKEN_INTEGER); return SQL_TOKEN_INTEGER; } -[Ii][Nn][Tt][Ee][Rr][Ss][Ee][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_INTERSECT); return SQL_TOKEN_INTERSECT; } -INTERSECTION {SQL_NEW_KEYWORD(SQL_TOKEN_INTERSECTION); return SQL_TOKEN_INTERSECTION; } -[Ii][Nn][Tt][Oo] {SQL_NEW_KEYWORD(SQL_TOKEN_INTO); return SQL_TOKEN_INTO; } -[Ii][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_IS); return SQL_TOKEN_IS; } - -[Jj][Oo][Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_JOIN); return SQL_TOKEN_JOIN; } - -[Kk][Ee][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_KEY); return SQL_TOKEN_KEY; } - -[Ll][Cc][Aa][Ss][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_LCASE); return SQL_TOKEN_LCASE; } -[Ll][Ee][Aa][Dd][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_LEADING); return SQL_TOKEN_LEADING; } -[Ll][Ee][Ff][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_LEFT); return SQL_TOKEN_LEFT; } -[Ll][Ee][Nn][Gg][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_LENGTH); return SQL_TOKEN_LENGTH; } -[Ll][Ii][Kk][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_LIKE); return SQL_TOKEN_LIKE; } -[Ll][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_LN); return SQL_TOKEN_LN; } -[Ll][Oo][Cc][Aa][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_LOCAL); return SQL_TOKEN_LOCAL; } -[Ll][Oo][Cc][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_LOCATE); return SQL_TOKEN_LOCATE; } -[Ll][Oo][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_LOG); return SQL_TOKEN_LOG; } -[Ll][Oo][Gg][Ff] {SQL_NEW_KEYWORD(SQL_TOKEN_LOGF); return SQL_TOKEN_LOGF; } -[Ll][Oo][Gg]10 {SQL_NEW_KEYWORD(SQL_TOKEN_LOG10); return SQL_TOKEN_LOG10; } -[Ll][Oo][Ww][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_LOWER); return SQL_TOKEN_LOWER; } -[Ll][Tt][Rr][Ii][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_LTRIM); return SQL_TOKEN_LTRIM; } - -[Mm][Aa][Xx] {SQL_NEW_KEYWORD(SQL_TOKEN_MAX); return SQL_TOKEN_MAX; } -[Mm][Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_MIN); return SQL_TOKEN_MIN; } -[Mm][Ii][Nn][Uu][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_MINUTE); return SQL_TOKEN_MINUTE; } -[Mm][Oo][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_MOD); return SQL_TOKEN_MOD; } -[Mm][Oo][Nn][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_MONTH); return SQL_TOKEN_MONTH; } -[Mm][Oo][Nn][Tt][Hh][Nn][Aa][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_MONTHNAME); return SQL_TOKEN_MONTHNAME; } - -[Nn][Aa][Tt][Uu][Rr][Aa][LL] {SQL_NEW_KEYWORD(SQL_TOKEN_NATURAL); return SQL_TOKEN_NATURAL; } -[Nn][Cc][Hh][Aa][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_NCHAR); return SQL_TOKEN_NCHAR; } -[Nn][Oo][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_NOT); return SQL_TOKEN_NOT; } -[Nn][Oo][Ww] {SQL_NEW_KEYWORD(SQL_TOKEN_NOW); return SQL_TOKEN_NOW; } -[Nn][Uu][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_NULL); return SQL_TOKEN_NULL; } -[Nn][Uu][Mm][Ee][Rr][Ii][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_NUMERIC); return SQL_TOKEN_NUMERIC; } - -[Oo][Cc][Tt][Ee][Tt]_[Ll][Ee][Nn][Gg][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_OCTET_LENGTH); return SQL_TOKEN_OCTET_LENGTH; } -[Oo][Ff] {SQL_NEW_KEYWORD(SQL_TOKEN_OF); return SQL_TOKEN_OF; } -[Oo][Jj] {SQL_NEW_KEYWORD(SQL_TOKEN_OJ); return SQL_TOKEN_OJ; } -[Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_ON); return SQL_TOKEN_ON; } -[Oo][Pp][Tt][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_OPTION); return SQL_TOKEN_OPTION; } -[Oo][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_OR); return SQL_TOKEN_OR; } -[Oo][Rr][Dd][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_ORDER); return SQL_TOKEN_ORDER; } -[Oo][Uu][Tt][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_OUTER); return SQL_TOKEN_OUTER; } - -[Pp][Ii] {SQL_NEW_KEYWORD(SQL_TOKEN_PI); return SQL_TOKEN_PI; } -[Pp][Oo][Ss][Ii][Tt][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_POSITION); return SQL_TOKEN_POSITION; } -[Pp][Oo][Ww][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_POWER); return SQL_TOKEN_POWER; } -[Pp][Rr][Ee][Cc][Ii][Ss][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_PRECISION); return SQL_TOKEN_PRECISION; } -[Pp][Rr][Ii][Mm][Aa][Rr][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_PRIMARY); return SQL_TOKEN_PRIMARY; } -[Pp][Rr][Ii][Vv][Ii][Ll][Ee][Gg][Ee][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_PRIVILEGES); return SQL_TOKEN_PRIVILEGES; } -[Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_PROCEDURE); return SQL_TOKEN_PROCEDURE; } -[Pp][Uu][Bb][Ll][Ii][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_PUBLIC); return SQL_TOKEN_PUBLIC; } - -[Qq][Uu][Aa][Rr][Tt][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_QUARTER); return SQL_TOKEN_QUARTER; } - -[Rr][Aa][Dd][Ii][Aa][Nn][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_RADIANS); return SQL_TOKEN_RADIANS; } -[Rr][Aa][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_RAND); return SQL_TOKEN_RAND; } -[Rr][Ee][Aa][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_REAL); return SQL_TOKEN_REAL; } -[Rr][Ee][Ff][Ee][Rr][Ee][Nn][Cc][Ee][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCES); return SQL_TOKEN_REFERENCES; } -[Rr][Ee][Pp][Ee][Aa][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_REPEAT); return SQL_TOKEN_REPEAT; } -[Rr][Ee][Pp][Ll][Aa][Cc][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_REPLACE); return SQL_TOKEN_REPLACE; } -[Rr][Oo][Ll][Ll][Bb][Aa][Cc][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_ROLLBACK); return SQL_TOKEN_ROLLBACK; } -[Rr][Oo][Uu][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_ROUND); return SQL_TOKEN_ROUND; } -[Rr][Oo][Uu][Nn][Dd][Mm][Aa][Gg][Ii][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_ROUNDMAGIC); return SQL_TOKEN_ROUNDMAGIC; } -[Rr][Ii][Gg][Hh][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_RIGHT); return SQL_TOKEN_RIGHT; } -[Rr][Tt][Rr][Ii][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_RTRIM); return SQL_TOKEN_RTRIM; } - -[Ss][Cc][Hh][Ee][Mm][Aa] {SQL_NEW_KEYWORD(SQL_TOKEN_SCHEMA); return SQL_TOKEN_SCHEMA; } -[Ss][Ee][Cc][Oo][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_SECOND); return SQL_TOKEN_SECOND; } -[Ss][Ee][Ll][Ee][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_SELECT); return SQL_TOKEN_SELECT; } -[Ss][Ee][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_SET); return SQL_TOKEN_SET; } -[Ss][Ii][Zz][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_SIZE); return SQL_TOKEN_SIZE; } -[Ss][Ii][Gg][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_SIGN); return SQL_TOKEN_SIGN; } -[Ss][Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_SIN); return SQL_TOKEN_SIN; } -[Ss][Mm][Aa][Ll][Ll][Ii][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_SMALLINT); return SQL_TOKEN_SMALLINT; } -[Ss][Oo][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_SOME); return SQL_TOKEN_SOME; } -[Ss][Oo][Uu][Nn][Dd][Ee][Xx] {SQL_NEW_KEYWORD(SQL_TOKEN_SOUNDEX); return SQL_TOKEN_SOUNDEX; } -[Ss][Pp][Aa][Cc][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_SPACE); return SQL_TOKEN_SPACE; } -[Ss][Qq][Rr][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_SQRT); return SQL_TOKEN_SQRT; } -STDDEV_POP {SQL_NEW_KEYWORD(SQL_TOKEN_STDDEV_POP); return SQL_TOKEN_STDDEV_POP; } -STDDEV_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_STDDEV_SAMP); return SQL_TOKEN_STDDEV_SAMP; } -[Ss][Uu][Bb][Ss][Tt][Rr][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_SUBSTRING); return SQL_TOKEN_SUBSTRING; } -[Ss][Uu][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_SUM); return SQL_TOKEN_SUM; } - -[Tt][Aa][Bb][Ll][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TABLE); return SQL_TOKEN_TABLE; } -[Tt][Aa][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_TAN); return SQL_TOKEN_TAN; } -[Tt][Ii][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TIME); return SQL_TOKEN_TIME; } -[Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMP); return SQL_TOKEN_TIMESTAMP; } -[Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp][Aa][Dd][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPADD); return SQL_TOKEN_TIMESTAMPADD; } -[Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp][Dd][Ii][Ff][Ff] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPDIFF); return SQL_TOKEN_TIMESTAMPDIFF; } -[Tt][Ii][Mm][Ee][Vv][Aa][Ll][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEVALUE); return SQL_TOKEN_TIMEVALUE; } -[Tt][Ii][Mm][Ee][Zz][Oo][Nn][Ee]_[Hh][Oo][Uu][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_HOUR); return SQL_TOKEN_TIMEZONE_HOUR; } -[Tt][Ii][Mm][Ee][Zz][Oo][Nn][Ee]_[Mm][Ii][Nn][Uu][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_MINUTE); return SQL_TOKEN_TIMEZONE_MINUTE; } -[Tt][Oo] {SQL_NEW_KEYWORD(SQL_TOKEN_TO); return SQL_TOKEN_TO; } -[Tt][Rr][Aa][Ii][Ll][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_TRAILING); return SQL_TOKEN_TRAILING; } -[Tt][Rr][Aa][Nn][Ss][Ll][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TRANSLATE); return SQL_TOKEN_TRANSLATE; } -[Tt][Rr][Ii][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_TRIM); return SQL_TOKEN_TRIM; } -[Tt][Rr][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TRUE); return SQL_TOKEN_TRUE; } -[Tt][Rr][Uu][Nn][Cc][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TRUNCATE); return SQL_TOKEN_TRUNCATE; } -[Tt][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_TS); return SQL_TOKEN_TS; } -[Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_T); return SQL_TOKEN_T; } - -[Uu][Cc][Aa][Ss][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_UCASE); return SQL_TOKEN_UCASE; } -[Uu][Nn][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_UNION); return SQL_TOKEN_UNION; } -[Uu][Nn][Ii][Qq][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_UNIQUE); return SQL_TOKEN_UNIQUE; } -[Uu][Nn][Kk][Nn][Oo][Ww][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_UNKNOWN); return SQL_TOKEN_UNKNOWN; } -[Uu][Pp][Dd][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_UPDATE); return SQL_TOKEN_UPDATE; } -[Uu][Pp][Pp][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_UPPER); return SQL_TOKEN_UPPER; } -[Uu][Ss][Aa][Gg][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_USAGE); return SQL_TOKEN_USAGE; } -[Uu][Ss][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_USER); return SQL_TOKEN_USER; } -[Uu][Ss][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_USING); return SQL_TOKEN_USING; } - -VAR_POP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_POP); return SQL_TOKEN_VAR_POP; } -VAR_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_SAMP); return SQL_TOKEN_VAR_SAMP; } -[Vv][Aa][Ll][Uu][Ee][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_VALUES); return SQL_TOKEN_VALUES; } -[Vv][Ii][Ee][Ww] {SQL_NEW_KEYWORD(SQL_TOKEN_VIEW); return SQL_TOKEN_VIEW; } - -[Ww][Ee][Ee][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_WEEK); return SQL_TOKEN_WEEK; } -[Ww][Hh][Ee][Rr][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_WHERE); return SQL_TOKEN_WHERE; } -[Ww][Ii][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_WITH); return SQL_TOKEN_WITH; } -[Ww][Oo][Rr][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_WORK); return SQL_TOKEN_WORK; } - -[Yy][Ee][Aa][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_YEAR); return SQL_TOKEN_YEAR; } - -[Zz][Oo][Nn][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_ZONE); return SQL_TOKEN_ZONE; } +ABS {SQL_NEW_KEYWORD(SQL_TOKEN_ABS); } +ACOS {SQL_NEW_KEYWORD(SQL_TOKEN_ACOS); } +AFTER {SQL_NEW_KEYWORD(SQL_TOKEN_AFTER); } +ALL {SQL_NEW_KEYWORD(SQL_TOKEN_ALL); } +ALTER {SQL_NEW_KEYWORD(SQL_TOKEN_ALTER); } +AND {SQL_NEW_KEYWORD(SQL_TOKEN_AND); } +ANY {SQL_NEW_KEYWORD(SQL_TOKEN_ANY); } +ARRAY_AGG {SQL_NEW_KEYWORD(SQL_TOKEN_ARRAY_AGG); } +AS {SQL_NEW_KEYWORD(SQL_TOKEN_AS); } +ASC {SQL_NEW_KEYWORD(SQL_TOKEN_ASC); } +ASCII {SQL_NEW_KEYWORD(SQL_TOKEN_ASCII); } +ASIN {SQL_NEW_KEYWORD(SQL_TOKEN_ASIN); } +AT {SQL_NEW_KEYWORD(SQL_TOKEN_AT); } +ATAN {SQL_NEW_KEYWORD(SQL_TOKEN_ATAN); } +ATAN2 {SQL_NEW_KEYWORD(SQL_TOKEN_ATAN2); } +ATOMIC {SQL_NEW_KEYWORD(SQL_TOKEN_ATOMIC); } +AUTHORIZATION {SQL_NEW_KEYWORD(SQL_TOKEN_AUTHORIZATION); } +AVG {SQL_NEW_KEYWORD(SQL_TOKEN_AVG); } + +BEFORE {SQL_NEW_KEYWORD(SQL_TOKEN_BEFORE); } +BEGIN {SQL_NEW_KEYWORD(SQL_TOKEN_BEGIN); } +BETWEEN {SQL_NEW_KEYWORD(SQL_TOKEN_BETWEEN); } +BIGINT {SQL_NEW_KEYWORD(SQL_TOKEN_BIGINT); } +BINARY {SQL_NEW_KEYWORD(SQL_TOKEN_BINARY); } +BIT {SQL_NEW_KEYWORD(SQL_TOKEN_BIT); } +BIT_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_BIT_LENGTH); } +BLOB {SQL_NEW_KEYWORD(SQL_TOKEN_BLOB); } +BOTH {SQL_NEW_KEYWORD(SQL_TOKEN_BOTH); } +BY {SQL_NEW_KEYWORD(SQL_TOKEN_BY); } + +CALL {SQL_NEW_KEYWORD(SQL_TOKEN_CALL); } +CASE {SQL_NEW_KEYWORD(SQL_TOKEN_CASE); } +CAST {SQL_NEW_KEYWORD(SQL_TOKEN_CAST); } +CEILING {SQL_NEW_KEYWORD(SQL_TOKEN_CEILING); } +CHAR {SQL_NEW_KEYWORD(SQL_TOKEN_CHAR); } +CHARACTER {SQL_NEW_KEYWORD(SQL_TOKEN_CHARACTER); } +CHAR(ACTER)?_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_CHAR_LENGTH); } +CHECK {SQL_NEW_KEYWORD(SQL_TOKEN_CHECK); } +CLOB {SQL_NEW_KEYWORD(SQL_TOKEN_CLOB); } +COALESCE {SQL_NEW_KEYWORD(SQL_TOKEN_COALESCE); } +COLLATE {SQL_NEW_KEYWORD(SQL_TOKEN_COLLATE); } +COLLECT {SQL_NEW_KEYWORD(SQL_TOKEN_COLLECT); } +COMMIT {SQL_NEW_KEYWORD(SQL_TOKEN_COMMIT); } +CONCAT {SQL_NEW_KEYWORD(SQL_TOKEN_CONCAT); } +CONTINUE {SQL_NEW_KEYWORD(SQL_TOKEN_CONTINUE); } +CONVERT {SQL_NEW_KEYWORD(SQL_TOKEN_CONVERT); } +COS {SQL_NEW_KEYWORD(SQL_TOKEN_COS); } +COT {SQL_NEW_KEYWORD(SQL_TOKEN_COT); } +COUNT {SQL_NEW_KEYWORD(SQL_TOKEN_COUNT); } +CREATE {SQL_NEW_KEYWORD(SQL_TOKEN_CREATE); } +CROSS {SQL_NEW_KEYWORD(SQL_TOKEN_CROSS); } +CUME_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_CUME_DIST); } +CURRENT {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT); } +CURRENT_DATE {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_DATE); } +CURRENT_CATALOG {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_CATALOG); } +CURRENT_DEFAULT_TRANSFORM_GROUP {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_DEFAULT_TRANSFORM_GROUP); } +CURRENT_PATH {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_PATH); } +CURRENT_ROLE {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_ROLE); } +CURRENT_SCHEMA {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_SCHEMA); } +CURRENT_USER {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_USER); } +CURDATE {SQL_NEW_KEYWORD(SQL_TOKEN_CURDATE); } +CURRENT_TIME {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIME); } +CURTIME {SQL_NEW_KEYWORD(SQL_TOKEN_CURTIME); } +CURRENT_TIMESTAMP {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIMESTAMP); } +CURSOR {SQL_NEW_KEYWORD(SQL_TOKEN_CURSOR); } + +D {SQL_NEW_KEYWORD(SQL_TOKEN_D); } +DATE {SQL_NEW_KEYWORD(SQL_TOKEN_DATE); } +DATEDIFF {SQL_NEW_KEYWORD(SQL_TOKEN_DATEDIFF); } +DATEVALUE {SQL_NEW_KEYWORD(SQL_TOKEN_DATEVALUE); } +DAY {SQL_NEW_KEYWORD(SQL_TOKEN_DAY); } +DAYNAME {SQL_NEW_KEYWORD(SQL_TOKEN_DAYNAME); } +DAYOFMONTH {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFMONTH); } +DAYOFWEEK {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFWEEK); } +DAYOFYEAR {SQL_NEW_KEYWORD(SQL_TOKEN_DAYOFYEAR); } +DEC {SQL_NEW_KEYWORD(SQL_TOKEN_DEC); } +DECIMAL {SQL_NEW_KEYWORD(SQL_TOKEN_DECIMAL); } +DECLARE {SQL_NEW_KEYWORD(SQL_TOKEN_DECLARE); } +DEFAULT {SQL_NEW_KEYWORD(SQL_TOKEN_DEFAULT); } +DEGREES {SQL_NEW_KEYWORD(SQL_TOKEN_DEGREES); } +DELETE {SQL_NEW_KEYWORD(SQL_TOKEN_DELETE); } +DENSE_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_DENSE_RANK); } +DESC {SQL_NEW_KEYWORD(SQL_TOKEN_DESC); } +DIFFERENCE {SQL_NEW_KEYWORD(SQL_TOKEN_DIFFERENCE); } +DISTINCT {SQL_NEW_KEYWORD(SQL_TOKEN_DISTINCT); } +DOUBLE {SQL_NEW_KEYWORD(SQL_TOKEN_DOUBLE); } +DROP {SQL_NEW_KEYWORD(SQL_TOKEN_DROP); } + +EACH {SQL_NEW_KEYWORD(SQL_TOKEN_EACH); } +ELSE {SQL_NEW_KEYWORD(SQL_TOKEN_ELSE); } +END {SQL_NEW_KEYWORD(SQL_TOKEN_END); } +EVERY {SQL_NEW_KEYWORD(SQL_TOKEN_EVERY); } +ESCAPE {SQL_NEW_KEYWORD(SQL_TOKEN_ESCAPE); } +EXCEPT {SQL_NEW_KEYWORD(SQL_TOKEN_EXCEPT); } +EXISTS {SQL_NEW_KEYWORD(SQL_TOKEN_EXISTS); } +EXP {SQL_NEW_KEYWORD(SQL_TOKEN_EXP); } +EXTRACT {SQL_NEW_KEYWORD(SQL_TOKEN_EXTRACT); } + +FALSE {SQL_NEW_KEYWORD(SQL_TOKEN_FALSE); } +FETCH {SQL_NEW_KEYWORD(SQL_TOKEN_FETCH); } +FLOAT {SQL_NEW_KEYWORD(SQL_TOKEN_FLOAT); } +FLOOR {SQL_NEW_KEYWORD(SQL_TOKEN_FLOOR); } +FN {SQL_NEW_KEYWORD(SQL_TOKEN_FN); } +FOR {SQL_NEW_KEYWORD(SQL_TOKEN_FOR); } +FOREIGN {SQL_NEW_KEYWORD(SQL_TOKEN_FOREIGN); } +FOUND {SQL_NEW_KEYWORD(SQL_TOKEN_FOUND); } +FROM {SQL_NEW_KEYWORD(SQL_TOKEN_FROM); } +FULL {SQL_NEW_KEYWORD(SQL_TOKEN_FULL); } +FUSION {SQL_NEW_KEYWORD(SQL_TOKEN_FUSION); } + +GRANT {SQL_NEW_KEYWORD(SQL_TOKEN_GRANT); } +GROUP {SQL_NEW_KEYWORD(SQL_TOKEN_GROUP); } + +HAVING {SQL_NEW_KEYWORD(SQL_TOKEN_HAVING); } +HOUR {SQL_NEW_KEYWORD(SQL_TOKEN_HOUR); } + +IN {SQL_NEW_KEYWORD(SQL_TOKEN_IN); } +INNER {SQL_NEW_KEYWORD(SQL_TOKEN_INNER); } +INSERT {SQL_NEW_KEYWORD(SQL_TOKEN_INSERT); } +INSTEAD {SQL_NEW_KEYWORD(SQL_TOKEN_INSTEAD); } +INT(EGER)? {SQL_NEW_KEYWORD(SQL_TOKEN_INTEGER); } +INTERSECT {SQL_NEW_KEYWORD(SQL_TOKEN_INTERSECT); } +INTERVAL {SQL_NEW_KEYWORD(SQL_TOKEN_INTERVAL); } +INTERSECTION {SQL_NEW_KEYWORD(SQL_TOKEN_INTERSECTION); } +INTO {SQL_NEW_KEYWORD(SQL_TOKEN_INTO); } +IS {SQL_NEW_KEYWORD(SQL_TOKEN_IS); } + +JOIN {SQL_NEW_KEYWORD(SQL_TOKEN_JOIN); } + +KEY {SQL_NEW_KEYWORD(SQL_TOKEN_KEY); } + +LARGE {SQL_NEW_KEYWORD(SQL_TOKEN_LARGE); } +LCASE {SQL_NEW_KEYWORD(SQL_TOKEN_LCASE); } +LEADING {SQL_NEW_KEYWORD(SQL_TOKEN_LEADING); } +LEFT {SQL_NEW_KEYWORD(SQL_TOKEN_LEFT); } +LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_LENGTH); } +LIKE {SQL_NEW_KEYWORD(SQL_TOKEN_LIKE); } +LN {SQL_NEW_KEYWORD(SQL_TOKEN_LN); } +LOCAL {SQL_NEW_KEYWORD(SQL_TOKEN_LOCAL); } +LOCATE {SQL_NEW_KEYWORD(SQL_TOKEN_LOCATE); } +LOG {SQL_NEW_KEYWORD(SQL_TOKEN_LOG); } +LOGF {SQL_NEW_KEYWORD(SQL_TOKEN_LOGF); } +LOG10 {SQL_NEW_KEYWORD(SQL_TOKEN_LOG10); } +LOWER {SQL_NEW_KEYWORD(SQL_TOKEN_LOWER); } +LTRIM {SQL_NEW_KEYWORD(SQL_TOKEN_LTRIM); } + +MAX {SQL_NEW_KEYWORD(SQL_TOKEN_MAX); } +MIN {SQL_NEW_KEYWORD(SQL_TOKEN_MIN); } +MINUTE {SQL_NEW_KEYWORD(SQL_TOKEN_MINUTE); } +MOD {SQL_NEW_KEYWORD(SQL_TOKEN_MOD); } +MONTH {SQL_NEW_KEYWORD(SQL_TOKEN_MONTH); } +MONTHNAME {SQL_NEW_KEYWORD(SQL_TOKEN_MONTHNAME); } + +NATIONAL {SQL_NEW_KEYWORD(SQL_TOKEN_NATIONAL); } +NATURAL {SQL_NEW_KEYWORD(SQL_TOKEN_NATURAL); } +NCHAR {SQL_NEW_KEYWORD(SQL_TOKEN_NCHAR); } +NCLOB {SQL_NEW_KEYWORD(SQL_TOKEN_NCLOB); } +NEW {SQL_NEW_KEYWORD(SQL_TOKEN_NEW); } +NOT {SQL_NEW_KEYWORD(SQL_TOKEN_NOT); } +NOW {SQL_NEW_KEYWORD(SQL_TOKEN_NOW); } +NULL {SQL_NEW_KEYWORD(SQL_TOKEN_NULL); } +NULLIF {SQL_NEW_KEYWORD(SQL_TOKEN_NULLIF); } +NUMERIC {SQL_NEW_KEYWORD(SQL_TOKEN_NUMERIC); } + +OBJECT {SQL_NEW_KEYWORD(SQL_TOKEN_OBJECT); } +OCTET_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_OCTET_LENGTH); } +OF {SQL_NEW_KEYWORD(SQL_TOKEN_OF); } +OJ {SQL_NEW_KEYWORD(SQL_TOKEN_OJ); } +OLD {SQL_NEW_KEYWORD(SQL_TOKEN_OLD); } +ON {SQL_NEW_KEYWORD(SQL_TOKEN_ON); } +OPTION {SQL_NEW_KEYWORD(SQL_TOKEN_OPTION); } +OR {SQL_NEW_KEYWORD(SQL_TOKEN_OR); } +ORDER {SQL_NEW_KEYWORD(SQL_TOKEN_ORDER); } +OUTER {SQL_NEW_KEYWORD(SQL_TOKEN_OUTER); } + +PERCENT_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENT_RANK); } +PERCENTILE_CONT {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_CONT); } +PERCENTILE_DISC {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_DISC); } +PI {SQL_NEW_KEYWORD(SQL_TOKEN_PI); } +POSITION {SQL_NEW_KEYWORD(SQL_TOKEN_POSITION); } +POWER {SQL_NEW_KEYWORD(SQL_TOKEN_POWER); } +PRECISION {SQL_NEW_KEYWORD(SQL_TOKEN_PRECISION); } +PRIMARY {SQL_NEW_KEYWORD(SQL_TOKEN_PRIMARY); } +PRIVILEGES {SQL_NEW_KEYWORD(SQL_TOKEN_PRIVILEGES); } +PROCEDURE {SQL_NEW_KEYWORD(SQL_TOKEN_PROCEDURE); } +PUBLIC {SQL_NEW_KEYWORD(SQL_TOKEN_PUBLIC); } + +QUARTER {SQL_NEW_KEYWORD(SQL_TOKEN_QUARTER); } + +RADIANS {SQL_NEW_KEYWORD(SQL_TOKEN_RADIANS); } +RAND {SQL_NEW_KEYWORD(SQL_TOKEN_RAND); } +RANK {SQL_NEW_KEYWORD(SQL_TOKEN_RANK); } +REAL {SQL_NEW_KEYWORD(SQL_TOKEN_REAL); } +REFERENCES {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCES); } +REFERENCING {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCING); } +REPEAT {SQL_NEW_KEYWORD(SQL_TOKEN_REPEAT); } +REPLACE {SQL_NEW_KEYWORD(SQL_TOKEN_REPLACE); } +ROLLBACK {SQL_NEW_KEYWORD(SQL_TOKEN_ROLLBACK); } +ROUND {SQL_NEW_KEYWORD(SQL_TOKEN_ROUND); } +ROUNDMAGIC {SQL_NEW_KEYWORD(SQL_TOKEN_ROUNDMAGIC); } +ROW {SQL_NEW_KEYWORD(SQL_TOKEN_ROW); } +RIGHT {SQL_NEW_KEYWORD(SQL_TOKEN_RIGHT); } +RTRIM {SQL_NEW_KEYWORD(SQL_TOKEN_RTRIM); } + +SCHEMA {SQL_NEW_KEYWORD(SQL_TOKEN_SCHEMA); } +SECOND {SQL_NEW_KEYWORD(SQL_TOKEN_SECOND); } +SELECT {SQL_NEW_KEYWORD(SQL_TOKEN_SELECT); } +SET {SQL_NEW_KEYWORD(SQL_TOKEN_SET); } +SIZE {SQL_NEW_KEYWORD(SQL_TOKEN_SIZE); } +SIGN {SQL_NEW_KEYWORD(SQL_TOKEN_SIGN); } +SIN {SQL_NEW_KEYWORD(SQL_TOKEN_SIN); } +SMALLINT {SQL_NEW_KEYWORD(SQL_TOKEN_SMALLINT); } +SOME {SQL_NEW_KEYWORD(SQL_TOKEN_SOME); } +SOUNDEX {SQL_NEW_KEYWORD(SQL_TOKEN_SOUNDEX); } +SPACE {SQL_NEW_KEYWORD(SQL_TOKEN_SPACE); } +SQRT {SQL_NEW_KEYWORD(SQL_TOKEN_SQRT); } +STDDEV_POP {SQL_NEW_KEYWORD(SQL_TOKEN_STDDEV_POP); } +STDDEV_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_STDDEV_SAMP); } +STATEMENT {SQL_NEW_KEYWORD(SQL_TOKEN_STATEMENT); } +SUBSTRING {SQL_NEW_KEYWORD(SQL_TOKEN_SUBSTRING); } +SUM {SQL_NEW_KEYWORD(SQL_TOKEN_SUM); } +SESSION_USER {SQL_NEW_KEYWORD(SQL_TOKEN_SESSION_USER); } +SYSTEM_USER {SQL_NEW_KEYWORD(SQL_TOKEN_SYSTEM_USER); } + +TABLE {SQL_NEW_KEYWORD(SQL_TOKEN_TABLE); } +TAN {SQL_NEW_KEYWORD(SQL_TOKEN_TAN); } +THEN {SQL_NEW_KEYWORD(SQL_TOKEN_THEN); } +TIME {SQL_NEW_KEYWORD(SQL_TOKEN_TIME); } +TIMESTAMP {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMP); } +TIMESTAMPADD {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPADD); } +TIMESTAMPDIFF {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPDIFF); } +TIMEVALUE {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEVALUE); } +TIMEZONE_HOUR {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_HOUR); } +TIMEZONE_MINUTE {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_MINUTE); } +TO {SQL_NEW_KEYWORD(SQL_TOKEN_TO); } +TRAILING {SQL_NEW_KEYWORD(SQL_TOKEN_TRAILING); } +TRANSLATE {SQL_NEW_KEYWORD(SQL_TOKEN_TRANSLATE); } +TRIGGER {SQL_NEW_KEYWORD(SQL_TOKEN_TRIGGER); } +TRIM {SQL_NEW_KEYWORD(SQL_TOKEN_TRIM); } +TRUE {SQL_NEW_KEYWORD(SQL_TOKEN_TRUE); } +TRUNCATE {SQL_NEW_KEYWORD(SQL_TOKEN_TRUNCATE); } +TS {SQL_NEW_KEYWORD(SQL_TOKEN_TS); } +T {SQL_NEW_KEYWORD(SQL_TOKEN_T); } + +UCASE {SQL_NEW_KEYWORD(SQL_TOKEN_UCASE); } +UNION {SQL_NEW_KEYWORD(SQL_TOKEN_UNION); } +UNIQUE {SQL_NEW_KEYWORD(SQL_TOKEN_UNIQUE); } +UNKNOWN {SQL_NEW_KEYWORD(SQL_TOKEN_UNKNOWN); } +UPDATE {SQL_NEW_KEYWORD(SQL_TOKEN_UPDATE); } +UPPER {SQL_NEW_KEYWORD(SQL_TOKEN_UPPER); } +USAGE {SQL_NEW_KEYWORD(SQL_TOKEN_USAGE); } +USER {SQL_NEW_KEYWORD(SQL_TOKEN_USER); } +USING {SQL_NEW_KEYWORD(SQL_TOKEN_USING); } + +VARBINARY {SQL_NEW_KEYWORD(SQL_TOKEN_VARBINARY); } +VARCHAR {SQL_NEW_KEYWORD(SQL_TOKEN_VARCHAR); } +VARYING {SQL_NEW_KEYWORD(SQL_TOKEN_VARYING); } +VAR_POP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_POP); } +VAR_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_SAMP); } +VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_VALUE); } +VALUES {SQL_NEW_KEYWORD(SQL_TOKEN_VALUES); } +VIEW {SQL_NEW_KEYWORD(SQL_TOKEN_VIEW); } + +WEEK {SQL_NEW_KEYWORD(SQL_TOKEN_WEEK); } +WHEN {SQL_NEW_KEYWORD(SQL_TOKEN_WHEN); } +WHERE {SQL_NEW_KEYWORD(SQL_TOKEN_WHERE); } +WITH {SQL_NEW_KEYWORD(SQL_TOKEN_WITH); } +WITHIN {SQL_NEW_KEYWORD(SQL_TOKEN_WITHIN); } +WITHOUT {SQL_NEW_KEYWORD(SQL_TOKEN_WITHOUT); } +WORK {SQL_NEW_KEYWORD(SQL_TOKEN_WORK); } + +YEAR {SQL_NEW_KEYWORD(SQL_TOKEN_YEAR); } + +ZONE {SQL_NEW_KEYWORD(SQL_TOKEN_ZONE); } "<" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_LESS);return SQL_LESS;} ">" { SQL_NEW_NODE(::rtl::OUString(SQLyytext,strlen(SQLyytext),RTL_TEXTENCODING_UTF8), SQL_NODE_GREAT);return SQL_GREAT;} @@ -365,31 +410,31 @@ VAR_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_S <SQL>([0-9]+) | <SQL>([0-9]+"."[0-9]*) | -<SQL>("."[0-9]*) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} +<SQL>("."[0-9]*) {SQL_NEW_INTNUM; } <SQL>[0-9]+[eE][+-]?[0-9]+ | <SQL>[0-9]+"."[0-9]*[eE][+-]?[0-9]+ | -<SQL>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<SQL>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; } <PREDICATE_GER,PREDICATE_ENG,DATE>[A-Za-z\200-\277\300-\337\340-\357\360-\367\370-\373\374-\375][A-Za-z0-9_%.,*?\200-\277\300-\337\340-\357\360-\367\370-\373\374-\375]* {return gatherNamePre(SQLyytext);} -<PREDICATE_GER,PREDICATE_ENG>([0-9]+) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} -<PREDICATE_ENG>([0-9]{1,3}(","[0-9]{3})+) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} -<PREDICATE_GER>([0-9]{1,3}("."[0-9]{3})+) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} +<PREDICATE_GER,PREDICATE_ENG>([0-9]+) {SQL_NEW_INTNUM; } +<PREDICATE_ENG>([0-9]{1,3}(","[0-9]{3})+) {SQL_NEW_INTNUM; } +<PREDICATE_GER>([0-9]{1,3}("."[0-9]{3})+) {SQL_NEW_INTNUM; } <PREDICATE_ENG>([0-9]+"."[0-9]+) | <PREDICATE_ENG>([0-9]{1,3}(","[0-9]{3})+"."[0-9]+) | -<PREDICATE_ENG>("."[0-9]+) {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<PREDICATE_ENG>("."[0-9]+) {SQL_NEW_APPROXNUM; } <PREDICATE_ENG>[0-9]+[eE][+-]?[0-9]+ | <PREDICATE_ENG>[0-9]+"."[0-9]*[eE][+-]?[0-9]+ | -<PREDICATE_ENG>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<PREDICATE_ENG>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; } <PREDICATE_GER>([0-9]+","[0-9]+) | <PREDICATE_GER>([0-9]{1,3}("."[0-9]{3})+","[0-9]+) | -<PREDICATE_GER>(","[0-9]+) {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<PREDICATE_GER>(","[0-9]+) {SQL_NEW_APPROXNUM; } <PREDICATE_GER>[0-9]+[eE][+-]?[0-9]+ | <PREDICATE_GER>[0-9]+","[0-9]*[eE][+-]?[0-9]+ | -<PREDICATE_GER>","[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<PREDICATE_GER>","[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; } <PREDICATE_GER,PREDICATE_ENG>[0-9.,][A-Za-z0-9_.,%]* {return gatherNamePre(SQLyytext);} @@ -403,7 +448,7 @@ VAR_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_S <PREDICATE_GER,PREDICATE_ENG,DATE># { return gatherString('#' ,2); } <DATE>[0-9]{1,4}[^ ]*[0-9] | -<DATE>[0-9]{1,4}[^ ]*[0-9][ ][0-9]{1,4}[^ ]*[0-9] { SQL_NEW_DATE; return SQL_TOKEN_ACCESS_DATE;} +<DATE>[0-9]{1,4}[^ ]*[0-9][ ][0-9]{1,4}[^ ]*[0-9] { SQL_NEW_DATE; } <STRING>["-""+""*""/"":""("")"",""."";""?""{""}"] { return SQLyytext[0]; } /* */ <STRING>"[" { return gatherString(']' ,0); } @@ -464,7 +509,7 @@ sal_Int32 gatherString( sal_Int32 delim, sal_Int32 nTyp) { case 0: SQL_NEW_NODE(::rtl::OStringToOUString(sBuffer.makeStringAndClear(),RTL_TEXTENCODING_UTF8), SQL_NODE_NAME); - return SQL_TOKEN_NAME; + return SQL_TOKEN_NAME; case 1: SQL_NEW_NODE(::rtl::OStringToOUString(sBuffer.makeStringAndClear(),RTL_TEXTENCODING_UTF8), SQL_NODE_STRING); return SQL_TOKEN_STRING; @@ -487,7 +532,7 @@ sal_Int32 gatherString( sal_Int32 delim, sal_Int32 nTyp) } } YY_FATAL_ERROR("Unterminated name string"); - return SQL_TOKEN_INVALIDSYMBOL; + return SQL_TOKEN_INVALIDSYMBOL; } sal_Int32 mapEnumToToken(IParseContext::InternationalKeyCode _eKeyCode ) @@ -562,10 +607,10 @@ sal_Int32 gatherName(const sal_Char* text) case IParseContext::KEY_INTERSECTION: nToken = mapEnumToToken(eKeyCode); SQL_NEW_KEYWORD(nToken); - return nToken; + break; default: SQL_NEW_NODE(::rtl::OUString(text,strlen(text),RTL_TEXTENCODING_UTF8), SQL_NODE_NAME); - return SQL_TOKEN_NAME; + return SQL_TOKEN_NAME; } } /** diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index feecc26a4052..e1d805e9a1e5 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -50,6 +50,10 @@ #include "diagnose_ex.h" #include <rtl/logfile.hxx> +#define SQL_ISRULEOR2(pParseNode, e1,e2) ((pParseNode)->isRule() && (\ + (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \ + (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2))) + using namespace ::comphelper; using namespace ::connectivity; using namespace ::connectivity::sdbcx; @@ -67,6 +71,7 @@ namespace connectivity { struct OSQLParseTreeIteratorImpl { + ::std::vector< TNodePair > m_aJoinConditions; Reference< XConnection > m_xConnection; Reference< XDatabaseMetaData > m_xDatabaseMetaData; Reference< XNameAccess > m_xTableContainer; @@ -476,7 +481,42 @@ void OSQLParseTreeIterator::traverseOneTableName( OSQLTables& _rTables,const OSQ if ( aTable.is() ) _rTables[ aTableRange ] = aTable; } - +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition) +{ + if (i_pJoinCondition->count() == 3 && // Ausdruck is geklammert + SQL_ISPUNCTUATION(i_pJoinCondition->getChild(0),"(") && + SQL_ISPUNCTUATION(i_pJoinCondition->getChild(2),")")) + { + impl_fillJoinConditions(i_pJoinCondition->getChild(1)); + } + else if (SQL_ISRULEOR2(i_pJoinCondition,search_condition,boolean_term) && // AND/OR-Verknuepfung: + i_pJoinCondition->count() == 3) + { + // nur AND Verknüpfung zulassen + if ( SQL_ISTOKEN(i_pJoinCondition->getChild(1),AND) ) + { + impl_fillJoinConditions(i_pJoinCondition->getChild(0)); + impl_fillJoinConditions(i_pJoinCondition->getChild(1)); + } + } + else if (SQL_ISRULE(i_pJoinCondition,comparison_predicate)) + { + // only the comparison of columns is allowed + OSL_ENSURE(i_pJoinCondition->count() == 3,"OQueryDesignView::InsertJoinConnection: Fehler im Parse Tree"); + if (SQL_ISRULE(i_pJoinCondition->getChild(0),column_ref) && + SQL_ISRULE(i_pJoinCondition->getChild(2),column_ref) && + i_pJoinCondition->getChild(1)->getNodeType() == SQL_NODE_EQUAL) + { + m_pImpl->m_aJoinConditions.push_back( TNodePair(i_pJoinCondition->getChild(0),i_pJoinCondition->getChild(2)) ); + } + } +} +//----------------------------------------------------------------------------- +::std::vector< TNodePair >& OSQLParseTreeIterator::getJoinConditions() const +{ + return m_pImpl->m_aJoinConditions; +} //----------------------------------------------------------------------------- void OSQLParseTreeIterator::getQualified_join( OSQLTables& _rTables, const OSQLParseNode *pTableRef, ::rtl::OUString& aTableRange ) { @@ -491,8 +531,30 @@ void OSQLParseTreeIterator::getQualified_join( OSQLTables& _rTables, const OSQLP traverseOneTableName( _rTables, pNode, aTableRange ); sal_uInt32 nPos = 4; - if(SQL_ISRULE(pTableRef,cross_union) || pTableRef->getChild(1)->getTokenID() != SQL_TOKEN_NATURAL) + if( SQL_ISRULE(pTableRef,cross_union) || pTableRef->getChild(1)->getTokenID() != SQL_TOKEN_NATURAL) + { nPos = 3; + // join_condition,named_columns_join + if ( SQL_ISRULE( pTableRef, qualified_join ) ) + { + const OSQLParseNode* pJoin_spec = pTableRef->getChild(4); + if ( SQL_ISRULE( pJoin_spec, join_condition ) ) + { + impl_fillJoinConditions(pJoin_spec->getChild(1)); + } + else + { + const OSQLParseNode* pColumnCommalist = pJoin_spec->getChild(2); + // Alle Columns in der column_commalist ... + for (sal_uInt32 i = 0; i < pColumnCommalist->count(); i++) + { + const OSQLParseNode * pCol = pColumnCommalist->getChild(i); + // add twice because the column must exists in both tables + m_pImpl->m_aJoinConditions.push_back( TNodePair(pCol,pCol) ); + } + } + } + } pNode = getTableNode(_rTables,pTableRef->getChild(nPos),aTableRange); if ( isTableNode( pNode ) ) @@ -826,17 +888,17 @@ void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNo aColumnName = pColumnRef->getChild(0)->getTokenValue(); OSQLParseNode *pDatatype = pColumnRef->getChild(1); - if (pDatatype && SQL_ISRULE(pDatatype,data_type)) + if (pDatatype && SQL_ISRULE(pDatatype,character_string_type)) { - //data type - // 0 | 1| 2 |3 - //char ( 20 ) - aTypeName = pDatatype->getChild(0)->getTokenValue(); - if (pDatatype->count() == 4 - && SQL_ISPUNCTUATION(pDatatype->getChild(1), "(") - && SQL_ISPUNCTUATION(pDatatype->getChild(3) , ")") ) + const OSQLParseNode *pType = pDatatype->getChild(0); + aTypeName = pType->getTokenValue(); + if (pDatatype->count() == 2 && (pType->getTokenID() == SQL_TOKEN_CHAR || pType->getTokenID() == SQL_TOKEN_CHARACTER )) + nType = DataType::CHAR; + + const OSQLParseNode *pParams = pDatatype->getChild(pDatatype->count()-1); + if ( pParams->count() ) { - nLen = pDatatype->getChild(2)->getTokenValue().toInt32(); + nLen = pParams->getChild(1)->getTokenValue().toInt32(); } } else if(pDatatype && pDatatype->getNodeType() == SQL_NODE_KEYWORD) @@ -846,8 +908,8 @@ void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNo if (aTypeName.getLength()) { - //TO DO:Create a new class for create statement to handle field length - OParseColumn* pColumn = new OParseColumn(aColumnName,aTypeName,::rtl::OUString(), + //TODO:Create a new class for create statement to handle field length + OParseColumn* pColumn = new OParseColumn(aColumnName,aTypeName,::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN,0,0,nType,sal_False,sal_False,isCaseSensitive()); pColumn->setFunction(sal_False); pColumn->setRealName(aColumnName); @@ -1115,17 +1177,17 @@ void OSQLParseTreeIterator::traverseParameters(const OSQLParseNode* _pNode) else pOther->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); } // if ( SQL_ISRULE(pParent,comparison_predicate) ) // x = X - else if ( SQL_ISRULE(pParent,like_predicate) ) + else if ( SQL_ISRULE(pParent,other_like_predicate_part_2) ) { - const OSQLParseNode* pOther = pParent->getChild(0); + const OSQLParseNode* pOther = pParent->getParent()->getChild(0); if ( SQL_ISRULE( pOther, column_ref ) ) getColumnRange( pOther, sColumnName, sTableRange, aColumnAlias); else pOther->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); } - else if ( SQL_ISRULE(pParent,between_predicate) ) + else if ( SQL_ISRULE(pParent,between_predicate_part_2) ) { - const OSQLParseNode* pOther = pParent->getChild(0); + const OSQLParseNode* pOther = pParent->getParent()->getChild(0); if ( SQL_ISRULE( pOther, column_ref ) ) getColumnRange( pOther, sColumnName, sTableRange, aColumnAlias); else @@ -1304,17 +1366,19 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition ::rtl::OUString aValue; pSearchCondition->getChild(2)->parseNodeToStr( aValue, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); traverseOnePredicate(pSearchCondition->getChild(0),aValue,pSearchCondition->getChild(2)); + impl_fillJoinConditions(pSearchCondition); // if (! aIteratorStatus.IsSuccessful()) // return; } else if (SQL_ISRULE(pSearchCondition,like_predicate) /*&& SQL_ISRULE(pSearchCondition->getChild(0),column_ref)*/) { - OSL_ENSURE(pSearchCondition->count() >= 4,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pSearchCondition->count() == 2,"OSQLParseTreeIterator: error in parse tree!"); + const OSQLParseNode* pPart2 = pSearchCondition->getChild(1); - sal_Int32 nCurentPos = pSearchCondition->count()-2; + sal_Int32 nCurentPos = pPart2->count()-2; - OSQLParseNode * pNum_value_exp = pSearchCondition->getChild(nCurentPos); - OSQLParseNode * pOptEscape = pSearchCondition->getChild(nCurentPos+1); + OSQLParseNode * pNum_value_exp = pPart2->getChild(nCurentPos); + OSQLParseNode * pOptEscape = pPart2->getChild(nCurentPos+1); OSL_ENSURE(pNum_value_exp != NULL,"OSQLParseTreeIterator: error in parse tree!"); OSL_ENSURE(pOptEscape != NULL,"OSQLParseTreeIterator: error in parse tree!"); @@ -1344,12 +1408,13 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition } else if (SQL_ISRULE(pSearchCondition,in_predicate)) { - OSL_ENSURE(pSearchCondition->count() == 4,"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pSearchCondition->count() == 2,"OSQLParseTreeIterator: error in parse tree!"); + const OSQLParseNode* pPart2 = pSearchCondition->getChild(1); traverseORCriteria(pSearchCondition->getChild(0)); // if (! aIteratorStatus.IsSuccessful()) return; - OSQLParseNode* pChild = pSearchCondition->getChild(3); + OSQLParseNode* pChild = pPart2->getChild(2); if ( SQL_ISRULE(pChild->getChild(0),subquery) ) { traverseTableNames( *m_pImpl->m_pSubTables ); @@ -1367,8 +1432,10 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition } else if (SQL_ISRULE(pSearchCondition,test_for_null) /*&& SQL_ISRULE(pSearchCondition->getChild(0),column_ref)*/) { - OSL_ENSURE(pSearchCondition->count() >= 3,"OSQLParseTreeIterator: error in parse tree!"); - OSL_ENSURE(SQL_ISTOKEN(pSearchCondition->getChild(1),IS),"OSQLParseTreeIterator: error in parse tree!"); + OSL_ENSURE(pSearchCondition->count() == 2,"OSQLParseTreeIterator: error in parse tree!"); + const OSQLParseNode* pPart2 = pSearchCondition->getChild(1); + (void)pPart2; + OSL_ENSURE(SQL_ISTOKEN(pPart2->getChild(0),IS),"OSQLParseTreeIterator: error in parse tree!"); ::rtl::OUString aString; traverseOnePredicate(pSearchCondition->getChild(0),aString,NULL); @@ -1427,11 +1494,19 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode {// found a function as column_ref ::rtl::OUString sFunctionName; _pColumnRef->getChild(0)->parseNodeToStr( sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); - sal_Int32 nType = ::connectivity::OSQLParser::getFunctionReturnType( sFunctionName, &m_rParser.getContext() ); + const sal_uInt32 nCount = _pColumnRef->count(); + sal_uInt32 i = 0; + for(; i < nCount;++i) + { + if ( _pColumnRef->getChild(i) == _pParseNode ) + break; + } + sal_Int32 nType = ::connectivity::OSQLParser::getFunctionParameterType( _pColumnRef->getParent()->getChild(0)->getTokenID(), i+1); OParseColumn* pColumn = new OParseColumn( sParameterName, ::rtl::OUString(), ::rtl::OUString(), + ::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN, 0, 0, @@ -1495,6 +1570,7 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode OParseColumn* pColumn = new OParseColumn(aNewColName, ::rtl::OUString(), ::rtl::OUString(), + ::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN, 0, 0, @@ -1637,6 +1713,7 @@ void OSQLParseTreeIterator::appendColumns(::vos::ORef<OSQLColumns>& _rColumns,co OParseColumn* pColumn = new OParseColumn(aName , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))) + , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))) , getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) , getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))) , getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))) @@ -1714,6 +1791,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColu // TODO: does this match with _nType? // Or should be fill this from the getTypeInfo of the connection? ::rtl::OUString(), + ::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN, 0, 0, @@ -1733,7 +1811,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColu { ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); - OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), + OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive()); pColumn->setFunction(sal_True); pColumn->setAggregateFunction(bAggFkt); @@ -1754,7 +1832,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColu { ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); - OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), + OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive()); pColumn->setFunction(sal_True); pColumn->setAggregateFunction(bAggFkt); @@ -1791,7 +1869,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::vos::ORef<OSQLColumns>& _rColu { ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); - OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), + OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,isCaseSensitive()); pColumn->setFunction(sal_True); pColumn->setAggregateFunction(bAggFkt); diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index 20b35b21a493..b8bcd5334787 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -677,7 +677,7 @@ void OSQLParseNode::impl_parseTableRangeNodeToString_throw(::rtl::OUStringBuffer void OSQLParseNode::impl_parseLikeNodeToString_throw( ::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::impl_parseLikeNodeToString_throw" ); - OSL_ENSURE(count() >= 4,"count != 5: Prepare for GPF"); + OSL_ENSURE(count() == 2,"count != 2: Prepare for GPF"); const OSQLParseNode* pEscNode = NULL; const OSQLParseNode* pParaNode = NULL; @@ -714,13 +714,11 @@ void OSQLParseNode::impl_parseLikeNodeToString_throw( ::rtl::OUStringBuffer& rSt if (bAddName) m_aChildren[0]->impl_parseNodeToString_throw( rString, aNewParam ); - m_aChildren[1]->impl_parseNodeToString_throw( rString, aNewParam ); - if(count() == 5) - m_aChildren[2]->impl_parseNodeToString_throw( rString, aNewParam ); - - sal_Int32 nCurentPos = m_aChildren.size()-2; - pParaNode = m_aChildren[nCurentPos]; - pEscNode = m_aChildren[nCurentPos+1]; + const OSQLParseNode* pPart2 = m_aChildren[1]; + pPart2->getChild(0)->impl_parseNodeToString_throw( rString, aNewParam ); + pPart2->getChild(1)->impl_parseNodeToString_throw( rString, aNewParam ); + pParaNode = pPart2->getChild(2); + pEscNode = pPart2->getChild(3); if (pParaNode->isToken()) { @@ -1422,7 +1420,12 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star: { OSQLParseNode::datetime_primary, "datetime_primary" }, { OSQLParseNode::concatenation, "concatenation" }, { OSQLParseNode::char_factor, "char_factor" }, - { OSQLParseNode::bit_value_fct, "bit_value_fct" } + { OSQLParseNode::bit_value_fct, "bit_value_fct" }, + { OSQLParseNode::comparison_predicate_part_2, "comparison_predicate_part_2" }, + { OSQLParseNode::parenthesized_boolean_value_expression, "parenthesized_boolean_value_expression" }, + { OSQLParseNode::character_string_type, "character_string_type" }, + { OSQLParseNode::other_like_predicate_part_2, "other_like_predicate_part_2" }, + { OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" } }; size_t nRuleMapCount = sizeof( aRuleDescriptions ) / sizeof( aRuleDescriptions[0] ); OSL_ENSURE( nRuleMapCount == size_t( OSQLParseNode::rule_count ), "OSQLParser::OSQLParser: added a new rule? Adjust this map!" ); @@ -1984,39 +1987,34 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_B else if(bNegate && (SQL_ISRULE(pSearchCondition,test_for_null) || SQL_ISRULE(pSearchCondition,in_predicate) || SQL_ISRULE(pSearchCondition,between_predicate) || SQL_ISRULE(pSearchCondition,boolean_test) )) { + OSQLParseNode* pPart2 = pSearchCondition; + if ( !SQL_ISRULE(pSearchCondition,boolean_test) ) + pPart2 = pSearchCondition->getChild(1); sal_uInt32 nNotPos = 0; - // row_value_constructor not SQL_TOKEN_IN in_predicate_value - // row_value_constructor not SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor - if ( SQL_ISRULE( pSearchCondition, in_predicate ) - || SQL_ISRULE( pSearchCondition, between_predicate ) - ) + if ( SQL_ISRULE( pSearchCondition, test_for_null ) ) nNotPos = 1; - // row_value_constructor SQL_TOKEN_IS not SQL_TOKEN_NULL - // boolean_primary SQL_TOKEN_IS not truth_value - else if ( SQL_ISRULE( pSearchCondition, test_for_null ) - || SQL_ISRULE( pSearchCondition, boolean_test ) - ) + else if ( SQL_ISRULE( pSearchCondition, boolean_test ) ) nNotPos = 2; - OSQLParseNode* pNot = pSearchCondition->getChild(nNotPos); + OSQLParseNode* pNot = pPart2->getChild(nNotPos); OSQLParseNode* pNotNot = NULL; if(pNot->isRule()) pNotNot = new OSQLParseNode(::rtl::OUString::createFromAscii("NOT"),SQL_NODE_KEYWORD,SQL_TOKEN_NOT); else pNotNot = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::sql_not)); - pSearchCondition->replace(pNot, pNotNot); + pPart2->replace(pNot, pNotNot); delete pNot; } else if(bNegate && (SQL_ISRULE(pSearchCondition,like_predicate))) { - OSQLParseNode* pCheckForNOT = pSearchCondition->getChild( 1 ); - if ( SQL_ISTOKEN(pCheckForNOT,NOT) ) - delete pSearchCondition->removeAt( 1 ); + OSQLParseNode* pNot = pSearchCondition->getChild( 1 )->getChild( 0 ); + OSQLParseNode* pNotNot = NULL; + if(pNot->isRule()) + pNotNot = new OSQLParseNode(::rtl::OUString::createFromAscii("NOT"),SQL_NODE_KEYWORD,SQL_TOKEN_NOT); else - { - OSQLParseNode* pNot = new OSQLParseNode( ::rtl::OUString::createFromAscii( "NOT" ), SQL_NODE_KEYWORD, SQL_TOKEN_NOT ); - pSearchCondition->insert( 1, pNot ); - } + pNotNot = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::sql_not)); + pSearchCondition->getChild( 1 )->replace(pNot, pNotNot); + delete pNot; } } //----------------------------------------------------------------------------- @@ -2554,7 +2552,6 @@ sal_Int32 OSQLParser::getFunctionReturnType(const ::rtl::OUString& _sFunctionNam else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_BIT_LENGTH,pContext))) nType = DataType::INTEGER; else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_CHAR,pContext))) nType = DataType::VARCHAR; else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_CHAR_LENGTH,pContext))) nType = DataType::INTEGER; - else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_CHARACTER_LENGTH,pContext))) nType = DataType::INTEGER; else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_CONCAT,pContext))) nType = DataType::VARCHAR; else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_DIFFERENCE,pContext))) nType = DataType::VARCHAR; else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_INSERT,pContext))) nType = DataType::VARCHAR; diff --git a/connectivity/source/sdbcx/VColumn.cxx b/connectivity/source/sdbcx/VColumn.cxx index e4535c713ec7..65bc1b368b1e 100644 --- a/connectivity/source/sdbcx/VColumn.cxx +++ b/connectivity/source/sdbcx/VColumn.cxx @@ -89,6 +89,7 @@ OColumn::OColumn(sal_Bool _bCase) OColumn::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, @@ -100,6 +101,7 @@ OColumn::OColumn( const ::rtl::OUString& _Name, :OColumnDescriptor_BASE(m_aMutex) ,ODescriptor(OColumnDescriptor_BASE::rBHelper,_bCase) ,m_TypeName(_TypeName) + ,m_Description(_Description) ,m_DefaultValue(_DefaultValue) ,m_IsNullable(_IsNullable) ,m_Precision(_Precision) @@ -195,6 +197,7 @@ Reference< XPropertySet > SAL_CALL OColumn::createDataDescriptor( ) throw(Runti OColumn* pNewColumn = new OColumn( m_Name, m_TypeName, m_DefaultValue, + m_Description, m_IsNullable, m_Precision, m_Scale, @@ -203,7 +206,6 @@ Reference< XPropertySet > SAL_CALL OColumn::createDataDescriptor( ) throw(Runti m_IsRowVersion, m_IsCurrency, isCaseSensitive()); - pNewColumn->m_Description = m_Description; pNewColumn->setNew(sal_True); return pNewColumn; } diff --git a/connectivity/source/sdbcx/VIndexColumn.cxx b/connectivity/source/sdbcx/VIndexColumn.cxx index 31aaaa3d17ab..ca1649b06384 100644 --- a/connectivity/source/sdbcx/VIndexColumn.cxx +++ b/connectivity/source/sdbcx/VIndexColumn.cxx @@ -85,6 +85,7 @@ OIndexColumn::OIndexColumn( sal_Bool _IsAscending, ) : OColumn(_Name, _TypeName, _DefaultValue, + ::rtl::OUString(), _IsNullable, _Precision, _Scale, diff --git a/connectivity/source/sdbcx/VKeyColumn.cxx b/connectivity/source/sdbcx/VKeyColumn.cxx index bbcec5cc0501..97e83f5c633a 100644 --- a/connectivity/source/sdbcx/VKeyColumn.cxx +++ b/connectivity/source/sdbcx/VKeyColumn.cxx @@ -85,6 +85,7 @@ OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn, ) : OColumn(_Name, _TypeName, _DefaultValue, + ::rtl::OUString(), _IsNullable, _Precision, _Scale, |