| 1326 | } |
| 1327 | |
| 1328 | void logsql(struct clientparam * param, const unsigned char *s) { |
| 1329 | SQLRETURN ret; |
| 1330 | int len; |
| 1331 | |
| 1332 | |
| 1333 | if(param->nolog) return; |
| 1334 | pthread_mutex_lock(&log_mutex); |
| 1335 | len = dobuf(param, tmpbuf, s, (unsigned char *)"\'"); |
| 1336 | |
| 1337 | if(attempt > 5){ |
| 1338 | time_t t; |
| 1339 | |
| 1340 | t = time(0); |
| 1341 | if (t - attempt_time < 180){ |
| 1342 | sqlerr((char *)tmpbuf); |
| 1343 | return; |
| 1344 | } |
| 1345 | } |
| 1346 | if(!hstmt){ |
| 1347 | if(!init_sql(sqlstring)) { |
| 1348 | sqlerr((char *)tmpbuf); |
| 1349 | return; |
| 1350 | } |
| 1351 | } |
| 1352 | if(hstmt){ |
| 1353 | ret = SQLExecDirect(hstmt, (SQLCHAR *)tmpbuf, (SQLINTEGER)len); |
| 1354 | if(ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO){ |
| 1355 | close_sql(); |
| 1356 | if(!init_sql(sqlstring)){ |
| 1357 | sqlerr((char *)tmpbuf); |
| 1358 | return; |
| 1359 | } |
| 1360 | if(hstmt) { |
| 1361 | ret = SQLExecDirect(hstmt, (SQLCHAR *)tmpbuf, (SQLINTEGER)len); |
| 1362 | if(ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO){ |
| 1363 | sqlerr((char *)tmpbuf); |
| 1364 | return; |
| 1365 | } |
| 1366 | attempt = 0; |
| 1367 | } |
| 1368 | } |
| 1369 | attempt = 0; |
| 1370 | } |
| 1371 | pthread_mutex_unlock(&log_mutex); |
| 1372 | } |
| 1373 | |
| 1374 | #endif |
| 1375 | |