dbTalk Databases Forums  

SSQLS contained within class definition compilation issues

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


Discuss SSQLS contained within class definition compilation issues in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
william.lieberman@gsa.gov
 
Posts: n/a

Default SSQLS contained within class definition compilation issues - 10-25-2005 , 01:50 PM






--=_alternative 00676750852570A5_=
Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: 7bit

I've read some previous posts about compilation issues, but they don't
seem to pertain to my problem. I have a class declaration in which some
private functions pass a vector of SSQLS type. During compilation, my
compiler returns: "multiple definition of log::names" and "multiple
definition of log::_table" errors. Not sure if it matters, but I am
compiling on FreeBSD using g++ (3.4.2) and mysql++ 1.7.40.

Here are the relevant items from my class declaration:

Outside of my class type I use the sql_create to build the structure.

sql_create_12(log,
1,12,
int, serialnumber,
.......
.......)

Inside of my class declaration, I have the function:

print_log(vector<log> log_vector);


The only reason I need this SSQLS defined inside my class declaration file
is so that this function knows the data type being passed. Before I
started building this class, I had a test program running using this
structure. It compiled and ran with no errors in the exact manner in
which I wanted.

Is this possible to do? Can I use this SSQLS inside my class like this?
If so, how? If not, what kind of hack-a-rounds can I do to make it work?

Any and all help would be very much appreciated,
Billy
--=_alternative 00676750852570A5_=--


Reply With Quote
  #2  
Old   
william.lieberman@gsa.gov
 
Posts: n/a

Default RE: SSQLS contained within class definition compilation issues - 10-25-2005 , 03:08 PM






--=_alternative 006E9BCF852570A5_=
Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: 7bit

The hack worked great for me. Thanks for the help. Luckily though, I'm
programming on a server that no one else uses. So, what if the system is
multi-user and people want to use the sql_create_x function? They are
going to have to take the added steps in using it. Is there another way
to make this work without changing system-wide libraries?
Billy




"Mark Merendino" <Mark.Merendino (AT) mcdata (DOT) com>
10/25/2005 03:08 PM

To
william.lieberman (AT) gsa (DOT) gov, plusplus (AT) lists (DOT) mysql.com
cc

Subject
RE: SSQLS contained within class definition compilation issues







Billy, I came up with a hack for this a while back. There is a post for
it and a description below that I provided for someone else...

Here is the post...
http://lists.mysql.com/plusplus/4295

Here is a description I provided for another user. Hope it helps...

Here is the jist. It was a while ago so bear with me...

Edit custom.pl to remove the lines...

const char *NAME::names[] = { $names }; const char *NAME::_table = #NAME
;


Then run custom.pl to build a new custom.h. I did this so I could use
sql_create_#() in a header file.


So if I say this in my "alarm.h" header file....

//create an SSQLS to represent the alarm table
sql_create_3(ALARM,

1, 3,

short, type,
short, number,
short, severity)


I now have go to my cpp file called InitSSQLS.cpp and add...

//init alarm data
const char *ALARM::_table = "alarm" ;
const char *ALARM::names[] =
{ "type", "number", "severity"};


Basically by manually creating the members "_table" and "names" in
global address rather than the header file I can now include the header
file in multiple places with out having to worry about redefs.

Does this help. Let me know and maybe I can answer some more questions.


-----Original Message-----
From: terry johnston [mailto:tmjohnston (AT) hotmail (DOT) com]
Sent: Wednesday, September 14, 2005 11:19 AM
To: Mark Merendino
Subject: RE: SSQL multiple definition errors

hi Mark
would you mind specifying exactly what i need to do to follow your
solution as i am struggling with it thanks terry

Quote:
From: "Mark Merendino" <Mark.Merendino (AT) mcdata (DOT) com
To: "terry johnston"

tmjohnston (AT) hotmail (DOT) com>,<...DOT) mysql.com
Subject: RE: SSQL multiple definition errors
Date: Wed, 14 Sep 2005 06:47:23 -0600


Not sure if this is the redef problem you are refering to but I tackled

a redef problem a ways back. Check it out here...

http://lists.mysql.com/plusplus/4295

-----Original Message-----
From: terry johnston [mailto:tmjohnston (AT) hotmail (DOT) com]
Sent: Wednesday, September 14, 2005 5:46 AM
To: plusplus (AT) lists (DOT) mysql.com
Subject: SSQL multiple definition errors

thanks Chris
i want to create some objects in my library that contain SSQL

structures
- so i might have a widget class that contains an SSQL stock & an SSQL

price - the widget object would be used in the higher level appication,

requiring knowledge of the SSQL definitions, hence the redefinition

problem - can i do this?
terry

-----Original Message-----
From: william.lieberman (AT) gsa (DOT) gov [mailto:william.lieberman (AT) gsa (DOT) gov]

Sent: Tuesday, October 25, 2005 2:49 PM
To: plusplus (AT) lists (DOT) mysql.com
Subject: SSQLS contained within class definition compilation issues

I've read some previous posts about compilation issues, but they don't
seem to pertain to my problem. I have a class declaration in which some
private functions pass a vector of SSQLS type. During compilation, my
compiler returns: "multiple definition of log::names" and "multiple
definition of log::_table" errors. Not sure if it matters, but I am
compiling on FreeBSD using g++ (3.4.2) and mysql++ 1.7.40.

Here are the relevant items from my class declaration:

Outside of my class type I use the sql_create to build the structure.

sql_create_12(log,
1,12,
int, serialnumber,
.......
.......)

Inside of my class declaration, I have the function:

print_log(vector<log> log_vector);


The only reason I need this SSQLS defined inside my class declaration
file is so that this function knows the data type being passed. Before
I started building this class, I had a test program running using this
structure. It compiled and ran with no errors in the exact manner in
which I wanted.

Is this possible to do? Can I use this SSQLS inside my class like this?

If so, how? If not, what kind of hack-a-rounds can I do to make it
work?

Any and all help would be very much appreciated, Billy

SPECIAL NOTICE


All information transmitted hereby is intended only for the use of the
addressee(s) named above and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or distribution
of confidential and privileged information is prohibited. If the reader
of this message is not the intended recipient(s) or the employee or agent
responsible for delivering the message to the intended recipient, you are
hereby notified that you must not read this transmission and that
disclosure,
copying, printing, distribution or use of any of the information contained
in or attached to this transmission is STRICTLY PROHIBITED.

Anyone who receives confidential and privileged information in error
should
notify us immediately by telephone and mail the original message to us at
the above address and destroy all copies. To the extent any portion of
this
communication contains public information, no such restrictions apply to
that
information. (gate02)



--=_alternative 006E9BCF852570A5_=--



Reply With Quote
  #3  
Old   
Warren Young
 
Posts: n/a

Default Re: SSQLS contained within class definition compilation issues - 10-27-2005 , 12:51 AM



william.lieberman (AT) gsa (DOT) gov wrote:
Quote:
The hack worked great for me.
You do know that you're replying publically to an off-list message,
right? I only know what "hack" you're talking about by inference,
because I'm aware of the MySQL++ history.

Quote:
So, what if the system is
multi-user and people want to use the sql_create_x function? They are
going to have to take the added steps in using it. Is there another way
to make this work without changing system-wide libraries?
The consequence of any of these "hack"s is that the API for using
SSQLSes must change, and possibly the ABI as well. That's why we
haven't implemented any change yet. We're trying to be good little boys
and not break the ABI within the 2.x series. Recompiling your released
binaries every third release of MySQL++ sucks.

--
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
  #4  
Old   
Warren Young
 
Posts: n/a

Default Re: SSQLS contained within class definition compilation issues - 10-27-2005 , 08:38 AM



william.lieberman (AT) gsa (DOT) gov wrote:
Quote:
I included what he said in my e-mail response as previous
history.
<doofus> Sorry, I didn't see that part. The way the page breaks
happened on my screen made it look like the text you typed was all that
was there. I didn't look over and see the scroll bar. </doofus>

Um, to save face, can I harrangue you about the evils of top-posting?

--
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
  #5  
Old   
ahnkle
 
Posts: n/a

Default Re: SSQLS contained within class definition compilation issues - 10-28-2005 , 01:05 PM



william.lieberman (AT) gsa (DOT) gov wrote:
Quote:
I've read some previous posts about compilation issues, but they don't
seem to pertain to my problem. I have a class declaration in which some
private functions pass a vector of SSQLS type. During compilation, my
compiler returns: "multiple definition of log::names" and "multiple
definition of log::_table" errors. Not sure if it matters, but I am
compiling on FreeBSD using g++ (3.4.2) and mysql++ 1.7.40.

Here are the relevant items from my class declaration:

Outside of my class type I use the sql_create to build the structure.

sql_create_12(log,
1,12,
int, serialnumber,
.......
.......)

Inside of my class declaration, I have the function:

print_log(vector<log> log_vector);

I had the same problem, putting a create_sql_x macro in a class. In vc++
7.1, I used a forward declaration:

============================== my.h =
struct log;
typedef vector<log> LogContainer;

class MyClass
{
public:
void print_log(LogContainer);
};
============================== my.cpp =

create_sql_12(log,1,12 ...

MyClass:rint_log(LogContainer)
{}

==============================


regards,
ahnkle

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