MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/samples/db/pgsql_pool/main.cpp:279–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277//////////////////////////////////////////////////////////////////////////////
278
279int 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 // �����ݱ�������ʱ������

Callers

nothing calls this directly

Calls 12

acl_cpp_initFunction · 0.85
getsMethod · 0.80
putsMethod · 0.80
beginMethod · 0.80
tbl_createFunction · 0.70
formatMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45
push_backMethod · 0.45
startMethod · 0.45
endMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…