Kaydet (Commit) 84e995c2 authored tarafından Ocke Janssen's avatar Ocke Janssen

better error message when throwing a sqlexception

üst 78988ea8
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: querycomposer.cxx,v $ * $RCSfile: querycomposer.cxx,v $
* *
* $Revision: 1.20 $ * $Revision: 1.21 $
* *
* last change: $Author: oj $ $Date: 2001-01-22 08:22:41 $ * last change: $Author: oj $ $Date: 2001-01-29 09:53:08 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -368,12 +368,19 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S ...@@ -368,12 +368,19 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S
::rtl::OUString aErrorMsg; ::rtl::OUString aErrorMsg;
m_pSqlParseNode = m_aSqlParser.parseTree(aErrorMsg,m_aQuery); m_pSqlParseNode = m_aSqlParser.parseTree(aErrorMsg,m_aQuery);
if(!m_pSqlParseNode) if(!m_pSqlParseNode)
throw SQLException(aErrorMsg,*this,::rtl::OUString::createFromAscii("HY000"),1000,Any()); {
SQLException aError2(aErrorMsg,*this,::rtl::OUString::createFromAscii("HY000"),1000,Any());
SQLException aError1(command,*this,::rtl::OUString::createFromAscii("HY000"),1000,makeAny(aError2));
throw SQLException(m_aSqlParser.getContext().getErrorMessage(OParseContext::ERROR_GENERAL),*this,::rtl::OUString::createFromAscii("HY000"),1000,makeAny(aError1));
}
m_aSqlIterator.setParseTree(m_pSqlParseNode); m_aSqlIterator.setParseTree(m_pSqlParseNode);
m_aSqlIterator.traverseAll(); m_aSqlIterator.traverseAll();
if( m_aSqlIterator.getStatementType() != SQL_STATEMENT_SELECT && m_aSqlIterator.getStatementType() != SQL_STATEMENT_SELECT_COUNT) if( m_aSqlIterator.getStatementType() != SQL_STATEMENT_SELECT && m_aSqlIterator.getStatementType() != SQL_STATEMENT_SELECT_COUNT)
throw SQLException(::rtl::OUString::createFromAscii("No select statement!"),*this,::rtl::OUString::createFromAscii("HY000"),1000,Any()); {
SQLException aError1(command,*this,::rtl::OUString::createFromAscii("HY000"),1000,Any());
throw SQLException(::rtl::OUString::createFromAscii("No select statement!"),*this,::rtl::OUString::createFromAscii("HY000"),1000,makeAny(aError1));
}
m_aWorkSql = STR_SELECT; m_aWorkSql = STR_SELECT;
m_pSqlParseNode->getChild(1)->parseNodeToStr(m_aWorkSql,m_xConnection->getMetaData()); m_pSqlParseNode->getChild(1)->parseNodeToStr(m_aWorkSql,m_xConnection->getMetaData());
...@@ -523,7 +530,7 @@ void SAL_CALL OQueryComposer::appendFilterByColumn( const Reference< XPropertySe ...@@ -523,7 +530,7 @@ void SAL_CALL OQueryComposer::appendFilterByColumn( const Reference< XPropertySe
throw DisposedException(); throw DisposedException();
if(!column.is() || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_VALUE)) if(!column.is() || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_VALUE))
throw SQLException(); throw SQLException(::rtl::OUString::createFromAscii("Column doesn't support the property 'Value'!"),*this,::rtl::OUString::createFromAscii("HY000"),1000,Any());
sal_Int32 nType = 0; sal_Int32 nType = 0;
column->getPropertyValue(PROPERTY_TYPE) >>= nType; column->getPropertyValue(PROPERTY_TYPE) >>= nType;
...@@ -577,7 +584,7 @@ void SAL_CALL OQueryComposer::appendFilterByColumn( const Reference< XPropertySe ...@@ -577,7 +584,7 @@ void SAL_CALL OQueryComposer::appendFilterByColumn( const Reference< XPropertySe
aSql += ::rtl::OUString::createFromAscii("\'"); aSql += ::rtl::OUString::createFromAscii("\'");
} }
else else
throw SQLException(); throw SQLException(::rtl::OUString::createFromAscii("Column value isn't from type Sequence<sal_Int8>!"),*this,::rtl::OUString::createFromAscii("HY000"),1000,Any());
} }
break; break;
default: default:
...@@ -616,7 +623,7 @@ void SAL_CALL OQueryComposer::appendOrderByColumn( const Reference< XPropertySet ...@@ -616,7 +623,7 @@ void SAL_CALL OQueryComposer::appendOrderByColumn( const Reference< XPropertySet
throw DisposedException(); throw DisposedException();
if(!column.is() || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_VALUE)) if(!column.is() || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_VALUE))
throw SQLException(); throw SQLException(::rtl::OUString::createFromAscii("Column doesn't support the property 'Value'!"),*this,::rtl::OUString::createFromAscii("HY000"),1000,Any());
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment