IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 21 years ago

Closed 21 years ago

Last modified 21 years ago

#478 closed defect (fixed)

psDB - Mysql

Reported by: David.Robbins@… Owned by: jhoblitt
Priority: high Milestone:
Component: PSLib SDRS Version: unspecified
Severity: normal Keywords:
Cc: robert.desonia@…

Description

in 5.2.1 the SDRS has a change to the psDB struct:
typedef struct{

MYSQL *mysql;

} psDB;
The code currently uses a void * which is more general and thus, probably more
desirable. The bigger issue here however, is that by linking mysql in the
header file memory allocation problems arise as my_alloc.h reports attempts to
use poisoned "free". (Currently the DB fxns aren't linked to mysql).
If this instance is something that is absolutely needed, we will need further
instructions on how you would like this implemented.

Change History (9)

comment:1 by Paul Price, 21 years ago

Cc: price@… added
Owner: changed from Paul Price to jhoblitt

comment:2 by jhoblitt, 21 years ago

Is there any reason the poison pragma can't be avoided by including the mysql.h
header before any of the ps* headers?

comment:3 by David.Robbins@…, 21 years ago

Since this is a C header file, we have no control over when it gets included.

comment:4 by jhoblitt, 21 years ago

I'm not sure that I understand your last comment. I believe that the problem
your describing is because mysql.h is being included after psMemory.h when using
pslib.h to link against pslib - is that correct or have I miss-understood the
problem?

comment:5 by robert.desonia@…, 21 years ago

Yes, that is one of the issues. It is really a poor design to require header
files to be included in a specific order, as you suggested. We may be able to
push the inclusion of psDB.h up in psLib.h and get away things, but that is a
bit hacky, in my opinion.

Besides that, there should be no reason why we need to expose our mysql object
to the user. I contend that that implementation fact (use of MySQL) is best
kept outside of the API, if possible. We don't want the user to assume that
they can use the MYSQL object outside of psLib control.

Keeping it void* allows the substitution of the SQL backend, e.g., Oracle, etc.,
without API change.

-rdd

comment:6 by Paul Price, 21 years ago

Resolution: fixed
Status: newclosed

Agreed.

typedef struct {

void *db;

} psDB;

comment:7 by David.Robbins@…, 21 years ago

so are we changing the name to db?
ie. was (void *mysql;)

now (void *db;)

comment:8 by Paul Price, 21 years ago

Cc: robert.desonia@… added

I figure if we abstract the type, we should abstract the name as well.

comment:9 by jhoblitt, 21 years ago

bug_group: IPP-doc?

I agree that it is poor design to require header files to be included in a
specific order. I also believe that it is poor design to use a void * work
around GCC's limited pragma support. I'd rather see the poision pragma done
away with then give up on type checking for external linkages.

Also, making the struct member void * in no way works around having to make an
API change to support multiple database backends. At a minimum the constructor
will have to be changed or split into one function per database back end and the
psDB changed to include the the type of database object. I had envisioned
something like this:

typedef struct{

psDBType type;
union {

MYSQL *mysql;
PGConn *postgres;
...

};

} psDB;

*But* lets not go making changes based on what we 'might' decide to do in the
future, espcialy when such changes have a rather low possibility of ever occuring.

For the time being, as there are more important issue than discussing the
poision pragma, I have changed psDB in the SDRS to the following as it will
require no action on the part of MHPCC:

typedef struct{

void *mysql;

} psDB;

Note: See TracTickets for help on using tickets.