pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedlibpq++ ---- PgDatabase instance problem
6+ messages / 3 participants
[nested] [flat]
* libpq++ ---- PgDatabase instance problem
@ 1999-08-20 04:12 inkle c <inkle99@yahoo.com>
0 siblings, 0 replies; 6+ messages in thread
From: inkle c @ 1999-08-20 04:12 UTC (permalink / raw)
To: pgsql-interfaces
Hi,
I am writing a small class which has a PgDatabase
instance as its private member, and in the constructor,
I init it to be NULL (i.e.,
myclass::myclass():PgDatabaseInstanceMember(NULL) ), this causes a core
dump, what's wrong with that?
My intension is to get dbname from user's input, then
create the instance using PgDatabase(dbname), because
dbname should be provided by user.
Thanks for any suggestions.
inkle
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* libpq++ ---- PgDatabase instance problem
@ 1999-08-20 04:22 inkle c <inkle99@yahoo.com>
0 siblings, 1 reply; 6+ messages in thread
From: inkle c @ 1999-08-20 04:22 UTC (permalink / raw)
To: pgsql-interfaces
Hi,
I am writing a small class which has a PgDatabase
instance as its private member, and in the constructor,
I init it to be NULL (i.e.,
myclass::myclass():PgDatabaseInstanceMember(NULL) ), this causes a core
dump, what's wrong with that?
My intension is to get dbname from user's input, then
create the instance using PgDatabase(dbname), because
dbname should be provided by user.
Thanks for any suggestions.
inkle
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [INTERFACES] libpq++ ---- PgDatabase instance problem
@ 1999-08-20 11:42 Patrick Welche <prlw1@newn.cam.ac.uk>
parent: inkle c <inkle99@yahoo.com>
0 siblings, 0 replies; 6+ messages in thread
From: Patrick Welche @ 1999-08-20 11:42 UTC (permalink / raw)
To: inkle99@yahoo.com; +Cc: pgsql-interfaces
inkle c wrote:
>
> Hi,
>
> I am writing a small class which has a PgDatabase
> instance as its private member, and in the constructor,
> I init it to be NULL (i.e.,
> myclass::myclass():PgDatabaseInstanceMember(NULL) ), this causes a core
> dump, what's wrong with that?
I'm not too sure what you want, but how about
myclass::myclass():PgDatabase()
?
Cheers,
Patrick
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [INTERFACES] libpq++ ---- PgDatabase instance problem
@ 1999-08-20 13:38 inkle c <inkle99@yahoo.com>
0 siblings, 2 replies; 6+ messages in thread
From: inkle c @ 1999-08-20 13:38 UTC (permalink / raw)
To: prlw1@cam.ac.uk; +Cc: pgsql-interfaces
Well, this is where the problem comes because PgDatabase() is a
protected constructor, myclass doesn't inherit from PgDatabase. In
simple words:
==============================================
class myclass {
public:
myclass();
private:
PgDatabase db;
}
myclass::myclass():db(NULL){
some-other-stuff-goes-here
};
===============================================
the above codes causes me trouble as I described
below, any ideas how to fix it? I also tried
PgDatabase db as a global variable and init it to
be NULL, but this causes the same problem.
Thanks.
inkle
--- Patrick Welche <prlw1@newn.cam.ac.uk> wrote:
> inkle c wrote:
> >
> > Hi,
> >
> > I am writing a small class which has a PgDatabase
> > instance as its private member, and in the
> constructor,
> > I init it to be NULL (i.e.,
> > myclass::myclass():PgDatabaseInstanceMember(NULL)
> ), this causes a core
> > dump, what's wrong with that?
>
> I'm not too sure what you want, but how about
>
> myclass::myclass():PgDatabase()
>
> ?
>
> Cheers,
>
> Patrick
>
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [INTERFACES] libpq++ ---- PgDatabase instance problem
@ 1999-08-20 14:04 Patrick Welche <prlw1@newn.cam.ac.uk>
parent: inkle c <inkle99@yahoo.com>
1 sibling, 0 replies; 6+ messages in thread
From: Patrick Welche @ 1999-08-20 14:04 UTC (permalink / raw)
To: inkle99@yahoo.com; +Cc: prlw1@cam.ac.uk; pgsql-interfaces
inkle c wrote:
>
> Well, this is where the problem comes because PgDatabase() is a
> protected constructor, myclass doesn't inherit from PgDatabase. In
> simple words:
> ==============================================
> class myclass {
> public:
> myclass();
> private:
> PgDatabase db;
> }
>
> myclass::myclass():db(NULL){
> some-other-stuff-goes-here
> };
> ===============================================
> the above codes causes me trouble as I described
> below, any ideas how to fix it? I also tried
> PgDatabase db as a global variable and init it to
> be NULL, but this causes the same problem.
As far as I remember if you send NULL, you are saying that
the string that PgDatabase uses is empty rather than being say
"dbname=test", and that it should try to connect ?using defaults?,
whereas if you just db(), you are saying, this instance isn't
initialised, create it, but don't connect. I'm afraid I can't
UTSL at the moment...
Cheers,
Patrick
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [INTERFACES] libpq++ ---- PgDatabase instance problem
@ 1999-08-20 17:24 Yu Cao <yucao@falcon.kla-tencor.com>
parent: inkle c <inkle99@yahoo.com>
1 sibling, 0 replies; 6+ messages in thread
From: Yu Cao @ 1999-08-20 17:24 UTC (permalink / raw)
To: inkle c <inkle99@yahoo.com>; +Cc: pgsql-interfaces
Sounds like you can just have a pointer to PgDatabase in your class
(private: PgDatabase* db_ptr;), and initialize that to the NULL
pointer. Later on you instantiate PgDatabase with "new".
--Yu Cao
On Fri, 20 Aug 1999, inkle c wrote:
> Well, this is where the problem comes because PgDatabase() is a
> protected constructor, myclass doesn't inherit from PgDatabase. In
> simple words:
> ==============================================
> class myclass {
> public:
> myclass();
> private:
> PgDatabase db;
> }
>
> myclass::myclass():db(NULL){
> some-other-stuff-goes-here
> };
> ===============================================
> the above codes causes me trouble as I described
> below, any ideas how to fix it? I also tried
> PgDatabase db as a global variable and init it to
> be NULL, but this causes the same problem.
>
> Thanks.
>
> inkle
>
> --- Patrick Welche <prlw1@newn.cam.ac.uk> wrote:
> > inkle c wrote:
> > >
> > > Hi,
> > >
> > > I am writing a small class which has a PgDatabase
> > > instance as its private member, and in the
> > constructor,
> > > I init it to be NULL (i.e.,
> > > myclass::myclass():PgDatabaseInstanceMember(NULL)
> > ), this causes a core
> > > dump, what's wrong with that?
> >
> > I'm not too sure what you want, but how about
> >
> > myclass::myclass():PgDatabase()
> >
> > ?
> >
> > Cheers,
> >
> > Patrick
> >
>
> __________________________________________________
> Do You Yahoo!?
> Bid and sell for free at http://auctions.yahoo.com
>
>
> ************
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~1999-08-20 17:24 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-08-20 04:12 libpq++ ---- PgDatabase instance problem inkle c <inkle99@yahoo.com>
1999-08-20 04:22 libpq++ ---- PgDatabase instance problem inkle c <inkle99@yahoo.com>
1999-08-20 11:42 ` Patrick Welche <prlw1@newn.cam.ac.uk>
1999-08-20 13:38 Re: [INTERFACES] libpq++ ---- PgDatabase instance problem inkle c <inkle99@yahoo.com>
1999-08-20 14:04 ` Patrick Welche <prlw1@newn.cam.ac.uk>
1999-08-20 17:24 ` Yu Cao <yucao@falcon.kla-tencor.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox