summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2009-12-02 13:43:47 +0100
committerKurt Zenker <kz@openoffice.org>2009-12-02 13:43:47 +0100
commitad1bc80b6d8391195ec6ccaf25ee12c1d02a5850 (patch)
treedaa19f76ff9e8bbb9b1651e76806a469b2815372 /connectivity
parent041210d90f162084e98b1fc0acbe744926ac8f60 (diff)
parentfc02f9b3673187ccada1a09f79ad042065578af0 (diff)
CWS-TOOLING: integrate CWS dba32i_DEV300
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/file/quotedstring.cxx2
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx47
-rw-r--r--connectivity/source/drivers/hsqldb/makefile.mk1
-rw-r--r--connectivity/source/inc/resource/hsqldb_res.hrc1
-rw-r--r--connectivity/source/parse/sqlnode.cxx14
-rw-r--r--connectivity/source/resource/conn_shared_res.src5
6 files changed, 65 insertions, 5 deletions
diff --git a/connectivity/source/drivers/file/quotedstring.cxx b/connectivity/source/drivers/file/quotedstring.cxx
index abd2d3b51e44..765c42eeeae2 100644
--- a/connectivity/source/drivers/file/quotedstring.cxx
+++ b/connectivity/source/drivers/file/quotedstring.cxx
@@ -152,7 +152,6 @@ namespace connectivity
// Vorzeitiger Abbruch der Schleife moeglich, denn
// wir haben, was wir wollten.
nStartPos = i+1;
- *pData = 0;
break;
}
else
@@ -161,6 +160,7 @@ namespace connectivity
}
}
} // for( xub_StrLen i = nStartPos; i < nLen; ++i )
+ *pData = 0;
_rStr.ReleaseBufferAccess(xub_StrLen(pData - pStart));
}
}
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 1e80a96cf682..7e97d27e1d86 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -55,6 +55,7 @@
#include <connectivity/dbexception.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <unotools/confignode.hxx>
+#include <unotools/ucbstreamhelper.hxx>
#include "resource/hsqldb_res.hrc"
#include "resource/sharedresources.hxx"
@@ -70,6 +71,8 @@ namespace connectivity
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::embed;
+ using namespace ::com::sun::star::io;
+ using namespace ::com::sun::star::task;
using namespace ::com::sun::star::reflection;
namespace hsqldb
@@ -260,6 +263,50 @@ namespace connectivity
);
aProperties.put( "SystemProperties", Sequence< NamedValue >( &aPermittedClasses, 1 ) );
+ const ::rtl::OUString sProperties( RTL_CONSTASCII_USTRINGPARAM( "properties" ) );
+ ::rtl::OUString sMessage;
+ try
+ {
+ if ( !bIsNewDatabase && xStorage->isStreamElement(sProperties) )
+ {
+ Reference<XStream > xStream = xStorage->openStreamElement(sProperties,ElementModes::READ);
+ if ( xStream.is() )
+ {
+ ::std::auto_ptr<SvStream> pStream( ::utl::UcbStreamHelper::CreateStream(xStream) );
+ if ( pStream.get() )
+ {
+ ByteString sLine;
+ while ( pStream->ReadLine(sLine) )
+ {
+ if ( sLine.Equals("version=",0,sizeof("version=")-1) )
+ {
+ sLine = sLine.GetToken(1,'=');
+ const sal_Int32 nMajor = sLine.GetToken(0,'.').ToInt32();
+ const sal_Int32 nMinor = sLine.GetToken(1,'.').ToInt32();
+ const sal_Int32 nMicro = sLine.GetToken(2,'.').ToInt32();
+ if ( nMajor > 1
+ || ( nMajor == 1 && nMinor > 8 )
+ || ( nMajor == 1 && nMinor == 8 && nMicro > 0 ) )
+ {
+ ::connectivity::SharedResources aResources;
+ sMessage = aResources.getResourceString(STR_ERROR_NEW_VERSION);
+ }
+ break;
+ }
+ }
+ }
+ } // if ( xStream.is() )
+ ::comphelper::disposeComponent(xStream);
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ if ( sMessage.getLength() )
+ {
+ ::dbtools::throwGenericSQLException(sMessage ,*this);
+ }
+
// readonly?
Reference<XPropertySet> xProp(xStorage,UNO_QUERY);
if ( xProp.is() )
diff --git a/connectivity/source/drivers/hsqldb/makefile.mk b/connectivity/source/drivers/hsqldb/makefile.mk
index 9ed5acb17d4c..c61e4b297ba4 100644
--- a/connectivity/source/drivers/hsqldb/makefile.mk
+++ b/connectivity/source/drivers/hsqldb/makefile.mk
@@ -102,6 +102,7 @@ SHL1STDLIBS=\
$(DBTOOLSLIB) \
$(JVMFWKLIB) \
$(COMPHELPERLIB) \
+ $(TOOLSLIB) \
$(UNOTOOLSLIB)
diff --git a/connectivity/source/inc/resource/hsqldb_res.hrc b/connectivity/source/inc/resource/hsqldb_res.hrc
index 3b7b9ef15c0a..b9066488d425 100644
--- a/connectivity/source/inc/resource/hsqldb_res.hrc
+++ b/connectivity/source/inc/resource/hsqldb_res.hrc
@@ -44,6 +44,7 @@
#define STR_NO_TABLE_EDITOR_DIALOG ( STR_HSQLDB_BASE + 3 )
#define STR_NO_TABLENAME ( STR_HSQLDB_BASE + 4 )
#define STR_NO_DOCUMENTUI ( STR_HSQLDB_BASE + 5 )
+#define STR_ERROR_NEW_VERSION ( STR_HSQLDB_BASE + 6 )
#endif // CONNECTIVITY_RESOURCE_HSQLDB_HRC
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index a1fd44014314..8d869c2dea0a 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -2074,18 +2074,18 @@ void OSQLParseNode::absorptions(OSQLParseNode*& pSearchCondition)
if ( SQL_ISRULE(p2ndSearch,boolean_primary) )
p2ndSearch = p2ndSearch->getChild(1);
- if ( *p2ndSearch->getChild(0) == *pSearchCondition->getChild(2-nPos) )
+ if ( *p2ndSearch->getChild(0) == *pSearchCondition->getChild(2-nPos) ) // a and ( a or b) -> a or b
{
pNewNode = pSearchCondition->removeAt((sal_uInt32)0);
replaceAndReset(pSearchCondition,pNewNode);
}
- else if ( *p2ndSearch->getChild(2) == *pSearchCondition->getChild(2-nPos) )
+ else if ( *p2ndSearch->getChild(2) == *pSearchCondition->getChild(2-nPos) ) // a and ( b or a) -> a or b
{
pNewNode = pSearchCondition->removeAt((sal_uInt32)2);
replaceAndReset(pSearchCondition,pNewNode);
}
- else if ( p2ndSearch->getByRule(OSQLParseNode::boolean_term) )
+ else if ( p2ndSearch->getByRule(OSQLParseNode::search_condition) )
{
// a and ( b or c ) -> ( a and b ) or ( a and c )
// ( b or c ) and a -> ( a and b ) or ( a and c )
@@ -2096,7 +2096,13 @@ void OSQLParseNode::absorptions(OSQLParseNode*& pSearchCondition)
OSQLParseNode* p1stAnd = MakeANDNode(pA,pB);
OSQLParseNode* p2ndAnd = MakeANDNode(new OSQLParseNode(*pA),pC);
pNewNode = MakeORNode(p1stAnd,p2ndAnd);
- replaceAndReset(pSearchCondition,pNewNode);
+ OSQLParseNode* pNode = new OSQLParseNode(::rtl::OUString(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary));
+ pNode->append(new OSQLParseNode(::rtl::OUString::createFromAscii("("),SQL_NODE_PUNCTUATION));
+ pNode->append(pNewNode);
+ pNode->append(new OSQLParseNode(::rtl::OUString::createFromAscii(")"),SQL_NODE_PUNCTUATION));
+ OSQLParseNode::eraseBraces(p1stAnd);
+ OSQLParseNode::eraseBraces(p2ndAnd);
+ replaceAndReset(pSearchCondition,pNode);
}
}
// a or a and b || a or b and a
diff --git a/connectivity/source/resource/conn_shared_res.src b/connectivity/source/resource/conn_shared_res.src
index d143dad1ba0f..48ab06f0f635 100644
--- a/connectivity/source/resource/conn_shared_res.src
+++ b/connectivity/source/resource/conn_shared_res.src
@@ -645,3 +645,8 @@ String STR_NO_DOCUMENTUI
{
Text [ en-US ] = "The provided DocumentUI is not allowed to be NULL.";
};
+String STR_ERROR_NEW_VERSION
+{
+ Text = "The connection could not be established. The database was created by a newer version of %PRODUCTNAME.";
+};
+