[fdo-commits] r670 -
branches/fdordbms-postgis/Providers/GenericRdbms/Src/Gdbi
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Mon Jan 22 20:53:58 EST 2007
Author: mloskot
Date: 2007-01-22 20:53:58 -0500 (Mon, 22 Jan 2007)
New Revision: 670
Modified:
branches/fdordbms-postgis/Providers/GenericRdbms/Src/Gdbi/GdbiQueryResult.cpp
Log:
Include column name of missing column, in exception message.
Modified: branches/fdordbms-postgis/Providers/GenericRdbms/Src/Gdbi/GdbiQueryResult.cpp
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/Gdbi/GdbiQueryResult.cpp 2007-01-22 22:24:44 UTC (rev 669)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/Gdbi/GdbiQueryResult.cpp 2007-01-23 01:53:58 UTC (rev 670)
@@ -92,13 +92,21 @@
int idx = 1;
bool status = false;
- while( m_pGdbiCommands->desc_slct( m_QueryId->GetQueryId(), idx++, name_length, colName, &colInfo->type, &colInfo->size, &colInfo->null_allowed) == RDBI_SUCCESS )
+ while (m_pGdbiCommands->desc_slct(m_QueryId->GetQueryId(), idx++, name_length,
+ colName, &colInfo->type, &colInfo->size, &colInfo->null_allowed) == RDBI_SUCCESS)
{
FdoStringP upperName = FdoStringP(colName).Upper();
const wchar_t* name = (const wchar_t*)upperName;
+
if (mColMap->find (name) != mColMap->end())
- continue; // TODO: throw new GdbiException(FdoCommonNlsUtil::NLSGetMessage( FDORDBMS_495, "Duplicate columns of name '%1$ls' found in query result.", fdordbms_cat, name));
+ {
+ // TODO: throw new GdbiException(FdoCommonNlsUtil::NLSGetMessage(
+ // FDORDBMS_495, "Duplicate columns of name '%1$ls' found in query result.",
+ // fdordbms_cat, name));
+ continue;
+ }
+
mColMap->insert( std::pair<std::wstring,GdbiColumnInfoType*> ( name, colInfo ) );
colInfo->original_type = colInfo->type;
colInfo->index = idx-1;
@@ -128,12 +136,13 @@
{
for (int i = 0; i < m_pGdbiCommands->get_array_size(); i++)
{
- m_pGdbiCommands->lob_create_ref( m_QueryId->GetQueryId(), (void **)&(colInfo->value));
+ m_pGdbiCommands->lob_create_ref(m_QueryId->GetQueryId(), (void **)&(colInfo->value));
}
}
else
{
- if( ( m_pGdbiCommands->SupportsUnicode() && colInfo->type == RDBI_STRING ) || colInfo->type == RDBI_WSTRING )
+ if((m_pGdbiCommands->SupportsUnicode() && colInfo->type == RDBI_STRING)
+ || colInfo->type == RDBI_WSTRING)
{
int size = colInfo->size * m_pGdbiCommands->get_array_size();
colInfo->value = new wchar_t[size];
@@ -145,11 +154,15 @@
{
int size = colInfo->size * m_pGdbiCommands->get_array_size();
colInfo->value = new char[size];
- memset( colInfo->value, '\0', size );
+ memset(colInfo->value, '\0', size );
}
}
- m_pGdbiCommands->define( m_QueryId->GetQueryId(), FdoCommonOSUtil::itoa(colInfo->index, buffer), colInfo->type, colInfo->size, (colInfo->type == RDBI_BLOB_REF) ? (char *)&(colInfo->value) : (char*)colInfo->value, colInfo->isNull );
+ m_pGdbiCommands->define(m_QueryId->GetQueryId(),
+ FdoCommonOSUtil::itoa(colInfo->index, buffer),
+ colInfo->type, colInfo->size,
+ (colInfo->type == RDBI_BLOB_REF) ? (char*)&(colInfo->value) : (char*)colInfo->value,
+ colInfo->isNull);
}
@@ -309,7 +322,11 @@
return RDBI_SUCCESS;
}
- throw new GdbiException(L"Column X not selected");
+ // TODO: mloskot - Change for easier debugging
+ // Original code: throw new GdbiException(L"Column X not selected");
+
+ throw new GdbiException(
+ FdoStringP::Format(L"Column %ls not selected", upperName));
}
int GdbiQueryResult::GetAsciiValue( const wchar_t *colName, int length, char *address, bool *null_ind, int *ccode )
@@ -385,7 +402,11 @@
return RDBI_SUCCESS;
}
- throw new GdbiException(L"Column X not selected");
+ // TODO: mloskot - Change for easier debugging
+ // Original code: throw new GdbiException(L"Column X not selected");
+
+ throw new GdbiException(
+ FdoStringP::Format(L"Column %ls not selected", upperName));
}
template<typename T> T GdbiQueryResult::GetNumber(
@@ -478,7 +499,12 @@
return val;
}
- throw new GdbiException(L"Column X not selected");
+
+ // TODO: mloskot - Change for easier debugging
+ // Original code: throw new GdbiException(L"Column X not selected");
+
+ throw new GdbiException(
+ FdoStringP::Format(L"Column %ls not selected", upperName));
}
FdoDouble GdbiQueryResult::GetDouble( const wchar_t *ColName, bool *isnull, int *ccode )
@@ -575,23 +601,30 @@
return mUnicodeBuffer;
}
- throw new GdbiException(L"Column X not selected");
+ // TODO: mloskot - Change for easier debugging
+ // Original code: throw new GdbiException(L"Column X not selected");
+
+ throw new GdbiException(
+ FdoStringP::Format(L"Column %ls not selected", upperName));
}
FdoString* GdbiQueryResult::GetString( int index, bool *isnull, int *ccode )
{
- if( mColMap )
+ typedef std::map<std::wstring, GdbiColumnInfoType*> ColumnsMap;
+
+ if( mColMap )
{
- for (std::map <std::wstring,GdbiColumnInfoType*>::iterator i = mColMap->begin(); i != mColMap->end(); ++i )
+ for (ColumnsMap::iterator i = mColMap->begin(); i != mColMap->end(); ++i)
{
GdbiColumnInfoType *colInfo = i->second;
if( colInfo->index == index )
- {
- return GetString( i->first.c_str() , isnull, ccode );
- }
+ {
+ return GetString( i->first.c_str() , isnull, ccode );
+ }
}
}
- throw new GdbiException(L"Column X not selected");
+
+ throw new GdbiException(L"Column X not selected");
}
FdoBoolean GdbiQueryResult::GetBoolean( const wchar_t *ColName, bool *isnull, int *ccode )
@@ -616,7 +649,12 @@
return ( m_pGdbiCommands->is_null( colInfo->isNull, mArrayPos ) == 1 );
}
- throw new GdbiException(L"Column X not selected");
+
+ // TODO: mloskot - Change for easier debugging
+ // Original code: throw new GdbiException(L"Column X not selected");
+
+ throw new GdbiException(
+ FdoStringP::Format(L"Column %ls not selected", upperName));
}
void GdbiQueryResult::do_copy(char *ascii_I, char *ascii_O, int len, int *ccode)
{
More information about the fdo-commits
mailing list