Feature Requests item #1578577, was opened at 2006-10-16 16:18
Message generated for change (Comment added) made by pcmacdon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=512948&aid=1578577&group_id=65979

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Submitted By: Peter MacDonald (pcmacdon)
Assigned to: Nobody/Anonymous (nobody)
Summary: version number in header

Initial Comment:
As libdbi evolves and functions are added
it might be useful to put
a version number in the dbi.h header ala Tcl.  eg.

#define DBI_VERSION "8.1"
#define DBI_VERSION_MAJOR "8"
#define DBI_VERSION_MINOR "1"

and would save doing bit hit and miss things like

#ifdef DB_TYPES_NULL
...
#endif



----------------------------------------------------------------------

>Comment By: Peter MacDonald (pcmacdon)
Date: 2006-10-17 10:39

Message:
Logged In: YES 
user_id=190660

Yes, am aware of the dbi_version() et al functions
which work great for run-time, but not compile-time.
8.1 contained new functions that were not found in 7.1,
and there is no easy way to detect this at compile time.

Here is an example extract of what I'm doing now:

#ifdef DBI_VALUE_NULL
  if (!dbi_conn_quote_string(h->conn, &cpq)) {
    ...
  }
#else
  if (!dbi_driver_quote_string(dbi_conn_get_driver(h->conn),
&cpq)) {
     ...
  }
#endif

This works for 7.1-8.1, but will not for 9.1 (when it comes
out).
Version strings in the header will allow something like:

#define DBI_VERSION "9.1"
#define DBI_VERSION_MAJOR 9
#define DBI_VERSION_MINOR 1

/* ... */

#if (!defined(DBI_VERSION))
/* ... */
#elif ((DBI_VERSION_MINOR == 1) && (DBI_VERSION_MAJOR==9))
/* ... */
#else
/* ... */
#endif


----------------------------------------------------------------------

Comment By: Markus Hoenicka (mhoenicka)
Date: 2006-10-17 07:29

Message:
Logged In: YES 
user_id=85809

Are you aware of the current version facilities in libdbi?

const char *dbi_version() returns a string containing the
libdbi version

const char *dbi_driver_get_version(dbi_driver Driver)
returns a string containing the version of the database driver

Both libdbi and libdbi-drivers use the version value set in
configure.in. Having the version information in one spot
only greatly simplifies maintenance. Using functions instead
of defines to access the version values is preferable
because functions allow your code to adapt dynamically to
the installed versions of the library and the drivers.
defines create executables that are adapted to a particular
version at build time.

We should think about making the version information easier
to parse though. Strings do not lend themselves to easy
comparison. One way to fix this is to add functions that
return the version as an integer value, e.g. computed as
series*10000 + major*100 + minor, resulting in something
like 801 for version 0.8.1. A similar computation is used in
the dbi_conn_get_engine_version() function which returns the
version of the database engine.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=512948&aid=1578577&group_id=65979

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Libdbi-drivers-devel mailing list
Libdbi-drivers-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel

Reply via email to