Skip to content
Permalink
Browse files

oracle provider: add updates on lob fields

  • Loading branch information
jef-n committed Sep 3, 2016
1 parent 8688fef commit b61d932fc4b44669bf0094d76089d8c6bc129da6
Showing with 26 additions and 12 deletions.
  1. +26 −12 src/providers/oracle/qgsoracleprovider.cpp
@@ -1743,7 +1743,7 @@ bool QgsOracleProvider::changeAttributeValues( const QgsChangedAttributesMap &at
QString sql = QString( "UPDATE %1 SET " ).arg( mQuery );

bool pkChanged = false;
QList<int> geometryParams;
QList<int> params;

// cycle through the changed attributes of the feature
QString delim;
@@ -1764,10 +1764,15 @@ bool QgsOracleProvider::changeAttributeValues( const QgsChangedAttributesMap &at
sql += QString( "SDO_UTIL.FROM_WKTGEOMETRY(%1)" ).arg( quotedValue( siter->toString() ) );
else
{
geometryParams << siter.key();
params << siter.key();
sql += "?";
}
}
else if ( fld.typeName().endsWith( "LOB" ) )
{
params << siter.key();
sql += "?";
}
else
{
sql += quotedValue( *siter, fld.type() );
@@ -1786,21 +1791,30 @@ bool QgsOracleProvider::changeAttributeValues( const QgsChangedAttributesMap &at
throw OracleException( tr( "Could not prepare update statement." ), qry );
}

Q_FOREACH ( int idx, geometryParams )
Q_FOREACH ( int idx, params )
{
QgsGeometry *g;
if ( !attrs[idx].isNull() )
const QgsField &fld = field( idx );

if ( fld.typeName().endsWith( ".SDO_GEOMETRY" ) )
{
g = QgsGeometry::fromWkt( attrs[ idx ].toString() );
QgsGeometry *g;
if ( !attrs[idx].isNull() )
{
g = QgsGeometry::fromWkt( attrs[ idx ].toString() );
}
else
{
g = new QgsGeometry();
}

appendGeomParam( g, qry );

delete g;
}
else
else if ( fld.typeName().endsWith( "LOB" ) )
{
g = new QgsGeometry();
qry.addBindValue( attrs[ idx ] );
}

appendGeomParam( g, qry );

delete g;
}

if ( !qry.exec() )

0 comments on commit b61d932

Please sign in to comment.
You can’t perform that action at this time.