List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:January 23 2009 2:34pm
Subject:Re: What is a row? and can i use it as a vector?
View as plain text  
On Jan 23, 2009, at 12:00 AM, pavel989@stripped wrote:

> I'm so confused as to what a row is. is it like a vector with more  
> attributes or what?

The documentation says, "This class is like an extended version of a  
const std::vector of mysqlpp::String."

Each String in the Row holds the contents of one of the fields you  
requested from the database from that row.  So:

	SELECT a, b, c FROM d

gives you three fields from all rows in table 'd', with each Row  
having three fields called row[0], row[1], and row[2].  Or, row["a"],  
row["b"], and row["c"].  Each of these subscript accesses gives you a  
String, which you generally don't use directly, but rather assign to  
some compatible C++ type:

	Row row = ...;
	mysqlpp::sql_char a = row["a"];
	mysqlpp::sql_int b = row["b"];
	mysqlpp::sql_time c = row["c"];

> ive been trying to split up the row result in char * format (i have  
> to use char* for now because im working with a simple font engine).

Can you gave examples of the data you get from the DB, and a method  
signature of the function you have to pass it to?

> i can't figure out how to get a row into a vector<char> type

It's possible to convert each String field in the row to a vector of  
char, but I'm going to hold off on telling you how until I get an  
answer to the above.  If you squint, mysqlpp::String and std::string  
look like vectors of char, so any further translation is probably  
unnecessary.
Thread
What is a row? and can i use it as a vector?pavel98923 Jan
  • Re: What is a row? and can i use it as a vector?Warren Young23 Jan