summaryrefslogtreecommitdiff
path: root/connectivity/source/commontools/dbtools2.cxx
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2013-08-15 10:02:26 +0100
committerFridrich Strba <fridrich@documentfoundation.org>2013-08-19 09:12:03 +0000
commitacd9f66f2834c16650d37109650ed47e491a0241 (patch)
tree29ed3b58f9c93246590e57cbb27def2437ce3d2f /connectivity/source/commontools/dbtools2.cxx
parentbd507a0d093b7d5239992440a40d0a7453b38207 (diff)
Split type-description out of createStandardColumnPart.
createStandardColumnPart returns a string that is usable in table creation, the type descriptor (e.g. CHAR(N)) is also useful in column-type altering statements, hence this is split into a separate function. This is needed primarily in the firebird driver where column-type alter statements are in a different form to most dbs. Change-Id: If44554f979f6dd14bf679455978f3f0b44784bf5 Reviewed-on: https://gerrit.libreoffice.org/5432 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'connectivity/source/commontools/dbtools2.cxx')
-rw-r--r--connectivity/source/commontools/dbtools2.cxx26
1 files changed, 20 insertions, 6 deletions
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index bf9fad695f08..055a3bd16356 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -60,7 +60,7 @@ namespace dbtools
using namespace connectivity;
using namespace comphelper;
-OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,const Reference< XConnection>& _xConnection,ISQLStatementHelper* _pHelper,const OUString& _sCreatePattern)
+OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const Reference< XConnection>& _xConnection,ISQLStatementHelper* _pHelper,const OUString& _sCreatePattern)
{
Reference<XDatabaseMetaData> xMetaData = _xConnection->getMetaData();
@@ -72,11 +72,6 @@ OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,cons
sal_Int32 nPrecision = 0;
sal_Int32 nScale = 0;
- const OUString sQuoteString = xMetaData->getIdentifierQuoteString();
- OUStringBuffer aSql = ::dbtools::quoteName(sQuoteString,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))));
-
- aSql.appendAscii(" ");
-
nDataType = nPrecision = nScale = 0;
sal_Bool bIsAutoIncrement = sal_False;
xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPENAME)) >>= sTypeName;
@@ -85,6 +80,8 @@ OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,cons
xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale;
xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bIsAutoIncrement;
+ OUStringBuffer aSql;
+
// check if the user enter a specific string to create autoincrement values
OUString sAutoIncrementValue;
Reference<XPropertySetInfo> xPropInfo = xColProp->getPropertySetInfo();
@@ -180,6 +177,23 @@ OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,cons
return aSql.makeStringAndClear();
}
+
+OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,const Reference< XConnection>& _xConnection,ISQLStatementHelper* _pHelper,const OUString& _sCreatePattern)
+{
+ Reference<XDatabaseMetaData> xMetaData = _xConnection->getMetaData();
+
+ ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
+
+ const OUString sQuoteString = xMetaData->getIdentifierQuoteString();
+ OUStringBuffer aSql = ::dbtools::quoteName(sQuoteString,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))));
+
+ aSql.appendAscii(" ");
+
+ aSql.append(createStandardTypePart(xColProp, _xConnection, _pHelper, _sCreatePattern));
+
+ return aSql.makeStringAndClear();
+}
+
// -----------------------------------------------------------------------------
OUString createStandardCreateStatement(const Reference< XPropertySet >& descriptor,const Reference< XConnection>& _xConnection,ISQLStatementHelper* _pHelper,const OUString& _sCreatePattern)