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

Function main

lib_acl_cpp/samples/db/mysql_pool/main.cpp:329–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327//////////////////////////////////////////////////////////////////////////////
328
329int main(void)
330{
331 // WIN32 ����Ҫ���ô˺��������й� SOCKET �ij�ʼ��
332 acl::acl_cpp_init();
333
334 // ������������־�������Ļ
335 acl::log::stdout_open(true);
336
337 acl::string line;
338 acl::stdin_stream in;
339 acl::stdout_stream out;
340
341#if defined(_WIN32) || defined(_WIN64)
342 const char* libname = "libmysql.dll";
343#else
344 const char* libname = "libmysqlclient_r.so";
345#endif
346
347 acl::string path;
348
349 // ��Ϊ���ö�̬���صķ�ʽ��������ҪӦ�ø��� mysql �ͻ��˿����ڵ�·��
350 out.format("Enter %s load path: ", libname);
351 if (in.gets(line) && !line.empty())
352#if defined(_WIN32) || defined(_WIN64)
353 path.format("%s\\%s", line.c_str(), libname);
354#else
355 path.format("%s/%s", line.c_str(), libname);
356#endif
357 else
358 path = libname;
359
360 out.format("%s path: %s\r\n", libname, path.c_str());
361 // ���ö�̬����ص�ȫ·��
362 acl::db_handle::set_loadpath(path);
363
364 acl::string dbaddr("127.0.0.1:3306");
365 acl::string dbname("acl_db"), dbuser("root"), dbpass;
366
367 out.format("Enter dbaddr [default: %s]: ", dbaddr.c_str());
368 if (in.gets(line) && !line.empty())
369 dbaddr = line;
370
371 out.format("Enter dbname [default: %s]: ", dbname.c_str());
372 if (in.gets(line) && !line.empty())
373 dbname = line;
374
375 out.format("Enter dbuser [default: %s]: ", dbuser.c_str());
376 if (in.gets(line) && !line.empty())
377 dbuser = line;
378
379 out.format("Enter dbpass [default: %s]: ", dbpass.c_str());
380 if (in.gets(line) && !line.empty())
381 dbpass = line;
382
383 out.format("dbname: %s, dbuser: %s, dbpass: %s\r\n",
384 dbname.c_str(), dbuser.c_str(), dbpass.c_str());
385
386 // �����Ҫ�������ݿ⣬����Ҫ�� root ���ݽ��д���

Callers

nothing calls this directly

Calls 13

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…