20 #define snprintf _snprintf 26 const char *
const customer_name);
37 const char *
const customer_name) {
38 char query_string[256];
39 int number_of_results;
41 snprintf(query_string,
sizeof(query_string),
42 "SELECT ID FROM CUSTOMERS WHERE NAME = %s", customer_name);
43 number_of_results = connection->
query_database(connection, query_string,
46 if (number_of_results != 1) {
50 return (
unsigned int)*((
int *)results);
DatabaseConnection * connect_to_database(const char *const database_url, const unsigned int port)
unsigned int get_customer_id_by_name(DatabaseConnection *const connection, const char *const customer_name)
QueryDatabase query_database
DatabaseConnection * connect_to_customer_database(void)