Sanxi wang this is a test from another linux machine(test machine: 172.25.17.99, mysql machine 172.25.17. The LENGTH() function returns the length of a string (in bytes). Gcc -o main main.c msi.c -lmysqlclient_r -lz Printf("\tmsi_ping_test Error(%d): %s\n", err, mysql_error(&mysql)) In addition, if the result set contains binary data, you must use this function to determine the size of the data, because strlen() returns incorrect results. If(msi_init(hostname,dbname,username,passwd)) return -2 If(parse_mysql_url(mysql_url)) return -1 If(!mysql_real_connect(&mysql, hostname, username, passwd, dbname, 0, NULL, CLIENT_MULTI_RESULTS)) If(hostname=NULL || dbname=NULL || username=NULL || passwd=NULL) return -1 Int msi_init(char *hostname, char *dbname, char *username, char *passwd) Memcpy(hostname, p, sizeof(hostname)-1 ) Memcpy(username, p, sizeof(username)-1 ) If(strncmp(mysql_url,MYSQL_HEADER, strlen(MYSQL_HEADER))) Memset(hostname, (char)0, sizeof(hostname)) Is there a way to select database table rows where a given value is a certain length, for example, less than 5 chars long In PHP that would be strlen. ok 4 - mbstrlen is slower than strlen mbstrtolower is 43.5 slower than strtolower benchmarking strtoupper vs. Memset(username, (char)0, sizeof(username)) Strftime(dt, sizeof(dt), "%F %T", localtime(&now)) Ĭhar username, passwd, hostname, dbname Printf( "epcs: connect db %s SUCCESS\n", db_url) Printf( "epcs: connect db %s error: %d\n", db_url, retv) Maybe, the function "If the connection has gone down, an automatic reconnection is attempted. The LENGTH() function takes a string argument and returns its length measured in bytes. If no access to mysql server using a mysql HANDLE after a long time, when using mysql_ping to test the mysql HANDLE, sometimes, it return false and mysql server is still alive. The LENGTH() function returns the length of a string measured in bytes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |