You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
745 B
25 lines
745 B
#include <libpq-fe.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
int main()
|
|
{
|
|
int version = PQlibVersion();
|
|
char version_string[100];
|
|
// 9.x and older encoding.
|
|
if (version < 100000) {
|
|
int major = version / 10000;
|
|
int minor = version % 10000 / 100;
|
|
int patch = version % 100;
|
|
snprintf(version_string, sizeof(version_string), "%d.%d.%d", major, minor,
|
|
patch);
|
|
} else {
|
|
int major = version / 10000;
|
|
int minor = version % 10000;
|
|
snprintf(version_string, sizeof(version_string), "%d.%d", major, minor);
|
|
}
|
|
printf("Found PostgreSQL version %s, expected version %s\n", version_string,
|
|
CMAKE_EXPECTED_POSTGRESQL_VERSION);
|
|
return strcmp(version_string, CMAKE_EXPECTED_POSTGRESQL_VERSION);
|
|
}
|