rlarranaga / bafprp

Automatically exported from code.google.com/p/bafprp
0 stars 0 forks source link

mysql escaped fields #36

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure if this is a bug or not, but I was trying to add a new field into my 
database, and it wasn't working.

in the mysqloutput.cpp file, starting on like 224, I changed the code to 
include the mysql escape character for field names:
            if( itr->second == "int" || itr->second == "bigint" )
            {
                query1 << "`" << itr->first << "`, ";
                query2 << "'" << field->getLong() << "', ";
            }
            else if( itr->second == "decimal" || itr->second == "float" )
            {
                query1 << "`" << itr->first << "`, ";
                query2 << "'" << field->getFloat() << "', ";
            }
            else
            {
                query1 << "`" << itr->first << "`, ";
                query2 << "'" << sanitize( field->getString() ) << "', ";
            }

this allows field names like "m164.largedigits" to be imported to the database.

I wasn't sure if there was a better way to do this, but it works fine.

Steve

Original issue reported on code.google.com by thestapl...@gmail.com on 13 Jun 2011 at 8:12

GoogleCodeExporter commented 9 years ago
Thanks for the report.  I remember fixing the escaped names, but I am unsure if 
it was released or not.  I believe this is fixed on the trunk.
Im going to leave this open until I can make sure and so I remember that I need 
to roll a new release.

Original comment by charless...@gmail.com on 21 Jun 2011 at 9:01