Skip to content

Commit 93266ac

Browse files
committed
support strange mysql quoting
1 parent cbef41c commit 93266ac

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/providers/ogr/qgsogrprovider.cpp

+13-4
Original file line numberDiff line numberDiff line change
@@ -2241,10 +2241,19 @@ QVariant QgsOgrProvider::maximumValue( int index )
22412241

22422242
QString QgsOgrProvider::quotedIdentifier( QString field )
22432243
{
2244-
field.replace( '\\', "\\\\" );
2245-
field.replace( '"', "\\\"" );
2246-
field.replace( "'", "\\'" );
2247-
return field.prepend( "\"" ).append( "\"" );
2244+
if ( ogrDriverName == "MySQL" )
2245+
{
2246+
field.replace( '\\', "\\\\" );
2247+
field.replace( "`", "``" );
2248+
return field.prepend( "`" ).append( "`" );
2249+
}
2250+
else
2251+
{
2252+
field.replace( '\\', "\\\\" );
2253+
field.replace( '"', "\\\"" );
2254+
field.replace( "'", "\\'" );
2255+
return field.prepend( "\"" ).append( "\"" );
2256+
}
22482257
}
22492258

22502259
bool QgsOgrProvider::syncToDisc()

0 commit comments

Comments
 (0)