Skip to content

Instantly share code, notes, and snippets.

View jef-n's full-sized avatar

Jürgen Fischer jef-n

  • norBIT GmbH
  • East Frisia
View GitHub Profile
diff -ur ../orig/gdal-2.0.2/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp
--- ../orig/gdal-2.0.2/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp 2016-01-23 18:30:55.000000000 +0100
+++ ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp 2016-03-09 17:14:16.121854000 +0100
@@ -292,6 +292,8 @@
CPLString osEscapedTableNameSingleQuote = OGRPGEscapeString(hPGConn, pszTableName);
const char* pszEscapedTableNameSingleQuote = osEscapedTableNameSingleQuote.c_str();
+ poDS->EndCopy();
+
/* See #1889 for why we don't use 'AND a.attnum = ANY(i.indkey)' */
@jef-n
jef-n / gist:2f9c4fa778d165cdbda0
Created January 23, 2016 00:12
restart transaction when CreateFeature fails
diff -ur ../orig/gdal-2.0.2/apps/ogr2ogr.cpp ./apps/ogr2ogr.cpp
--- ../orig/gdal-2.0.2/apps/ogr2ogr.cpp 2016-01-22 11:51:09.000000000 +0100
+++ ./apps/ogr2ogr.cpp 2016-01-23 00:43:21.392717800 +0100
@@ -4049,6 +4049,17 @@
{
CPLDebug( "OGR2OGR", "Unable to write feature " CPL_FRMT_GIB " into layer %s.\n",
poFeature->GetFID(), poSrcLayer->GetName() );
+
+ if( bLayerTransaction )
+ {
diff --git a/src/core/qgsproject.cpp b/src/core/qgsproject.cpp
index b138afc..61e1248 100644
--- a/src/core/qgsproject.cpp
+++ b/src/core/qgsproject.cpp
@@ -1013,10 +1013,7 @@ bool QgsProject::write()
QDomImplementation DomImplementation;
DomImplementation.setInvalidDataPolicy( QDomImplementation::DropInvalidChars );
- QDomDocumentType documentType =
- DomImplementation.createDocumentType( "qgis", "http://mrcc.com/qgis.dtd",
@jef-n
jef-n / pk-verify.diff
Created October 21, 2015 22:36
verify unique constraint it NOT NULL is not set on key columns
diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp
index 6df1d82..de6bb59 100644
--- a/src/providers/postgres/qgspostgresprovider.cpp
+++ b/src/providers/postgres/qgspostgresprovider.cpp
@@ -1196,17 +1196,28 @@ bool QgsPostgresProvider::determinePrimaryKey()
{
// have a primary key or unique index
QString indrelid = res.PQgetvalue( 0, 0 );
- sql = QString( "SELECT attname FROM pg_index,pg_attribute WHERE indexrelid=%1 AND indrelid=attrelid AND pg_attribute.attnum=any(pg_index.indkey)" ).arg( indrelid );
+ sql = QString( "SELECT attname,attnotnull FROM pg_index,pg_attribute WHERE indexrelid=%1 AND indrelid=attrelid AND pg_attribute.attnum=any(pg_index.indkey)" ).arg( indrelid );
ScriptAlias /qgis/ /home/fischer/src/qgis/debian/build/output/bin/
SetEnv QGIS_LOG_FILE /tmp/qgis_mapserv.log
SetEnv QGIS_DEBUG 3
SetEnv QGIS_OPTIONS_PATH /etc/qgis
<Directory "/home/fischer/src/qgis/debian/build/output/bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
diff --git a/src/python/qgspythonutilsimpl.cpp b/src/python/qgspythonutilsimpl.cpp
index 10bbc72..03417c4 100644
--- a/src/python/qgspythonutilsimpl.cpp
+++ b/src/python/qgspythonutilsimpl.cpp
@@ -49,9 +49,8 @@ QgsPythonUtilsImpl::~QgsPythonUtilsImpl()
#endif
}
-bool QgsPythonUtilsImpl::checkSystemImports() {
-
diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp
index 19516e7..98bd7a9 100644
--- a/src/providers/postgres/qgspostgresprovider.cpp
+++ b/src/providers/postgres/qgspostgresprovider.cpp
@@ -2487,8 +2487,8 @@ QgsRectangle QgsPostgresProvider::extent()
sql = QString( "SELECT %1(%2,%3,%4)" )
.arg( connectionRO()->majorVersion() < 2 ? "estimated_extent" :
( connectionRO()->majorVersion() == 2 && connectionRO()->minorVersion() < 1 ? "st_estimated_extent" : "st_estimatedextent" ) )
- .arg( quotedValue( mSchemaName ) )
- .arg( quotedValue( mTableName ) )
f=QgsFeature()
for x in range(0,100,10):
for y in range(0,100,10):
f.setGeometry( QgsGeometry.fromRect( QgsRectangle( x, y, x+10, y+10 ) ) )
iface.activeLayer().addFeature(f)
diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp
index 580c2da..8f9062d 100644
--- a/src/providers/wms/qgswmsprovider.cpp
+++ b/src/providers/wms/qgswmsprovider.cpp
@@ -123,7 +123,8 @@ QgsWmsProvider::QgsWmsProvider( QString const& uri, const QgsWmsCapabilities* ca
return;
}
- addLayers();
+ if( !addLayers() )
diff --git a/src/gui/qgsexpressionbuilderwidget.cpp b/src/gui/qgsexpressionbuilderwidget.cpp
index f7182f5..49a434d 100644
--- a/src/gui/qgsexpressionbuilderwidget.cpp
+++ b/src/gui/qgsexpressionbuilderwidget.cpp
@@ -149,7 +149,7 @@ void QgsExpressionBuilderWidget::saveFunctionFile( QString fileName )
fileName = mFunctionsPath + QDir::separator() + fileName;
QFile myFile( fileName );
- if ( myFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
+ if ( myFile.open( QIODevice::WriteOnly ) )