Changed the test to use libmysqld
This commit is contained in:
parent
ab294a18f0
commit
59b0eee999
@ -7,8 +7,8 @@ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
|
||||
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
|
||||
|
||||
# Find MySQL client library and header files
|
||||
find_library(MySQL_LIBRARY NAMES mysqlclient_r mysqlclient PATHS
|
||||
/usr/lib64/mysql /usr/lib/mysql)
|
||||
find_library(MySQL_LIBRARY NAMES libmysqld.a PATHS
|
||||
/usr/lib64/mysql /usr/lib/mysql /usr/local/mysql/lib)
|
||||
find_path(MySQL_INCLUDE_DIR mysql.h
|
||||
/usr/local/include/mysql /usr/include/mysql)
|
||||
include_directories(${MySQL_INCLUDE_DIR})
|
||||
@ -21,5 +21,5 @@ include_directories(${SkySQL_INCLUDE_DIR})
|
||||
# Build rule for example
|
||||
foreach(prog Example)
|
||||
ADD_EXECUTABLE(${prog} ${prog}.c)
|
||||
TARGET_LINK_LIBRARIES(${prog} table_replication_consistency.a replication boost_system pthread stdc++ crypt aio)
|
||||
TARGET_LINK_LIBRARIES(${prog} table_replication_consistency.a replication boost_system pthread stdc++ ${MySQL_LIBRARY} crypt aio)
|
||||
endforeach()
|
||||
|
Binary file not shown.
@ -4,6 +4,25 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <mysql.h>
|
||||
|
||||
static char* server_options[] = {
|
||||
"jan test",
|
||||
"--datadir=/tmp/",
|
||||
"--skip-innodb",
|
||||
"--default-storage-engine=myisam",
|
||||
NULL
|
||||
};
|
||||
|
||||
const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
|
||||
|
||||
static char* server_groups[] = {
|
||||
"embedded",
|
||||
"server",
|
||||
"server",
|
||||
"server",
|
||||
NULL
|
||||
};
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
@ -13,6 +32,13 @@ int main(int argc, char** argv)
|
||||
replication_listener_t *mrl;
|
||||
int err=0;
|
||||
|
||||
// This will initialize MySQL
|
||||
if (mysql_server_init(num_elements, server_options, server_groups)) {
|
||||
printf("MySQL server init failed\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
mrl = (replication_listener_t*)calloc(argc, sizeof(replication_listener_t));
|
||||
|
||||
if (argc < 2) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user