freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Frediano Ziglio <freddy77 AT gmail.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] version detection
- Date: Wed, 22 Jun 2016 16:41:19 +0100
2016-06-21 22:45 GMT+01:00 Adam Baratz <adam.baratz AT gmail.com>:
> Following up on my pdo_dblib thread, I'd like to be able to detect which
> version of FreeTDS is installed. So I can know when the dbnextrow()
> workaround should be used instead of dbcanquery(). As far as I can tell,
> the version only gets exposed through dbversion(), which is a string I'd
> have to parse.
>
> Thanks,
> Adam
I don't see another way using dblib calls. You could use some packaging
method testing the version.
As dbversion just returns a constant string you could just use a function
caching the results, like
bool check_dbcanquery_works(void)
{
static bool initialized = false;
static bool ok = false;
if (!initialized) {
const char *version = dbversion();
int maj, min, fix = 0;
if (sscanf(version, "freetds v%d.%d.%d", &maj, &min, &fix) >= 2
&& ((maj << 24) | (min << 16) | fix) >= 0x01000006)
ok = true;
initialized = true;
}
return ok;
}
Frediano
-
[freetds] version detection,
Adam Baratz, 06/21/2016
- Re: [freetds] version detection, Frediano Ziglio, 06/22/2016
Archive powered by MHonArc 2.6.24.