* and add the string length to the running total pointed to by 'len'.
*/
static isc_result_t
-additem(mysql_data_t *state, mysql_arglist_t *arglist, char **s, size_t *len) {
+additem(mysql_arglist_t *arglist, char **s, size_t *len) {
mysql_arg_t *item;
item = malloc(sizeof(*item));
return (ISC_R_NOMEMORY);
DLZ_LINK_INIT(item, link);
- DE_CONST(*s, item->arg);
+ item->arg = *s;
*len += strlen(*s);
DLZ_LIST_APPEND(*arglist, item, link);
*s = NULL;
isc_boolean_t localdbi = ISC_FALSE;
mysql_arglist_t arglist;
mysql_arg_t *item;
- char *p, *q, *tmp, *querystr = NULL;
+ char *p, *q, *tmp = NULL, *querystr = NULL;
char *query = NULL;
size_t len = 0;
- const char *arg;
va_list ap1;
/* Get a DB instance if needed */
goto fail;
for (;;) {
- mysql_arg_t *item;
-
if (*q == '\0')
break;
if (tmp == NULL)
goto fail;
- result = additem(state, &arglist, &tmp, &len);
+ result = additem(&arglist, &tmp, &len);
if (result != ISC_R_SUCCESS)
goto fail;
if (tmp == NULL)
goto fail;
- result = additem(state, &arglist, &tmp, &len);
+ result = additem(&arglist, &tmp, &len);
if (result != ISC_R_SUCCESS)
goto fail;
if (tmp == NULL)
goto fail;
- result = additem(state, &arglist, &tmp, &len);
+ result = additem(&arglist, &tmp, &len);
if (result != ISC_R_SUCCESS)
goto fail;
}
static isc_result_t
-db_execute(mysql_data_t *state, mysql_instance_t *dbi, char *query) {
+db_execute(mysql_data_t *state, mysql_instance_t *dbi, const char *query) {
int ret;
/* Make sure this instance is connected. */
}
static MYSQL_RES *
-db_query(mysql_data_t *state, mysql_instance_t *dbi, char *query) {
+db_query(mysql_data_t *state, mysql_instance_t *dbi, const char *query) {
isc_result_t result;
isc_boolean_t localdbi = ISC_FALSE;
MYSQL_RES *res = NULL;
isc_boolean_t local = ISC_FALSE;
struct hostent *h;
struct sockaddr_in addr, *sin;
- int rs;
/*
* Put nameserver rdata through gethostbyname as it
makerecord(mysql_data_t *state, const char *name, const char *rdatastr) {
mysql_record_t *new_record;
char *real_name, *dclass, *type, *data, *ttlstr, *buf;
- char *saveptr = NULL;
dns_ttl_t ttlvalue;
new_record = (mysql_record_t *)
mysql_data_t *state;
const char *helper_name;
va_list ap;
- char soa_data[200];
- const char *extra;
- isc_result_t result;
int n;
UNUSED(dlzname);
* Assign the 'state' to dbdata so we get it in our callbacks
*/
- *dbdata = state;
dlz_mutex_lock(&state->tx_mutex);
dlz_mutex_unlock(&state->db[n].mutex);
}
+ *dbdata = state;
dlz_mutex_unlock(&state->tx_mutex);
return (ISC_R_SUCCESS);
}
- failure:
free(state->db_name);
free(state->db_host);
free(state->db_user);
free(state->db_pass);
dlz_mutex_destroy(&state->tx_mutex);
free(state);
- return (result);
+ return (ISC_R_FAILURE);
}
/*
mysql_data_t *state = (mysql_data_t *)dbdata;
MYSQL_RES *res;
char *query;
- int rs;
/* Query the Zones table to see if this zone is present */
query = build_query(state, NULL, Q_FINDZONE, name);
char *query;
mysql_transaction_t *txn = NULL;
mysql_instance_t *dbi = NULL;
- int rs;
if (state->putrr == NULL) {
if (state->log != NULL)
dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
isc_result_t result = ISC_R_SUCCESS;
mysql_data_t *state = (mysql_data_t *)dbdata;
- int i;
MYSQL_RES *res;
MYSQL_ROW row;
char *query;
modname, txn, zone);
}
- cleanup:
/*
* Unlock the mutex for this txn
*/
isc_result_t result;
MYSQL_RES *res;
MYSQL_ROW row;
- char *query;
int count;
/*
char *new_name, *query;
mysql_record_t *record;
isc_result_t result;
- size_t len;
if (txn == NULL)
return (ISC_R_FAILURE);
char *new_name, *query;
mysql_record_t *record;
isc_result_t result;
- size_t len;
if (txn == NULL)
return (ISC_R_FAILURE);
mysql_transaction_t *txn = (mysql_transaction_t *)version;
char *new_name, *query;
isc_result_t result;
- size_t len;
if (txn == NULL)
return (ISC_R_FAILURE);