| 277 | ////////////////////////////////////////////////////////////////////////////// |
| 278 | |
| 279 | int main(void) |
| 280 | { |
| 281 | // WIN32 ����Ҫ���ô˺��������й� SOCKET �ij�ʼ�� |
| 282 | acl::acl_cpp_init(); |
| 283 | |
| 284 | // ������������־�������Ļ |
| 285 | acl::log::stdout_open(true); |
| 286 | |
| 287 | acl::string line; |
| 288 | acl::stdin_stream in; |
| 289 | acl::stdout_stream out; |
| 290 | |
| 291 | #if defined(_WIN32) || defined(_WIN64) |
| 292 | const char* libname = "libpq.dll"; |
| 293 | #else |
| 294 | const char* libname = "libpq.so"; |
| 295 | #endif |
| 296 | |
| 297 | acl::string path; |
| 298 | |
| 299 | // ��Ϊ���ö�̬���صķ�ʽ��������ҪӦ�ø��� pgsql �ͻ��˿����ڵ�·�� |
| 300 | out.format("Enter %s load path: ", libname); |
| 301 | if (in.gets(line) && !line.empty()) |
| 302 | #if defined(_WIN32) || defined(_WIN64) |
| 303 | path.format("%s\\%s", line.c_str(), libname); |
| 304 | #else |
| 305 | path.format("%s/%s", line.c_str(), libname); |
| 306 | #endif |
| 307 | else |
| 308 | path = libname; |
| 309 | |
| 310 | out.format("%s path: %s\r\n", libname, path.c_str()); |
| 311 | // ���ö�̬����ص�ȫ·�� |
| 312 | acl::db_handle::set_loadpath(path); |
| 313 | |
| 314 | acl::string dbaddr("127.0.0.1:5432"); |
| 315 | acl::string dbname("acl_db"), dbuser, dbpass; |
| 316 | |
| 317 | out.format("Enter dbaddr [default: %s]: ", dbaddr.c_str()); |
| 318 | if (in.gets(line) && !line.empty()) |
| 319 | dbaddr = line; |
| 320 | |
| 321 | out.format("Enter dbname [default: %s]: ", dbname.c_str()); |
| 322 | if (in.gets(line) && !line.empty()) |
| 323 | dbname = line; |
| 324 | |
| 325 | out.format("Enter dbuser [default: %s]: ", dbuser.c_str()); |
| 326 | if (in.gets(line) && !line.empty()) |
| 327 | dbuser = line; |
| 328 | |
| 329 | out.format("Enter dbpass [default: %s]: ", dbpass.c_str()); |
| 330 | if (in.gets(line) && !line.empty()) |
| 331 | dbpass = line; |
| 332 | |
| 333 | out.format("dbname: %s, dbuser: %s, dbpass: %s\r\n", |
| 334 | dbname.c_str(), dbuser.c_str(), dbpass.c_str()); |
| 335 | |
| 336 | // �����ݱ�������ʱ������ |
nothing calls this directly
no test coverage detected
searching dependent graphs…