summaryrefslogtreecommitdiffstats
path: root/connectivity/source/parse
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-02-24 14:02:06 +0200
committerNoel Grandin <noel@peralex.com>2016-02-25 13:50:24 +0200
commit6a9046d02e17a7dd0997aa3a041d468be9d8f80b (patch)
tree22caf4c1ed549be92eaffc8a88fd848ee9dc30db /connectivity/source/parse
parentnss: remove obvious cruft from README (diff)
downloadcore-6a9046d02e17a7dd0997aa3a041d468be9d8f80b.tar.gz
core-6a9046d02e17a7dd0997aa3a041d468be9d8f80b.zip
convert ErrorCode to scoped enum
Change-Id: I37d2dd0b84fce229b548bbe941cfdd1169170af9
Diffstat (limited to 'connectivity/source/parse')
-rw-r--r--connectivity/source/parse/sqlbison.y38
-rw-r--r--connectivity/source/parse/sqliterator.cxx16
-rw-r--r--connectivity/source/parse/sqlnode.cxx18
3 files changed, 36 insertions, 36 deletions
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index 0b657fd74264..c9f8bbadc68c 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -4305,26 +4305,26 @@ OParseContext::~OParseContext()
OUString OParseContext::getErrorMessage(ErrorCode _eCode) const
{
- OUString aMsg;
- switch (_eCode)
- {
- case ERROR_GENERAL: aMsg = "Syntax error in SQL expression"; break;
- case ERROR_VALUE_NO_LIKE: aMsg = "The value #1 can not be used with LIKE."; break;
- case ERROR_FIELD_NO_LIKE: aMsg = "LIKE can not be used with this field."; break;
- case ERROR_INVALID_COMPARE: aMsg = "The entered criterion can not be compared with this field."; break;
- case ERROR_INVALID_INT_COMPARE: aMsg = "The field can not be compared with a number."; break;
- case ERROR_INVALID_DATE_COMPARE: aMsg = "The field can not be compared with a date."; break;
- case ERROR_INVALID_REAL_COMPARE: aMsg = "The field can not be compared with a floating point number."; break;
- case ERROR_INVALID_TABLE_NOSUCH: aMsg = "The database does not contain a table named \"#\"."; break;
- case ERROR_INVALID_TABLE_OR_QUERY: aMsg = "The database does contain neither a table nor a query named \"#\"."; break;
- case ERROR_INVALID_COLUMN: aMsg = "The column \"#1\" is unknown in the table \"#2\"."; break;
- case ERROR_INVALID_TABLE_EXIST: aMsg = "The database already contains a table or view with name \"#\"."; break;
- case ERROR_INVALID_QUERY_EXIST: aMsg = "The database already contains a query with name \"#\"."; break;
+ OUString aMsg;
+ switch (_eCode)
+ {
+ case ErrorCode::General: aMsg = "Syntax error in SQL expression"; break;
+ case ErrorCode::ValueNoLike: aMsg = "The value #1 can not be used with LIKE."; break;
+ case ErrorCode::FieldNoLike: aMsg = "LIKE can not be used with this field."; break;
+ case ErrorCode::InvalidCompare: aMsg = "The entered criterion can not be compared with this field."; break;
+ case ErrorCode::InvalidIntCompare: aMsg = "The field can not be compared with a number."; break;
+ case ErrorCode::InvalidDateCompare: aMsg = "The field can not be compared with a date."; break;
+ case ErrorCode::InvalidRealCompare: aMsg = "The field can not be compared with a floating point number."; break;
+ case ErrorCode::InvalidTableNosuch: aMsg = "The database does not contain a table named \"#\"."; break;
+ case ErrorCode::InvalidTableOrQuery: aMsg = "The database does contain neither a table nor a query named \"#\"."; break;
+ case ErrorCode::InvalidColumn: aMsg = "The column \"#1\" is unknown in the table \"#2\"."; break;
+ case ErrorCode::InvalidTableExist: aMsg = "The database already contains a table or view with name \"#\"."; break;
+ case ErrorCode::InvalidQueryExist: aMsg = "The database already contains a query with name \"#\"."; break;
default:
OSL_FAIL( "OParseContext::getErrorMessage: unknown error code!" );
break;
- }
- return aMsg;
+ }
+ return aMsg;
}
@@ -4585,7 +4585,7 @@ OSQLParseNode* OSQLParser::parseTree(OUString& rErrorMessage,
if (m_sErrorMessage.isEmpty())
m_sErrorMessage = s_pScanner->getErrorMessage();
if (m_sErrorMessage.isEmpty())
- m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_GENERAL);
+ m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ErrorCode::General);
rErrorMessage = m_sErrorMessage;
@@ -4747,7 +4747,7 @@ sal_Int16 OSQLParser::buildStringNodes(OSQLParseNode*& pLiteral)
}
if(SQL_ISRULE(pLiteral,term) || SQL_ISRULE(pLiteral,value_exp_primary))
{
- m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_INVALID_COMPARE);
+ m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ErrorCode::InvalidCompare);
return 0;
}
return 1;
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index a32e5e5ca9f7..309674ef271d 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -381,9 +381,9 @@ OSQLTable OSQLParseTreeIterator::impl_locateRecordSource( const OUString& _rComp
if ( SQL_STATEMENT_CREATE_TABLE == m_eStatementType )
{
if ( bQueryDoesExist )
- impl_appendError( IParseContext::ERROR_INVALID_QUERY_EXIST, &sName );
+ impl_appendError( IParseContext::ErrorCode::InvalidQueryExist, &sName );
else if ( bTableDoesExist )
- impl_appendError( IParseContext::ERROR_INVALID_TABLE_EXIST, &sName );
+ impl_appendError( IParseContext::ErrorCode::InvalidTableExist, &sName );
else
aReturn = impl_createTableObject( sName, sCatalog, sSchema );
}
@@ -412,15 +412,15 @@ OSQLTable OSQLParseTreeIterator::impl_locateRecordSource( const OUString& _rComp
if ( m_pImpl->m_xQueryContainer.is() )
// the connection on which we're working supports sub queries in from (else
// m_xQueryContainer would not have been set), so emit a better error message
- impl_appendError( IParseContext::ERROR_INVALID_TABLE_OR_QUERY, &sName );
+ impl_appendError( IParseContext::ErrorCode::InvalidTableOrQuery, &sName );
else
- impl_appendError( IParseContext::ERROR_INVALID_TABLE_NOSUCH, &sName );
+ impl_appendError( IParseContext::ErrorCode::InvalidTableNosuch, &sName );
}
}
}
catch(Exception&)
{
- impl_appendError( IParseContext::ERROR_INVALID_TABLE_NOSUCH, &sComposedName );
+ impl_appendError( IParseContext::ErrorCode::InvalidTableNosuch, &sComposedName );
}
return aReturn;
@@ -860,7 +860,7 @@ void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNo
if (!pSelectNode || m_eStatementType != SQL_STATEMENT_CREATE_TABLE || m_pImpl->m_pTables->empty())
{
- impl_appendError( IParseContext::ERROR_GENERAL );
+ impl_appendError( IParseContext::ErrorCode::General );
return;
}
if (!SQL_ISRULE(pSelectNode,base_table_element_commalist))
@@ -921,7 +921,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele
if (!pSelectNode || m_eStatementType != SQL_STATEMENT_SELECT || m_pImpl->m_pTables->empty())
{
- impl_appendError( IParseContext::ERROR_GENERAL );
+ impl_appendError( IParseContext::ErrorCode::General );
return false;
}
@@ -1653,7 +1653,7 @@ void OSQLParseTreeIterator::appendColumns(::rtl::Reference<OSQLColumns>& _rColum
_rColumns->get().push_back(xCol);
}
else
- impl_appendError( IParseContext::ERROR_INVALID_COLUMN, pBegin, &_rTableAlias );
+ impl_appendError( IParseContext::ErrorCode::InvalidColumn, pBegin, &_rTableAlias );
}
}
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 1d1638dd1a76..3cddde3044bd 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -849,7 +849,7 @@ OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType, OSQLParseNode* pLiteral)
pReturn = buildDate( nType, pReturn);
break;
default:
- m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_INVALID_COMPARE);
+ m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ErrorCode::InvalidCompare);
break;
}
break;
@@ -862,10 +862,10 @@ OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType, OSQLParseNode* pLiteral)
if ( m_xFormatter.is() )
pReturn = buildDate( nType, pReturn);
else
- m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_INVALID_DATE_COMPARE);
+ m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ErrorCode::InvalidDateCompare);
break;
default:
- m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_INVALID_COMPARE);
+ m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ErrorCode::InvalidCompare);
break;
}
break;
@@ -893,7 +893,7 @@ OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType, OSQLParseNode* pLiteral)
pReturn = buildNode_STR_NUM(pReturn);
break;
default:
- m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_INVALID_INT_COMPARE);
+ m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ErrorCode::InvalidIntCompare);
break;
}
break;
@@ -916,7 +916,7 @@ OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType, OSQLParseNode* pLiteral)
break;
case DataType::INTEGER:
default:
- m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_INVALID_REAL_COMPARE);
+ m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ErrorCode::InvalidRealCompare);
break;
}
break;
@@ -1018,14 +1018,14 @@ sal_Int16 OSQLParser::buildLikeRule(OSQLParseNode* pAppend, OSQLParseNode*& pLit
nErg = 1;
break;
default:
- m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_VALUE_NO_LIKE);
+ m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ErrorCode::ValueNoLike);
m_sErrorMessage = m_sErrorMessage.replaceAt(m_sErrorMessage.indexOf("#1"),2,pLiteral->getTokenValue());
break;
}
}
break;
default:
- m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_FIELD_NO_LIKE);
+ m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ErrorCode::FieldNoLike);
break;
}
return nErg;
@@ -1271,7 +1271,7 @@ OSQLParseNode* OSQLParser::predicateTree(OUString& rErrorMessage, const OUString
if (m_sErrorMessage.isEmpty())
m_sErrorMessage = s_pScanner->getErrorMessage();
if (m_sErrorMessage.isEmpty())
- m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_GENERAL);
+ m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ErrorCode::General);
rErrorMessage = m_sErrorMessage;
@@ -1569,7 +1569,7 @@ OSQLParseNode* OSQLParser::buildDate(sal_Int32 _nType,OSQLParseNode*& pLiteral)
pLiteral = nullptr;
if ( !pFCTNode )
- m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ERROR_INVALID_DATE_COMPARE);
+ m_sErrorMessage = m_pContext->getErrorMessage(IParseContext::ErrorCode::InvalidDateCompare);
return pFCTNode;
}