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

Function main

lib_acl_cpp/samples/db/mysql_manager/main.cpp:353–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351//////////////////////////////////////////////////////////////////////////////
352
353int main(void)
354{
355 // WIN32 ����Ҫ���ô˺��������й� SOCKET �ij�ʼ��
356 acl::acl_cpp_init();
357
358 // ������������־�������Ļ
359 acl::log::stdout_open(true);
360
361 acl::string line;
362 acl::stdin_stream in;
363 acl::stdout_stream out;
364
365#if defined(_WIN32) || defined(_WIN64)
366 const char* libname = "libmysql.dll";
367#else
368 const char* libname = "libmysqlclient_r.so";
369#endif
370
371 acl::string path;
372
373 // ��Ϊ���ö�̬���صķ�ʽ��������ҪӦ�ø��� mysql �ͻ��˿����ڵ�·��
374 out.format("Enter %s load path: ", libname);
375 if (in.gets(line) && !line.empty())
376#if defined(_WIN32) || defined(_WIN64)
377 path.format("%s\\%s", line.c_str(), libname);
378#else
379 path.format("%s/%s", line.c_str(), libname);
380#endif
381 else
382 path = libname;
383
384 out.format("%s path: %s\r\n", libname, path.c_str());
385 // ���ö�̬����ص�ȫ·��
386 acl::db_handle::set_loadpath(path);
387
388 acl::string dbaddr("127.0.0.1:3306");
389 acl::string dbname("acl_db"), dbuser("root"), dbpass;
390
391 out.format("Enter dbaddr [default: %s]: ", dbaddr.c_str());
392 if (in.gets(line) && !line.empty())
393 dbaddr = line;
394
395 out.format("Enter dbname [default: %s]: ", dbname.c_str());
396 if (in.gets(line) && !line.empty())
397 dbname = line;
398
399 out.format("Enter dbuser [default: %s]: ", dbuser.c_str());
400 if (in.gets(line) && !line.empty())
401 dbuser = line;
402
403 out.format("Enter dbpass [default: %s]: ", dbpass.c_str());
404 if (in.gets(line) && !line.empty())
405 dbpass = line;
406
407 out.format("dbname: %s, dbuser: %s, dbpass: %s\r\n",
408 dbname.c_str(), dbuser.c_str(), dbpass.c_str());
409
410 // �����Ҫ�������ݿ⣬����Ҫ�� root ���ݽ��д���

Callers

nothing calls this directly

Calls 14

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
addMethod · 0.45
push_backMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…