I already looked into that. I've tried to do this.
Code:
void munky::getFieldInfo(string table_name)
{
int numFields = getNumFields(table_name);
Query query = con.query();
query << "SELECT * FROM " << table_name;
Result res = query.store();
cout << "Query Info:\n";
cout.setf(ios::left);
for (int i = 0; i < numFields; i++) {
cout << setw(2) << i
<< setw(15) << res.names(i).c_str()
// this is the name of the field
<< setw(15) << res.types(i).sql_name()
// this is the SQL identifier name
// Result::types(unsigned int) returns a mysql_type_info which
in many
// ways is like type_info except that it has additional sql type
// information in it. (with one of the methods being sql_name())
<< setw(20) << res.types(i).name()
// this is the C++ identifier name which most closely resembles
// the sql name (its is implementation defined and often not
very readable)
<< endl;
}
cout << endl;
}
*********
This code outputs:
Query Info:
0 id INT NOT NULL i
1 year INT NULL N7mysqlpp4NullIiNS_10NullisNullEEE
2 color BLOB NULL N7mysqlpp4NullISsNS_10NullisNullEEE
id = "1" = "1"
year = "" = ""
color = "purp" = "purp"
******
My first question is, why is color (which is a 'text') being seen as a
blob? Secondly, why would id (which is an int(11)) print but year (which
is an int(4)) not print. I'd be happy to help you debug. I'm at college
so I don't think I can give you shell. I will however be happy to assist
where I can.
-=mUnky=-
-Dovid Kopel
(516)-655-0489
munky@stripped
http://www.munkys.com
Warren Young wrote:
> http://lists.mysql.com/plusplus/3830
>