summaryrefslogtreecommitdiff
path: root/connectivity/source
diff options
context:
space:
mode:
authorOcke Janssen [oj] <Ocke.Janssen@sun.com>2010-01-08 11:22:52 +0100
committerOcke Janssen [oj] <Ocke.Janssen@sun.com>2010-01-08 11:22:52 +0100
commitbc7afd018ae687b2a8ba9096dfe463097b54799a (patch)
treec0b3cd10a8b7f8156cd0a7747edb19b3b3c28e38 /connectivity/source
parent5c578d51b72a3ea28ca43e96dbf5ea9ecf30d2c0 (diff)
parentcf9d195402bf250455e0321c47b9ffa4b2ea5515 (diff)
Automated merge with http://hg.services.openoffice.org/cws/dba33e
Diffstat (limited to 'connectivity/source')
-rw-r--r--connectivity/source/drivers/hsqldb/HTable.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/JStatement.cxx68
-rw-r--r--connectivity/source/drivers/mysql/YTable.cxx4
-rw-r--r--connectivity/source/drivers/mysql/YTables.cxx19
-rw-r--r--connectivity/source/inc/mysql/YTables.hxx5
5 files changed, 62 insertions, 36 deletions
diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx
index fa9a579ce8eb..b3bed60874f1 100644
--- a/connectivity/source/drivers/hsqldb/HTable.cxx
+++ b/connectivity/source/drivers/hsqldb/HTable.cxx
@@ -214,7 +214,7 @@ void SAL_CALL OHSQLTable::alterColumnByName( const ::rtl::OUString& colName, con
// now we should look if the name of the column changed
::rtl::OUString sNewColumnName;
descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_NAME)) >>= sNewColumnName;
- if ( !sNewColumnName.equalsIgnoreAsciiCase(colName) )
+ if ( !sNewColumnName.equals(colName) )
{
const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( );
diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx
index f4d798973611..4a817501684a 100644
--- a/connectivity/source/drivers/jdbc/JStatement.cxx
+++ b/connectivity/source/drivers/jdbc/JStatement.cxx
@@ -712,38 +712,44 @@ void java_sql_Statement_Base::getFastPropertyValue(
) const
{
java_sql_Statement_Base* THIS = const_cast<java_sql_Statement_Base*>(this);
- switch(nHandle)
+ try
+ {
+ switch(nHandle)
+ {
+ case PROPERTY_ID_QUERYTIMEOUT:
+ rValue <<= THIS->getQueryTimeOut();
+ break;
+ case PROPERTY_ID_MAXFIELDSIZE:
+ rValue <<= THIS->getMaxFieldSize();
+ break;
+ case PROPERTY_ID_MAXROWS:
+ rValue <<= THIS->getMaxRows();
+ break;
+ case PROPERTY_ID_CURSORNAME:
+ rValue <<= THIS->getCursorName();
+ break;
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ rValue <<= THIS->getResultSetConcurrency();
+ break;
+ case PROPERTY_ID_RESULTSETTYPE:
+ rValue <<= THIS->getResultSetType();
+ break;
+ case PROPERTY_ID_FETCHDIRECTION:
+ rValue <<= THIS->getFetchDirection();
+ break;
+ case PROPERTY_ID_FETCHSIZE:
+ rValue <<= THIS->getFetchSize();
+ break;
+ case PROPERTY_ID_ESCAPEPROCESSING:
+ rValue <<= (sal_Bool)m_bEscapeProcessing;
+ break;
+ case PROPERTY_ID_USEBOOKMARKS:
+ default:
+ ;
+ }
+ }
+ catch(const Exception&)
{
- case PROPERTY_ID_QUERYTIMEOUT:
- rValue <<= THIS->getQueryTimeOut();
- break;
- case PROPERTY_ID_MAXFIELDSIZE:
- rValue <<= THIS->getMaxFieldSize();
- break;
- case PROPERTY_ID_MAXROWS:
- rValue <<= THIS->getMaxRows();
- break;
- case PROPERTY_ID_CURSORNAME:
- rValue <<= THIS->getCursorName();
- break;
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= THIS->getResultSetConcurrency();
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= THIS->getResultSetType();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= THIS->getFetchDirection();
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= THIS->getFetchSize();
- break;
- case PROPERTY_ID_ESCAPEPROCESSING:
- rValue <<= (sal_Bool)m_bEscapeProcessing;
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- default:
- ;
}
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mysql/YTable.cxx b/connectivity/source/drivers/mysql/YTable.cxx
index 8a951936c23c..347ce027e462 100644
--- a/connectivity/source/drivers/mysql/YTable.cxx
+++ b/connectivity/source/drivers/mysql/YTable.cxx
@@ -284,7 +284,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(),getTypeCreatePattern()));
executeStatement(sSql);
}
m_pColumns->refresh();
@@ -313,7 +313,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(),getTypeCreatePattern()));
executeStatement(sSql);
}
// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx
index d60deb22df7d..d63271399a2f 100644
--- a/connectivity/source/drivers/mysql/YTables.cxx
+++ b/connectivity/source/drivers/mysql/YTables.cxx
@@ -187,12 +187,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,s_sCreatePattern));
Reference< XStatement > xStmt = xConnection->createStatement( );
if ( xStmt.is() )
{
diff --git a/connectivity/source/inc/mysql/YTables.hxx b/connectivity/source/inc/mysql/YTables.hxx
index 55768286ada7..d60c919daae0 100644
--- a/connectivity/source/inc/mysql/YTables.hxx
+++ b/connectivity/source/inc/mysql/YTables.hxx
@@ -74,6 +74,11 @@ namespace connectivity
can contain () which have to filled with values
*/
static ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
+
+ /** convert the sql statement to fit MySQL notation
+ @param _sSql in/out
+ */
+ static ::rtl::OUString adjustSQL(const ::rtl::OUString& _sSql);
};
}
}