aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sledjchisl/sledjchisl.c64
1 files changed, 33 insertions, 31 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index 00575c0..95724df 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -1179,7 +1179,7 @@ d("New SQL statement - %s", req->sql);
1179 goto freeIt; 1179 goto freeIt;
1180 } 1180 }
1181 req->inBind = xzalloc(i * sizeof(MYSQL_BIND)); 1181 req->inBind = xzalloc(i * sizeof(MYSQL_BIND));
1182W("Allocated %d %d inBinds for %s", i, req->inCount, req->sql); 1182//W("Allocated %d %d inBinds for %s", i, req->inCount, req->sql);
1183 for (i = 0; i < req->inCount; i++) 1183 for (i = 0; i < req->inCount; i++)
1184 { 1184 {
1185 dbField *fld = req->flds->get(req->flds, req->inParams[i], NULL, false); 1185 dbField *fld = req->flds->get(req->flds, req->inParams[i], NULL, false);
@@ -1201,53 +1201,53 @@ W("Allocated %d %d inBinds for %s", i, req->inCount, req->sql);
1201 { 1201 {
1202 case MYSQL_TYPE_TINY: 1202 case MYSQL_TYPE_TINY:
1203 { 1203 {
1204d("TINY %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1204//d("TINY %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1205 break; 1205 break;
1206 } 1206 }
1207 1207
1208 case MYSQL_TYPE_SHORT: 1208 case MYSQL_TYPE_SHORT:
1209 { 1209 {
1210 req->inBind[i].is_unsigned = FALSE; 1210 req->inBind[i].is_unsigned = FALSE;
1211d("SHORT %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1211//d("SHORT %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1212 break; 1212 break;
1213 } 1213 }
1214 1214
1215 case MYSQL_TYPE_INT24: 1215 case MYSQL_TYPE_INT24:
1216 { 1216 {
1217 req->inBind[i].is_unsigned = FALSE; 1217 req->inBind[i].is_unsigned = FALSE;
1218d("INT24 %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1218//d("INT24 %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1219 break; 1219 break;
1220 } 1220 }
1221 1221
1222 case MYSQL_TYPE_LONG: 1222 case MYSQL_TYPE_LONG:
1223 { 1223 {
1224 req->inBind[i].is_unsigned = FALSE; 1224 req->inBind[i].is_unsigned = FALSE;
1225d("LONG %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1225//d("LONG %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1226 break; 1226 break;
1227 } 1227 }
1228 1228
1229 case MYSQL_TYPE_LONGLONG: 1229 case MYSQL_TYPE_LONGLONG:
1230 { 1230 {
1231 req->inBind[i].is_unsigned = FALSE; 1231 req->inBind[i].is_unsigned = FALSE;
1232d("LONGLONG %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1232//d("LONGLONG %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1233 break; 1233 break;
1234 } 1234 }
1235 1235
1236 case MYSQL_TYPE_FLOAT: 1236 case MYSQL_TYPE_FLOAT:
1237 { 1237 {
1238d("FLOAT %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1238//d("FLOAT %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1239 break; 1239 break;
1240 } 1240 }
1241 1241
1242 case MYSQL_TYPE_DOUBLE: 1242 case MYSQL_TYPE_DOUBLE:
1243 { 1243 {
1244d("DOUBLE %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1244//d("DOUBLE %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1245 break; 1245 break;
1246 } 1246 }
1247 1247
1248 case MYSQL_TYPE_NEWDECIMAL: 1248 case MYSQL_TYPE_NEWDECIMAL:
1249 { 1249 {
1250d("NEWDECIMAL %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1250//d("NEWDECIMAL %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1251 break; 1251 break;
1252 } 1252 }
1253 1253
@@ -1256,14 +1256,14 @@ d("NEWDECIMAL %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1256 case MYSQL_TYPE_DATETIME: 1256 case MYSQL_TYPE_DATETIME:
1257 case MYSQL_TYPE_TIMESTAMP: 1257 case MYSQL_TYPE_TIMESTAMP:
1258 { 1258 {
1259d("DATE / TIME ish %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1259//d("DATE / TIME ish %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1260 break; 1260 break;
1261 } 1261 }
1262 1262
1263 case MYSQL_TYPE_STRING: 1263 case MYSQL_TYPE_STRING:
1264 case MYSQL_TYPE_VAR_STRING: 1264 case MYSQL_TYPE_VAR_STRING:
1265 { 1265 {
1266d("STRING / VARSTRING %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1266//d("STRING / VARSTRING %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1267 req->inBind[i].is_null = xzalloc(sizeof(my_bool)); 1267 req->inBind[i].is_null = xzalloc(sizeof(my_bool));
1268 req->inBind[i].length = xzalloc(sizeof(unsigned long)); 1268 req->inBind[i].length = xzalloc(sizeof(unsigned long));
1269 break; 1269 break;
@@ -1274,7 +1274,7 @@ d("STRING / VARSTRING %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1274 case MYSQL_TYPE_MEDIUM_BLOB: 1274 case MYSQL_TYPE_MEDIUM_BLOB:
1275 case MYSQL_TYPE_LONG_BLOB: 1275 case MYSQL_TYPE_LONG_BLOB:
1276 { 1276 {
1277d("BLOBs %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1277//d("BLOBs %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1278 req->inBind[i].is_null = xzalloc(sizeof(my_bool)); 1278 req->inBind[i].is_null = xzalloc(sizeof(my_bool));
1279 break; 1279 break;
1280 } 1280 }
@@ -1282,13 +1282,13 @@ d("BLOBs %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1282 case MYSQL_TYPE_BIT: 1282 case MYSQL_TYPE_BIT:
1283 { 1283 {
1284 req->inBind[i].is_null = xzalloc(sizeof(my_bool)); 1284 req->inBind[i].is_null = xzalloc(sizeof(my_bool));
1285d("BIT %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1285//d("BIT %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1286 break; 1286 break;
1287 } 1287 }
1288 1288
1289 case MYSQL_TYPE_NULL: 1289 case MYSQL_TYPE_NULL:
1290 { 1290 {
1291d("NULL %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1291//d("NULL %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1292 break; 1292 break;
1293 } 1293 }
1294 } 1294 }
@@ -1340,7 +1340,7 @@ I("count!!!!!!!!!!!!!!!!");
1340 goto freeIt; 1340 goto freeIt;
1341 } 1341 }
1342 req->outBind = xzalloc(i * sizeof(MYSQL_BIND)); 1342 req->outBind = xzalloc(i * sizeof(MYSQL_BIND));
1343W("Allocated %d %d outBinds for %s", i, req->outCount, req->sql); 1343//W("Allocated %d %d outBinds for %s", i, req->outCount, req->sql);
1344 for (i = 0; i < req->outCount; i++) 1344 for (i = 0; i < req->outCount; i++)
1345 { 1345 {
1346 dbField *fld = req->flds->get(req->flds, req->outParams[i], NULL, false); 1346 dbField *fld = req->flds->get(req->flds, req->outParams[i], NULL, false);
@@ -1464,7 +1464,7 @@ W("Allocated %d %d outBinds for %s", i, req->outCount, req->sql);
1464 } 1464 }
1465 1465
1466 1466
1467d("input bind for %s", req->sql); 1467//d("input bind for %s", req->sql);
1468 for (i = 0; i < req->inCount; i++) 1468 for (i = 0; i < req->inCount; i++)
1469 { 1469 {
1470 dbField *fld = req->flds->get(req->flds, req->inParams[i], NULL, false); 1470 dbField *fld = req->flds->get(req->flds, req->inParams[i], NULL, false);
@@ -1485,7 +1485,7 @@ d("input bind for %s", req->sql);
1485 signed char d = (signed char) c; 1485 signed char d = (signed char) c;
1486 1486
1487 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 1487 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
1488T("TINY %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1488//T("TINY %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1489 break; 1489 break;
1490 } 1490 }
1491 1491
@@ -1495,7 +1495,7 @@ T("TINY %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1495 short int d = (short int) c; 1495 short int d = (short int) c;
1496 1496
1497 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 1497 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
1498T("SHORT %d %s %d = %d", i, fld->name, req->inBind[i].buffer_length, c); 1498//T("SHORT %d %s %d = %d", i, fld->name, req->inBind[i].buffer_length, c);
1499 break; 1499 break;
1500 } 1500 }
1501 1501
@@ -1504,7 +1504,7 @@ T("SHORT %d %s %d = %d", i, fld->name, req->inBind[i].buffer_length, c);
1504 int d = va_arg(ap, int); 1504 int d = va_arg(ap, int);
1505 1505
1506 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 1506 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
1507T("INT24 %d %s %d - %d", i, fld->name, req->inBind[i].buffer_length, d); 1507//T("INT24 %d %s %d - %d", i, fld->name, req->inBind[i].buffer_length, d);
1508 break; 1508 break;
1509 } 1509 }
1510 1510
@@ -1513,7 +1513,7 @@ T("INT24 %d %s %d - %d", i, fld->name, req->inBind[i].buffer_length, d);
1513 long d = va_arg(ap, long); 1513 long d = va_arg(ap, long);
1514 1514
1515 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 1515 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
1516T("LONG %d %s %d = %ld", i, fld->name, req->inBind[i].buffer_length, d); 1516//T("LONG %d %s %d = %ld", i, fld->name, req->inBind[i].buffer_length, d);
1517 break; 1517 break;
1518 } 1518 }
1519 1519
@@ -1522,7 +1522,7 @@ T("LONG %d %s %d = %ld", i, fld->name, req->inBind[i].buffer_length, d);
1522 long long int d = va_arg(ap, long long int); 1522 long long int d = va_arg(ap, long long int);
1523 1523
1524 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 1524 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
1525T("LONGLONG %d %s %d = %lld", i, fld->name, req->inBind[i].buffer_length, d); 1525//T("LONGLONG %d %s %d = %lld", i, fld->name, req->inBind[i].buffer_length, d);
1526 break; 1526 break;
1527 } 1527 }
1528 1528
@@ -1532,7 +1532,7 @@ T("LONGLONG %d %s %d = %lld", i, fld->name, req->inBind[i].buffer_length, d);
1532 float d = (float) c; 1532 float d = (float) c;
1533 1533
1534 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 1534 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
1535T("FLOAT %d %s %d = %f", i, fld->name, req->inBind[i].buffer_length, d); 1535//T("FLOAT %d %s %d = %f", i, fld->name, req->inBind[i].buffer_length, d);
1536 break; 1536 break;
1537 } 1537 }
1538 1538
@@ -1541,13 +1541,13 @@ T("FLOAT %d %s %d = %f", i, fld->name, req->inBind[i].buffer_length, d);
1541 double d = va_arg(ap, double); 1541 double d = va_arg(ap, double);
1542 1542
1543 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 1543 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
1544T("DOUBLE %d %s %d = %f", i, fld->name, req->inBind[i].buffer_length, d); 1544//T("DOUBLE %d %s %d = %f", i, fld->name, req->inBind[i].buffer_length, d);
1545 break; 1545 break;
1546 } 1546 }
1547 1547
1548 case MYSQL_TYPE_NEWDECIMAL: 1548 case MYSQL_TYPE_NEWDECIMAL:
1549 { 1549 {
1550T("NEWDECIMAL %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1550//T("NEWDECIMAL %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1551 break; 1551 break;
1552 } 1552 }
1553 1553
@@ -1559,7 +1559,7 @@ T("NEWDECIMAL %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1559 MYSQL_TIME d = va_arg(ap, MYSQL_TIME); 1559 MYSQL_TIME d = va_arg(ap, MYSQL_TIME);
1560 1560
1561 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 1561 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
1562T("DATE / TIME ish %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1562//T("DATE / TIME ish %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1563 break; 1563 break;
1564 } 1564 }
1565 1565
@@ -1574,7 +1574,7 @@ T("DATE / TIME ish %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1574 *(req->inBind[i].length) = l; 1574 *(req->inBind[i].length) = l;
1575 strncpy(req->inBind[i].buffer, d, (size_t) l); 1575 strncpy(req->inBind[i].buffer, d, (size_t) l);
1576 ((char *) req->inBind[i].buffer)[l] = '\0'; 1576 ((char *) req->inBind[i].buffer)[l] = '\0';
1577T("STRING / VARSTRING %d %s %d = %s", i, fld->name, req->inBind[i].buffer_length, d); 1577//T("STRING / VARSTRING %d %s %d = %s", i, fld->name, req->inBind[i].buffer_length, d);
1578 break; 1578 break;
1579 } 1579 }
1580 1580
@@ -1583,20 +1583,20 @@ T("STRING / VARSTRING %d %s %d = %s", i, fld->name, req->inBind[i].buffer_length
1583 case MYSQL_TYPE_MEDIUM_BLOB: 1583 case MYSQL_TYPE_MEDIUM_BLOB:
1584 case MYSQL_TYPE_LONG_BLOB: 1584 case MYSQL_TYPE_LONG_BLOB:
1585 { 1585 {
1586// TODO - should write this, we will likely need it. Main problem is - how long is this blob? Probably should add alongth param before the blob. 1586// TODO - should write this, we will likely need it. Main problem is - how long is this blob? Probably should add a length param before the blob.
1587T("BLOBs %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1587//T("BLOBs %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1588 break; 1588 break;
1589 } 1589 }
1590 1590
1591 case MYSQL_TYPE_BIT: 1591 case MYSQL_TYPE_BIT:
1592 { 1592 {
1593T("BIT %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1593//T("BIT %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1594 break; 1594 break;
1595 } 1595 }
1596 1596
1597 case MYSQL_TYPE_NULL: 1597 case MYSQL_TYPE_NULL:
1598 { 1598 {
1599T("NULL %d %s %d", i, fld->name, req->inBind[i].buffer_length); 1599//T("NULL %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1600 break; 1600 break;
1601 } 1601 }
1602 } 1602 }
@@ -1610,7 +1610,7 @@ T("NULL %d %s %d", i, fld->name, req->inBind[i].buffer_length);
1610 } 1610 }
1611 1611
1612 1612
1613d("Execute %s", req->sql); 1613//d("Execute %s", req->sql);
1614 1614
1615 // do the prepared statement req->prep. 1615 // do the prepared statement req->prep.
1616 if (mysql_stmt_execute(req->prep)) 1616 if (mysql_stmt_execute(req->prep))
@@ -1772,6 +1772,7 @@ end:
1772 double n = (now.tv_sec * 1000000000.0) + now.tv_nsec; 1772 double n = (now.tv_sec * 1000000000.0) + now.tv_nsec;
1773 double t = (then.tv_sec * 1000000000.0) + then.tv_nsec; 1773 double t = (then.tv_sec * 1000000000.0) + then.tv_nsec;
1774 T("dbDoSomething(%s) took %lf seconds", req->sql, (n - t) / 1000000000.0); 1774 T("dbDoSomething(%s) took %lf seconds", req->sql, (n - t) / 1000000000.0);
1775/*
1775 if (NULL != req->prep) 1776 if (NULL != req->prep)
1776 I("The prepared statement itself is NOT NULL."); 1777 I("The prepared statement itself is NOT NULL.");
1777 else 1778 else
@@ -1781,6 +1782,7 @@ end:
1781 I("The prepared0 statement itself is NOT NULL."); 1782 I("The prepared0 statement itself is NOT NULL.");
1782 else 1783 else
1783 W("The prepared0 statement itself is NULL!"); 1784 W("The prepared0 statement itself is NULL!");
1785*/
1784 1786
1785 return ret; 1787 return ret;
1786} 1788}