Mysql Data not writing intermittently

We are using an ivr to collect data and write it to a mysql database. The dialplan typically works, however randomly a call will have no data recorded in the mysql table. When this happens i see the warnings listed below. I am currently running Asterisk 1.6.1.11 but i have seen this problem occur in 1.4 compiles as well.

Example of the dialplan being executed
[macro-updateCID]
exten => s,1,SET(nextPri=$[${MACRO_PRIORITY} + 1 ] )

exten => s,n,MYSQL(Query result ${connid} INSERT INTO CaseIDTable(Date,EmployeeID,JobNumber,StudyCode,CaseID,SessionID,Mode,CPI,ProdDate) VALUES (Now(),‘IVR’,${ARG1},’${ARG2}’,${ARG3},${ARG3},‘live’,${ARG4},DATE(NOW())))

exten => s,n,MYSQL(CLEAR ${result})

exten => s,n,MYSQL(Disconnect ${connid})

exten => s,n,GoTo(${MACRO_CONTEXT},${MACRO_EXTEN},${nextPri})

…AND the console output

– Executing [outro@j15442:15] Macro(“SIP/315-00000006”, “updateCID,15442,j15442,37098,1.25”) in new stack
– Executing [s@macro-updateCID:1] Set(“SIP/315-00000006”, "nextPri=16 ") in new stack
– Executing [s@macro-updateCID:2] MYSQL(“SIP/315-00000006”, “Query result 1 INSERT INTO CaseIDTable (Date,EmployeeID,JobNumber,StudyCode,CaseID,SessionID,Mode,CPI,ProdDate) VALUES (Now(),‘IVR’,15442,‘j15442’,37098,37098,‘live’,1.25,DATE(NOW()))”) in new stack
[Jan 20 12:12:52] WARNING[9703]: app_addon_sql_mysql.c:183 find_identifier: Identifier 1, identifier_type 1 not found in identifier list
[Jan 20 12:12:52] WARNING[9703]: app_addon_sql_mysql.c:369 aMYSQL_query: Invalid connection identifier 1 passed in aMYSQL_query
– Executing [s@macro-updateCID:3] MYSQL(“SIP/315-00000006”, "CLEAR ") in new stack
[Jan 20 12:12:52] WARNING[9703]: app_addon_sql_mysql.c:183 find_identifier: Identifier 0, identifier_type 2 not found in identifier list
[Jan 20 12:12:52] WARNING[9703]: app_addon_sql_mysql.c:486 aMYSQL_clear: Invalid result identifier 0 passed in aMYSQL_clear
– Executing [s@macro-updateCID:4] Goto(“SIP/315-00000006”, "j15442,outro,16 ") in new stack
– Goto (j15442,outro,16)

Also i get the warning on the mysql(clear) every time.