List:MySQL++« Previous MessageNext Message »
From:pavel989 Date:January 25 2009 3:54am
Subject:Re: Re: What is a row? and can i use it as a vector?
View as plain text  
mysql> describe event;


+------------+---------------------+------+-----+---------+-------+

| Field????? | Type??????????????? | Null | Key | Default | Extra |

+------------+---------------------+------+-----+---------+-------+

| title????? | text??????????????? | YES? |???? | NULL??? |?????? |

| date?????? | date??????????????? | YES? |???? | NULL??? |?????? |

| comment??? | text??????????????? | YES? |???? | NULL??? |?????? |

| link?????? | text??????????????? | YES? |???? | NULL??? |?????? |

| importance | tinyint(3) unsigned | YES? |???? | NULL??? |?????? |

+------------+---------------------+------+-----+---------+-------+







GLvoid glPrint(char *fmt);



The thing is, I don't have a limit currently to the size of title, comment and link.

Link doesnt matter.

But title and comment:

??? what i was trying to do, is pass the row[0] value, into a new char array, through a 

for loop, so that itd print the entire value, on different lines through glPrint.

basically i was thinking that if the title (in this case) is longer than 16, i want to
print

16 char of the title, move down, and continue.



now when i tried the for loop way, i was getting errors that the buffer is too small, and
I

think it has something to do with me using "char * " so it was probably just pointer
problems.



But then i figured i should try to use vectors. and now i get "cant convert from char to
char*"

or something like that.



 



-----Original Message-----

From: Warren Young <mysqlpp@stripped>

To: plusplus@stripped

Sent: Fri, 23 Jan 2009 9:34 am

Subject: Re: What is a row? and can i use it as a vector?












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.?

?


--MySQL++ Mailing List?


For list archives: http://lists.mysql.com/plusplus?


To unsubscribe:    http://lists.mysql.com/plusplus?unsub=1 



 


Thread
Re: Re: What is a row? and can i use it as a vector?pavel98925 Jan
  • Re: What is a row? and can i use it as a vector?Warren Young25 Jan
Re: What is a row? and can i use it as a vector?pavel98927 Jan