mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
escape apostrophe, use null if text is empty
git-svn-id: http://svn.osgeo.org/qgis/trunk@3603 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
de041a542b
commit
2d1e8bf206
@ -252,12 +252,20 @@ void QgsGrassAttributes::updateAttributes ( )
|
||||
for ( int i = 2; i < tb->numRows(); i++ ) {
|
||||
if ( i > 2 ) sql.append (", ");
|
||||
|
||||
if ( tb->text(i, 2) == "int" || tb->text(i, 2) == "double" ) {
|
||||
sql.append ( tb->text(i, 0) + " = " + tb->text(i, 1) );
|
||||
} else {
|
||||
QString val = tb->text(i, 1);
|
||||
val.replace("'","''");
|
||||
sql.append ( tb->text(i, 0) + " = '" + tb->text(i, 1) + "'" );
|
||||
QString val = tb->text(i, 1).stripWhiteSpace();
|
||||
|
||||
if ( val.isEmpty() )
|
||||
{
|
||||
sql.append ( tb->text(i, 0) + " = null" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( tb->text(i, 2) == "int" || tb->text(i, 2) == "double" ) {
|
||||
sql.append ( tb->text(i, 0) + " = " + val );
|
||||
} else {
|
||||
val.replace("'","''");
|
||||
sql.append ( tb->text(i, 0) + " = '" + val + "'" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user