List:MySQL++« Previous MessageNext Message »
From:william.lieberman Date:October 25 2005 8:08pm
Subject:RE: SSQLS contained within class definition compilation issues
View as plain text  
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@stripped> 
10/25/2005 03:08 PM

To
william.lieberman@stripped, plusplus@stripped
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@stripped]
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

>From: "Mark Merendino" <Mark.Merendino@stripped>
>To: "terry johnston"

><tmjohnston@stripped>,<plusplus@stripped>
>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@stripped]
>Sent: Wednesday, September 14, 2005 5:46 AM
>To: plusplus@stripped
>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@stripped [mailto:william.lieberman@stripped]

Sent: Tuesday, October 25, 2005 2:49 PM
To: plusplus@stripped
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)



Thread
SSQLS contained within class definition compilation issueswilliam.lieberman25 Oct
  • Retrieving 300K+ recordsAlex Vishnev25 Oct
    • Re: Retrieving 300K+ recordsEarl Miles25 Oct
      • RE: Retrieving 300K+ recordsAlex Vishnev25 Oct
        • Re: Retrieving 300K+ recordsWarren Young27 Oct
      • RE: Retrieving 300K+ recordsAlex Vishnev26 Oct
        • Re: Retrieving 300K+ recordsWarren Young27 Oct
          • RE: Retrieving 300K+ recordsAlex Vishnev27 Oct
    • Re: Retrieving 300K+ recordsChris Frey26 Oct
      • Re: Retrieving 300K+ recordsEarl Miles26 Oct
        • Re: Retrieving 300K+ recordsChris Frey26 Oct
          • RE: Retrieving 300K+ recordsAlex Vishnev26 Oct
            • Re: Retrieving 300K+ recordsEarl Miles26 Oct
            • Re: Retrieving 300K+ recordsChris Frey26 Oct
  • Re: SSQLS contained within class definition compilation issuesahnkle28 Oct
    • New FeaturesFabricio Mota29 Oct
RE: SSQLS contained within class definition compilation issueswilliam.lieberman25 Oct
  • Re: SSQLS contained within class definition compilation issuesWarren Young27 Oct
Re: SSQLS contained within class definition compilation issuesWarren Young27 Oct