mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
escape apostrophe, use null if text is empty
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@3603 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
85a07894d7
commit
79572d3e09
@ -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