Commit d98924df authored by Giovanne Marcelo's avatar Giovanne Marcelo

change strcat to sprintf

parent 36c471ce
......@@ -28,11 +28,8 @@ void read_conf(const char *path, char * conninfo) {
// Iterate over json and build connection info
json_object_foreach(config, key, value) {
strcat(k_v, key);
strcat(k_v, "=");
strcat(k_v, json_string_value(value));
strcat(conninfo, k_v);
strcat(conninfo, " ");
sprintf(k_v, "%s = %s", key, json_string_value(value));
sprintf(conninfo,"%s %s ",conninfo, k_v);
strcpy(k_v,"");
}
}
......@@ -67,13 +64,9 @@ DBresult* db_select( char *columns, char *table, char *where) {
DBresult *result;
// Build query
strcpy(query, "SELECT ");
strcat(query, columns);
strcat(query, " FROM ");
strcat(query, table);
sprintf(query,"SELECT %s FROM %s", columns, table);
if (where && strcmp(where, ""))
strcat(query, " WHERE ");
strcat(query, where);
sprintf(query,"%s WHERE %s ",query, where);
strcat(query, ";");
// Execute query
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment