CRM-15104 fixed some issues with line items creating participants with the API

When you create a participant using the API, and this participant has a fee_level with multiple price field values, the api creates an incorrect line item. This pull request contains a unit test and a fix.

See https://issues.civicrm.org/jira/browse/CRM-15104
To avoid the sql-injection problem, change the variables in the query to % placeholders and make use of the 2nd param to the executeQuery function which takes an array of values and types.