dbTalk Databases Forums  

Re: Can I use mysql++ this way?

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Re: Can I use mysql++ this way? in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Warren Young
 
Posts: n/a

Default Re: Can I use mysql++ this way? - 04-18-2005 , 10:51 AM






Å£ À¤ wrote:

Quote:
#define MAX 20

class Connect
{
private:
char host[ MAX ];
A transplant to C++ from C, I see. Consider using string here instead.
Fixed-length character arrays are *so* 1990...

Quote:
Connect( char host[] = NULL, char user[] = NULL, char password[] =
NULL )
It's more accepted in C++ to use 0 instead of NULL.

Quote:
this -> host = host;
It's extremely rare to ever need to use the 'this' pointer. You
certainly don't need to use it to access member variables. In this
particular instance, you need it because you've named some parameters
the same as some class members, but you can avoid even this use of the
'this' pointer by using C++ initializer lists:

Connect(char* host = 0, char* user = 0, char* password = 0) :
host(host),
user(user),
password(password)
{
....

Quote:
I can always see exception thrown out of libmysqlpp.so
It's covered in the FAQ:

http://tangentsoft.net/mysql++/#faq

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.