views:

252

answers:

0

By the looks of the SugarCRM soap api you just seem to pass raw SQL into the restriction part of the get_entry_list function call.

Is there a way to escape the values being passed into the restriction correctly without knowing the target database the SugarCRM instance is running on ?

For example if I have something like

// connect to soap server running on sugarcrm
$client = new SoapClient(NULL, $options);

// login to the soap server

// get all the accounts with a specific name
$response = $client->get_entry_list($session_id, 'Accounts', 'name = "'.$name.'"');

how am I supposed to correctly escape $name ?

Do I just have to know that my target instance is running on MySQL and that my php version is new enough that I have to use mysql_real_escape_string and establish a link to the crm db first so that it uses the correct character set for escaping my variable ?

I'm hoping there is a better way that I don't know about.