diff options
author | Carsten Driesner <cd@openoffice.org> | 2010-06-24 11:35:00 +0200 |
---|---|---|
committer | Carsten Driesner <cd@openoffice.org> | 2010-06-24 11:35:00 +0200 |
commit | 2a40b4b78143f09358c1f319e8608dbd61bbe2d6 (patch) | |
tree | 60668145121dc3e45a60d569f9c2947afda15e30 /connectivity/source/drivers/mysql | |
parent | 2b1c9f5c63f4d90db0137b1c8c91340bb2559115 (diff) | |
parent | 34dd33af79caf3a13ec3a4e7098616ac0b16cf50 (diff) |
Merge changes
Diffstat (limited to 'connectivity/source/drivers/mysql')
-rw-r--r-- | connectivity/source/drivers/mysql/YTable.cxx | 10 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/YTables.cxx | 31 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/makefile.mk | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/mysql.map | 8 | ||||
-rw-r--r--[-rwxr-xr-x] | connectivity/source/drivers/mysql/mysql.xcu | 25 |
5 files changed, 61 insertions, 15 deletions
diff --git a/connectivity/source/drivers/mysql/YTable.cxx b/connectivity/source/drivers/mysql/YTable.cxx index ff5666d7ffa7..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 += ::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 += ::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 d56c53a1358e..80bb2baf58c0 100644 --- a/connectivity/source/drivers/mysql/YTables.cxx +++ b/connectivity/source/drivers/mysql/YTables.cxx @@ -184,12 +184,27 @@ void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) } } // ------------------------------------------------------------------------- +::rtl::OUString OTables::adjustSQL(const ::rtl::OUString& _sSql) +{ + ::rtl::OUString sSQL = _sSql; + static const ::rtl::OUString s_sUNSIGNED(RTL_CONSTASCII_USTRINGPARAM("UNSIGNED")); + sal_Int32 nIndex = sSQL.indexOf(s_sUNSIGNED); + while(nIndex != -1 ) + { + sal_Int32 nParen = sSQL.indexOf(')',nIndex); + sal_Int32 nPos = nIndex + s_sUNSIGNED.getLength(); + ::rtl::OUString sNewUnsigned( sSQL.copy(nPos,nParen - nPos + 1)); + sSQL = sSQL.replaceAt(nIndex,s_sUNSIGNED.getLength()+sNewUnsigned.getLength(),sNewUnsigned + s_sUNSIGNED); + nIndex = sSQL.indexOf(s_sUNSIGNED,nIndex + s_sUNSIGNED.getLength()+sNewUnsigned.getLength()); + } + return sSQL; +} +// ------------------------------------------------------------------------- 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 = ::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() ) { @@ -215,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/makefile.mk b/connectivity/source/drivers/mysql/makefile.mk index af486c293806..fbb68321cb01 100644 --- a/connectivity/source/drivers/mysql/makefile.mk +++ b/connectivity/source/drivers/mysql/makefile.mk @@ -55,7 +55,7 @@ SLOFILES=\ $(SLO)$/YUsers.obj \ $(SLO)$/Yservices.obj -SHL1VERSIONMAP=$(MYSQL_TARGET).map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map # --- Library ----------------------------------- diff --git a/connectivity/source/drivers/mysql/mysql.map b/connectivity/source/drivers/mysql/mysql.map deleted file mode 100644 index 834658431ada..000000000000 --- a/connectivity/source/drivers/mysql/mysql.map +++ /dev/null @@ -1,8 +0,0 @@ -MYSQL_2_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/connectivity/source/drivers/mysql/mysql.xcu b/connectivity/source/drivers/mysql/mysql.xcu index 2fc59be5bdc3..afc5c0d07f5d 100755..100644 --- 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> |