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

Function main

lib_acl_cpp/samples/db/mysql_query/main.cpp:251–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251int main(void)
252{
253 // WIN32 ����Ҫ���ô˺��������й� SOCKET �ij�ʼ��
254 acl::acl_cpp_init();
255
256 // ������������־�������Ļ
257 acl::log::stdout_open(true);
258
259 acl::string line;
260 acl::stdin_stream in;
261 acl::stdout_stream out;
262
263#if defined(_WIN32) || defined(_WIN64)
264 const char* libname = "libmysql.dll";
265#elif defined(__APPLE__)
266 const char* libname = "libmysqlclient.dylib";
267#else
268 const char* libname = "libmysqlclient.so";
269#endif
270
271 acl::string path;
272
273 // ��Ϊ���ö�̬���صķ�ʽ��������ҪӦ�ø��� mysql �ͻ��˿����ڵ�·��
274 out.format("Enter %s load path: ", libname);
275 if (in.gets(line) && !line.empty())
276#if defined(_WIN32) || defined(_WIN64)
277 path.format("%s\\%s", line.c_str(), libname);
278#else
279 path.format("%s/%s", line.c_str(), libname);
280#endif
281 else
282 path = libname;
283
284#if defined(__linux__) || defined(__APPLE__)
285 if (access(path, R_OK) != 0)
286 {
287 printf("%s not found\r\n", path.c_str());
288 return 1;
289 }
290#endif
291
292 out.format("%s path: %s\r\n", libname, path.c_str());
293 // ���ö�̬����ص�ȫ·��
294 acl::db_handle::set_loadpath(path);
295
296 acl::string dbaddr("127.0.0.1:3306");
297 acl::string dbname("acl_db"), dbuser("root"), dbpass;
298
299 out.format("Enter dbaddr [default: %s]: ", dbaddr.c_str());
300 if (in.gets(line) && !line.empty())
301 dbaddr = line;
302
303 out.format("Enter dbname [default: %s]: ", dbname.c_str());
304 if (in.gets(line) && !line.empty())
305 dbname = line;
306
307 out.format("Enter dbuser [default: %s]: ", dbuser.c_str());
308 if (in.gets(line) && !line.empty())

Callers

nothing calls this directly

Calls 15

acl_cpp_initFunction · 0.85
getsMethod · 0.80
putsMethod · 0.80
mysql_libversionMethod · 0.80
mysql_client_infoMethod · 0.80
db_createFunction · 0.70
tbl_createFunction · 0.70
tbl_insertFunction · 0.70
tbl_selectFunction · 0.70
tbl_deleteFunction · 0.70
formatMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…