Skip to content

Commit fd06bf2

Browse files
committed
Convert remaining catch sites to const references
Follow-up to df437ea / 86c2d02, which made SQLException's getters const and updated the postError overloads + DsnDialog.cpp catch site. This commit applies the same `const` to the remaining 63 catch pairs across OdbcConnection, OdbcStatement, OdbcDesc, OdbcEnv, and the rest of the OdbcJdbcSetup tree, so the codebase is uniformly: catch (const SQLException &ex) { ... } catch (const std::exception &ex) { ... } Pure mechanical change; no behavioral effect.
1 parent 86c2d02 commit fd06bf2

11 files changed

Lines changed: 126 additions & 126 deletions

OdbcConnection.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,12 +1026,12 @@ SQLRETURN OdbcConnection::sqlNativeSql( SQLCHAR * inStatementText, SQLINTEGER te
10261026
outText = (const char *)tempNative;
10271027

10281028
}
1029-
catch (SQLException &ex)
1029+
catch (const SQLException &ex)
10301030
{
10311031
postError( "HY000", ex );
10321032
return SQL_ERROR;
10331033
}
1034-
catch (std::exception &ex)
1034+
catch (const std::exception &ex)
10351035
{
10361036
postError( "HY000", ex );
10371037
return SQL_ERROR;
@@ -1136,14 +1136,14 @@ SQLRETURN OdbcConnection::sqlDisconnect()
11361136
connection = NULL;
11371137
connected = false;
11381138
}
1139-
catch (SQLException &ex)
1139+
catch (const SQLException &ex)
11401140
{
11411141
postError ("01002", ex);
11421142
connection = NULL;
11431143
connected = false;
11441144
return SQL_SUCCESS_WITH_INFO;
11451145
}
1146-
catch (std::exception &ex)
1146+
catch (const std::exception &ex)
11471147
{
11481148
postError ("01002", ex);
11491149
connection = NULL;
@@ -1734,12 +1734,12 @@ SQLRETURN OdbcConnection::connect(const char *sharedLibrary, const char * databa
17341734
WcsToMbs = connection->getConnectionWcsToMbs();
17351735
MbsToWcs = connection->getConnectionMbsToWcs();
17361736
}
1737-
catch (SQLException &ex)
1737+
catch (const SQLException &ex)
17381738
{
17391739
rollbackPartialConnect();
17401740
return sqlReturn( SQL_ERROR, "08004", ex.getText(), ex.getSqlcode() );
17411741
}
1742-
catch (std::exception &ex)
1742+
catch (const std::exception &ex)
17431743
{
17441744
rollbackPartialConnect();
17451745
return sqlReturn( SQL_ERROR, "08004", ex.what(), 0 );
@@ -1767,12 +1767,12 @@ SQLRETURN OdbcConnection::sqlEndTran(int operation)
17671767
connection->rollbackAuto();
17681768
}
17691769
}
1770-
catch (SQLException &ex)
1770+
catch (const SQLException &ex)
17711771
{
17721772
postError ("S1000", ex);
17731773
return SQL_ERROR;
17741774
}
1775-
catch (std::exception &ex)
1775+
catch (const std::exception &ex)
17761776
{
17771777
postError ("S1000", ex);
17781778
return SQL_ERROR;
@@ -1789,12 +1789,12 @@ SQLRETURN OdbcConnection::sqlExecuteCreateDatabase(const char * sqlString)
17891789
{
17901790
connection->sqlExecuteCreateDatabase( sqlString );
17911791
}
1792-
catch (SQLException &ex)
1792+
catch (const SQLException &ex)
17931793
{
17941794
postError( "HY000", ex );
17951795
return SQL_ERROR;
17961796
}
1797-
catch (std::exception &ex)
1797+
catch (const std::exception &ex)
17981798
{
17991799
postError( "HY000", ex );
18001800
return SQL_ERROR;
@@ -2207,11 +2207,11 @@ void OdbcConnection::initUserEvents( PODBC_EVENTS_BLOCK_INFO infoEvents )
22072207
userEventsInterfase->events = infoEvents->events;
22082208
userEventsInterfase->count = infoEvents->count;
22092209
}
2210-
catch (SQLException &ex)
2210+
catch (const SQLException &ex)
22112211
{
22122212
postError( "HY000", ex );
22132213
}
2214-
catch (std::exception &ex)
2214+
catch (const std::exception &ex)
22152215
{
22162216
postError( "HY000", ex );
22172217
}
@@ -2231,11 +2231,11 @@ void OdbcConnection::updateResultEvents( char *updated )
22312231
nextNameEvent->changed = userEvents->isChanged( i );
22322232
}
22332233
}
2234-
catch (SQLException &ex)
2234+
catch (const SQLException &ex)
22352235
{
22362236
postError( "HY000", ex );
22372237
}
2238-
catch (std::exception &ex)
2238+
catch (const std::exception &ex)
22392239
{
22402240
postError( "HY000", ex );
22412241
}
@@ -2247,11 +2247,11 @@ void OdbcConnection::requeueEvents()
22472247
{
22482248
userEvents->queEvents( userEventsInterfase );
22492249
}
2250-
catch (SQLException &ex)
2250+
catch (const SQLException &ex)
22512251
{
22522252
postError( "HY000", ex );
22532253
}
2254-
catch (std::exception &ex)
2254+
catch (const std::exception &ex)
22552255
{
22562256
postError( "HY000", ex );
22572257
}

OdbcDesc.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -805,12 +805,12 @@ SQLRETURN OdbcDesc::sqlGetDescField(int recNumber, int fieldId, SQLPOINTER ptr,
805805
return returnStringInfo (ptr, bufferLength, lengthPtr, (char*)string);
806806

807807
}
808-
catch (SQLException &ex)
808+
catch (const SQLException &ex)
809809
{
810810
postError ("HY000", ex);
811811
return SQL_ERROR;
812812
}
813-
catch (std::exception &ex)
813+
catch (const std::exception &ex)
814814
{
815815
postError ("HY000", ex);
816816
return SQL_ERROR;
@@ -1220,12 +1220,12 @@ SQLRETURN OdbcDesc::sqlGetDescRec( SQLSMALLINT recNumber,
12201220
*scalePtr = record->scale;
12211221
*nullablePtr = record->nullable;
12221222
}
1223-
catch (SQLException &ex)
1223+
catch (const SQLException &ex)
12241224
{
12251225
postError ("HY000", ex);
12261226
return SQL_ERROR;
12271227
}
1228-
catch (std::exception &ex)
1228+
catch (const std::exception &ex)
12291229
{
12301230
postError ("HY000", ex);
12311231
return SQL_ERROR;
@@ -1272,12 +1272,12 @@ SQLRETURN OdbcDesc::sqlSetDescRec( SQLSMALLINT recNumber,
12721272
record->octetLengthPtr = stringLengthPtr;
12731273
record->indicatorPtr = indicatorPtr;
12741274
}
1275-
catch (SQLException &ex)
1275+
catch (const SQLException &ex)
12761276
{
12771277
postError ("HY000", ex);
12781278
return SQL_ERROR;
12791279
}
1280-
catch (std::exception &ex)
1280+
catch (const std::exception &ex)
12811281
{
12821282
postError ("HY000", ex);
12831283
return SQL_ERROR;

OdbcEnv.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ SQLRETURN OdbcEnv::sqlEndTran(int operation)
132132
{
133133
envShare->sqlEndTran (operation);
134134
}
135-
catch (SQLException &ex)
135+
catch (const SQLException &ex)
136136
{
137137
postError ("HY000", ex);
138138
return SQL_ERROR;
139139
}
140-
catch (std::exception &ex)
140+
catch (const std::exception &ex)
141141
{
142142
postError ("HY000", ex);
143143
return SQL_ERROR;
@@ -196,12 +196,12 @@ SQLRETURN OdbcEnv::sqlGetEnvAttr(int attribute, SQLPOINTER ptr, int bufferLength
196196
if (lengthPtr)
197197
*lengthPtr = sizeof (int);
198198
}
199-
catch (SQLException &ex)
199+
catch (const SQLException &ex)
200200
{
201201
postError ("HY000", ex);
202202
return SQL_ERROR;
203203
}
204-
catch (std::exception &ex)
204+
catch (const std::exception &ex)
205205
{
206206
postError ("HY000", ex);
207207
return SQL_ERROR;
@@ -230,12 +230,12 @@ SQLRETURN OdbcEnv::sqlSetEnvAttr(int attribute, SQLPOINTER value, int length)
230230
return sqlReturn (SQL_ERROR, "HYC00", "Optional feature not implemented");
231231
}
232232
}
233-
catch (SQLException &ex)
233+
catch (const SQLException &ex)
234234
{
235235
postError ("HY000", ex);
236236
return SQL_ERROR;
237237
}
238-
catch (std::exception &ex)
238+
catch (const std::exception &ex)
239239
{
240240
postError ("HY000", ex);
241241
return SQL_ERROR;

OdbcJdbcSetup/ServiceClient.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ bool CServiceClient::initServices( const char *sharedLibrary )
8484
if ( !properties )
8585
return false;
8686
}
87-
catch (SQLException &ex)
87+
catch (const SQLException &ex)
8888
{
8989
JString text = ex.getText();
9090

@@ -95,7 +95,7 @@ bool CServiceClient::initServices( const char *sharedLibrary )
9595
return false;
9696
}
9797
}
98-
catch (std::exception &ex)
98+
catch (const std::exception &ex)
9999
{
100100
JString text = ex.what();
101101

@@ -153,7 +153,7 @@ bool CServiceClient::createDatabase()
153153
properties );
154154
connection->close();
155155
}
156-
catch (SQLException &ex)
156+
catch (const SQLException &ex)
157157
{
158158
JString text = ex.getText();
159159

@@ -162,7 +162,7 @@ bool CServiceClient::createDatabase()
162162

163163
return false;
164164
}
165-
catch (std::exception &ex)
165+
catch (const std::exception &ex)
166166
{
167167
JString text = ex.what();
168168

@@ -205,7 +205,7 @@ bool CServiceClient::dropDatabase()
205205
properties );
206206
connection->close();
207207
}
208-
catch (SQLException &ex)
208+
catch (const SQLException &ex)
209209
{
210210
JString text = ex.getText();
211211

@@ -214,7 +214,7 @@ bool CServiceClient::dropDatabase()
214214

215215
return false;
216216
}
217-
catch (std::exception &ex)
217+
catch (const std::exception &ex)
218218
{
219219
JString text = ex.what();
220220

OdbcJdbcSetup/ServiceTabBackup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void CServiceTabBackup::onStartBackup()
234234
SendMessage( hWndBar, PBM_SETPOS, (WPARAM)100 , (LPARAM)NULL );
235235
EnableWindow( GetDlgItem( hDlg, IDC_BUTTON_VIEW_LOG ), !logPathFile.IsEmpty() );
236236
}
237-
catch (SQLException &ex)
237+
catch (const SQLException &ex)
238238
{
239239
writeFooterToLogFile();
240240
EnableWindow( GetDlgItem( hDlg, IDOK ), TRUE );
@@ -245,7 +245,7 @@ void CServiceTabBackup::onStartBackup()
245245
sprintf(buffer, "sqlcode %d, fbcode %d - %s", ex.getSqlcode(), ex.getFbcode(), (const char*)text );
246246
MessageBox( NULL, buffer, TEXT( "Error!" ), MB_ICONERROR | MB_OK );
247247
}
248-
catch (std::exception &ex)
248+
catch (const std::exception &ex)
249249
{
250250
writeFooterToLogFile();
251251
EnableWindow( GetDlgItem( hDlg, IDOK ), TRUE );

OdbcJdbcSetup/ServiceTabRepair.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ void CServiceTabRepair::startRepairDatabase()
301301
SendMessage( hWndBar, PBM_SETPOS, (WPARAM)100 , (LPARAM)NULL );
302302
EnableWindow( GetDlgItem( hDlg, IDC_BUTTON_VIEW_LOG ), !logPathFile.IsEmpty() );
303303
}
304-
catch (SQLException &ex)
304+
catch (const SQLException &ex)
305305
{
306306
writeFooterToLogFile();
307307
EnableWindow( GetDlgItem( hDlg, IDOK ), TRUE );
@@ -312,7 +312,7 @@ void CServiceTabRepair::startRepairDatabase()
312312
sprintf(buffer, "sqlcode %d, fbcode %d - %s", ex.getSqlcode(), ex.getFbcode(), (const char*)text );
313313
MessageBox( NULL, buffer, TEXT( "Error!" ), MB_ICONERROR | MB_OK );
314314
}
315-
catch (std::exception &ex)
315+
catch (const std::exception &ex)
316316
{
317317
writeFooterToLogFile();
318318
EnableWindow( GetDlgItem( hDlg, IDOK ), TRUE );

OdbcJdbcSetup/ServiceTabRestore.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ void CServiceTabRestore::onStartRestore()
263263
SendMessage( hWndBar, PBM_SETPOS, (WPARAM)100 , (LPARAM)NULL );
264264
EnableWindow( GetDlgItem( hDlg, IDC_BUTTON_VIEW_LOG ), !logPathFile.IsEmpty() );
265265
}
266-
catch (SQLException &ex)
266+
catch (const SQLException &ex)
267267
{
268268
writeFooterToLogFile();
269269
EnableWindow( GetDlgItem( hDlg, IDOK ), TRUE );
@@ -274,7 +274,7 @@ void CServiceTabRestore::onStartRestore()
274274
sprintf(buffer, "sqlcode %d, fbcode %d - %s", ex.getSqlcode(), ex.getFbcode(), (const char*)text );
275275
MessageBox( NULL, buffer, TEXT( "Error!" ), MB_ICONERROR | MB_OK );
276276
}
277-
catch (std::exception &ex)
277+
catch (const std::exception &ex)
278278
{
279279
writeFooterToLogFile();
280280
EnableWindow( GetDlgItem( hDlg, IDOK ), TRUE );

OdbcJdbcSetup/ServiceTabStatistics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void CServiceTabStatistics::onStartStatistics()
219219
SendMessage( hWndBar, PBM_SETPOS, (WPARAM)100 , (LPARAM)NULL );
220220
EnableWindow( GetDlgItem( hDlg, IDC_BUTTON_VIEW_LOG ), !logPathFile.IsEmpty() );
221221
}
222-
catch (SQLException &ex)
222+
catch (const SQLException &ex)
223223
{
224224
writeFooterToLogFile();
225225
EnableWindow( GetDlgItem( hDlg, IDOK ), TRUE );
@@ -230,7 +230,7 @@ void CServiceTabStatistics::onStartStatistics()
230230
sprintf(buffer, "sqlcode %d, fbcode %d - %s", ex.getSqlcode(), ex.getFbcode(), (const char*)text );
231231
MessageBox( NULL, buffer, TEXT( "Error!" ), MB_ICONERROR | MB_OK );
232232
}
233-
catch (std::exception &ex)
233+
catch (const std::exception &ex)
234234
{
235235
writeFooterToLogFile();
236236
EnableWindow( GetDlgItem( hDlg, IDOK ), TRUE );

0 commit comments

Comments
 (0)