Skip to content
Permalink
Browse files

oracle provider: add updates on lob fields

(cherry picked from commit b61d932)
  • Loading branch information
jef-n committed Sep 3, 2016
1 parent 474b9d8 commit 0036274a412319d63150a788a79d541177234dc4
Showing with 22 additions and 8 deletions.
  1. +22 −8 src/providers/oracle/qgsoracleprovider.cpp
@@ -1741,7 +1741,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;
@@ -1762,10 +1762,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() );
@@ -1784,15 +1789,24 @@ 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() );
}

appendGeomParam( g, qry );
QgsGeometry g;
if ( !attrs[idx].isNull() )
{
g = QgsGeometry::fromWkt( attrs[ idx ].toString() );
}
appendGeomParam( g, qry );
}
else if ( fld.typeName().endsWith( "LOB" ) )
{
qry.addBindValue( attrs[ idx ] );
}
}

if ( !qry.exec() )

0 comments on commit 0036274

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