Permalink
Browse files

Backport #4928 and #5356

  • Loading branch information...
tbonfort committed Dec 1, 2016
1 parent a0437f8 commit 022d24bd34196b6dca67053fb797a6980210bc54
Showing with 30 additions and 26 deletions.
  1. +28 −24 mapogr.cpp
  2. +2 −2 mappostgis.c
View
@@ -1118,18 +1118,15 @@ msOGRFileOpen(layerObj *layer, const char *connection )
RELEASE_OGR_LOCK;
if( hDS == NULL ) {
if( strlen(CPLGetLastErrorMsg()) == 0 )
msSetError(MS_OGRERR,
"Open failed for OGR connection in layer `%s'. "
"File not found or unsupported format.",
"msOGRFileOpen()",
layer->name?layer->name:"(null)" );
else
msSetError(MS_OGRERR,
"Open failed for OGR connection in layer `%s'.\n%s\n",
"msOGRFileOpen()",
layer->name?layer->name:"(null)",
CPLGetLastErrorMsg() );
msSetError(MS_OGRERR,
"Open failed for OGR connection in layer `%s'. "
"Check logs.",
"msOGRFileOpen()",
layer->name?layer->name:"(null)" );
if( strlen(CPLGetLastErrorMsg()) != 0 )
msDebug("Open failed for OGR connection in layer `%s'.\n%s\n",
layer->name?layer->name:"(null)",
CPLGetLastErrorMsg() );
CPLFree( pszDSName );
CPLFree( pszLayerDef );
return NULL;
@@ -1154,10 +1151,13 @@ msOGRFileOpen(layerObj *layer, const char *connection )
ACQUIRE_OGR_LOCK;
hLayer = OGR_DS_ExecuteSQL( hDS, pszLayerDef, NULL, NULL );
if( hLayer == NULL ) {
msSetError(MS_OGRERR,
"ExecuteSQL(%s) failed.\n%s",
"msOGRFileOpen()",
pszLayerDef, CPLGetLastErrorMsg() );
msSetError(MS_OGRERR,
"ExecuteSQL(%s) failed. Check logs",
"msOGRFileOpen()",
pszLayerDef);
msDebug(
"ExecuteSQL(%s) failed.\n%s",
pszLayerDef, CPLGetLastErrorMsg() );
RELEASE_OGR_LOCK;
msConnPoolRelease( layer, hDS );
CPLFree( pszLayerDef );
@@ -1189,9 +1189,11 @@ msOGRFileOpen(layerObj *layer, const char *connection )
}
if (hLayer == NULL) {
msSetError(MS_OGRERR, "GetLayer(%s) failed for OGR connection `%s'.",
"msOGRFileOpen()",
pszLayerDef, connection );
msSetError(MS_OGRERR, "GetLayer(%s) failed for OGR connection. Check logs.",
"msOGRFileOpen()",
pszLayerDef);
msDebug("GetLayer(%s) failed for OGR connection `%s'.",
pszLayerDef, connection );
CPLFree( pszLayerDef );
msConnPoolRelease( layer, hDS );
return NULL;
@@ -1353,10 +1355,12 @@ static int msOGRFileWhichShapes(layerObj *layer, rectObj rect,
if( OGR_L_SetAttributeFilter( psInfo->hLayer, layer->filter.string+6 )
!= OGRERR_NONE ) {
msSetError(MS_OGRERR,
"SetAttributeFilter(%s) failed on layer %s.\n%s",
"SetAttributeFilter(%s) failed on layer %s.",
"msOGRFileWhichShapes()",
layer->filter.string+6, layer->name?layer->name:"(null)",
CPLGetLastErrorMsg() );
layer->filter.string+6, layer->name?layer->name:"(null)");
msDebug("SetAttributeFilter(%s) failed on layer %s.\n%s",
layer->filter.string+6, layer->name?layer->name:"(null)",
CPLGetLastErrorMsg() );
RELEASE_OGR_LOCK;
return MS_FAILURE;
}
@@ -1559,8 +1563,8 @@ msOGRFileNextShape(layerObj *layer, shapeObj *shape,
if( (hFeature = OGR_L_GetNextFeature( psInfo->hLayer )) == NULL ) {
psInfo->last_record_index_read = -1;
if( CPLGetLastErrorType() == CE_Failure ) {
msSetError(MS_OGRERR, "%s", "msOGRFileNextShape()",
CPLGetLastErrorMsg() );
msSetError(MS_OGRERR, "OGR error. check logs", "msOGRFileNextShape()");
msDebug("msOGRFileNextShape() error: %s", CPLGetLastErrorMsg() );
RELEASE_OGR_LOCK;
return MS_FAILURE;
} else {
View
@@ -2309,7 +2309,8 @@ int msPostGISLayerOpen(layerObj *layer)
}
}
msSetError(MS_QUERYERR, "Database connection failed (%s) with connect string '%s'\nIs the database running? Is it allowing connections? Does the specified user exist? Is the password valid? Is the database on the standard port?", "msPostGISLayerOpen()", PQerrorMessage(layerinfo->pgconn), maskeddata);
msDebug("Database connection failed (%s) with connect string '%s'\nIs the database running? Is it allowing connections? Does the specified user exist? Is the password valid? Is the database on the standard port?.\n", PQerrorMessage(layerinfo->pgconn), maskeddata);
msSetError(MS_QUERYERR, "Database connection failed.\nIs the database running? Is it allowing connections? Does the specified user exist? Is the password valid? Is the database on the standard port?", "msPostGISLayerOpen()");
if(layerinfo->pgconn) PQfinish(layerinfo->pgconn);
free(maskeddata);
@@ -2336,7 +2337,6 @@ int msPostGISLayerOpen(layerObj *layer)
* times there will be a leak... */
return MS_FAILURE;
}
}
}

0 comments on commit 022d24b

Please sign in to comment.