C
Generate SQL Placeholder String
# c
// Allocate the placeholders string
size_t sizeof_placeholders = 2 * sizeof(uint8_t) * count_of_placeholders;
uint8_t *placeholders = malloc(sizeof_placeholders);
if (placeholders == NULL) {
// Return an error or raise an exception
}
// Fill it with ?, pairs
memset_pattern8(placeholders, "?,?,?,?,", sizeof_placeholders);
// NUL terminate the string, replacing the unwanted trailing comma
placeholders[sizeof_placeholders - 1] = '\0';
Last modified: 03 December 2015