dbTalk Databases Forums  

bound between SSQLS structure name and table name

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


Discuss bound between SSQLS structure name and table name in the mailing.database.mysql-plusplus forum.



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

Default bound between SSQLS structure name and table name - 07-11-2006 , 05:02 AM






Hi,

I'm using MySQL++ since some weeks and really enjoy
the nice SSQLS features. That's really a nice thing! I
applied the Null type patch and a personal one (to add
a sql_cmp(const Null<T>&a,const Null<T> &b) function).
But (as there must be something wrong! ), is there
a way to change the _table value without having to
define the other static attributes, like _names?
Actually, sql_create_n macros make a bound between the
name of the structure it generates, and the name of
the underlying database table. IMHO, this should be
avoid, as one may want to have this class with a
different name. As an exemple, lets take the Person
table. I would like to have a Person class that
heritates from a sql_create kind of structure and
implements some other methods. If I use sql_create as
is, Person have to be the name of my sql_create
structure and I have to use a different name for my
other class.
Any idea on how to handle this?

Best regards,
Christophe






__________________________________________________ _________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com

--
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
  #2  
Old   
AT
 
Posts: n/a

Default Re: bound between SSQLS structure name and table name - 07-18-2006 , 09:56 AM






christophe guerber wrote:
Quote:
is there
a way to change the _table value without having to
define the other static attributes, like _names?
Yes. My own code does this regularly. I don't understand why you bring
_names into this at all. You simply assign the underlying SQL table
name to MyClassName::_table early in the program's execution. It's no
more difficult than that.

If you're not convinced, rename the stock SSQLS created in
examples/stock.h, and then update the custom*.cpp files to use the new
structure name. Also, do something like this before using the SSQLS in
each example:

mystock::_table = "stock";

I'm using "mystock" here as the new SSQLS structure name here, but you
can use anything you like.

I just did this, and it works fine.

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