Strings and Function Calls

Oct 23, 2011 at 8:01pm
im trying to create a MySQL client program that asks user for specific information and then queries the database. I need to be able to send functions by added variables that were entered by the user

for example:

1
2
3
4
5
...
string name;
getline(cin, name);

if(mysql_query(conn,"SHOW TABLES FROM 'name' ")


how could i make this possible?
Oct 23, 2011 at 9:34pm
If I understand your question, you'll want to have another string that contains the entire line you with to pass to the SQL query. You can build this string with standard string functions and operators.

When you make the SQL call, extract the pointer to the character array within the string, and use that as your 2nd argument.

I realize this isn't super-specific; it's not intended to be. Let me know, though, if you need chapter and verse.
Oct 25, 2011 at 9:47pm
Thank you for the reply but i fixed the problem simply by converting the string to a character array
Topic archived. No new replies allowed.