From 9b81cdebba95f1b6e687191c630c1f8f6cf0df16 Mon Sep 17 00:00:00 2001 From: znone <glyc@sina.com.cn> Date: Thu, 25 Mar 2021 12:44:30 +0000 Subject: [PATCH] PostgreSQL: Support asynchronous operation Fix bug in different versions of asio --- test/test_postgres.mak | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/test/test_postgres.mak b/test/test_postgres.mak index 337a635..e6f6e7a 100644 --- a/test/test_postgres.mak +++ b/test/test_postgres.mak @@ -1,24 +1,30 @@ -TARGET=test_postgres +TARGET=test_postgres async_postgres CC=g++ PCH_HEADER=stdafx.h PCH=stdafx.h.gch -OBJ=TestPostgres.o md5.o -CFLAGS=-g -D_DEBUG -O2-I/usr/include -I/usr/local/include -I$(shell pg_config --includedir) -I$(shell pg_config --includedir-server ) +OBJ=TestPostgres.o AsyncPostgres.o md5.o +CFLAGS=-g -D_DEBUG -O2 -I/usr/include -I/usr/local/include -I$(shell pg_config --includedir) -I$(shell pg_config --includedir-server ) CXXFLAGS= -I../include -std=c++11 -LDFLAGS= -L$(shell pg_config --libdir) -lcpptest -lpq -lpgtypes +LDFLAGS= -L$(shell pg_config --libdir) -pthread -lcpptest -lpq -lpgtypes all : $(TARGET) $(PCH) : $(PCH_HEADER) $(CC) $(CFLAGS) $(CXXFLAGS) -x c++-header -o $@ $< -TestPostgres.o : TestPostgres.cpp $(PCH) +TestPostgres.o : TestPostgres.cpp TestPostgres.h $(PCH) + $(CC) -c $(CFLAGS) $(CXXFLAGS) -o $@ $< + +AsyncPostgres.o : AsyncPostgres.cpp $(PCH) $(CC) -c $(CFLAGS) $(CXXFLAGS) -o $@ $< md5.o : md5.c md5.h gcc -c $(CFLAGS) -o $@ $< -$(TARGET) : $(OBJ) +test_postgres : TestPostgres.o md5.o + libtool --tag=CXX --mode=link $(CC) $(LDFLAGS) -o $@ $^ + +async_postgres : AsyncPostgres.o md5.o libtool --tag=CXX --mode=link $(CC) $(LDFLAGS) -o $@ $^ clean: -- Gitblit v1.9.3