From 4b08ea89e19a48657a53d0b5ea19a46f9c0ec5e9 Mon Sep 17 00:00:00 2001 From: wang_chengh <13383929+wang_chengh@user.noreply.gitee.com> Date: Tue, 19 Sep 2023 18:34:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=89=8D=E6=9C=9F=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/cgi-bin/C_mysql_r_json.c | 47 ------------------------------------ 1 file changed, 47 deletions(-) delete mode 100644 www/cgi-bin/C_mysql_r_json.c diff --git a/www/cgi-bin/C_mysql_r_json.c b/www/cgi-bin/C_mysql_r_json.c deleted file mode 100644 index e7ae264..0000000 --- a/www/cgi-bin/C_mysql_r_json.c +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include -#include - -int main() { - MYSQL *conn; - MYSQL_RES *res; - MYSQL_ROW row; - - conn = mysql_init(NULL); - if (conn == NULL) { - fprintf(stderr, "mysql_init() failed\n"); - exit(1); - } - - if (mysql_real_connect(conn, "localhost", "root", "root", "router", 3306, - NULL, 0) == NULL) { - fprintf(stderr, "mysql_real_connect() failed\n"); - mysql_close(conn); - exit(1); - } - - if (mysql_query(conn, - "SELECT JSON_OBJECT('username', username, 'password', " - "password) FROM users")) { - fprintf(stderr, "SELECT query failed. Error: %s\n", mysql_error(conn)); - mysql_close(conn); - exit(1); - } - - res = mysql_store_result(conn); - if (res == NULL) { - fprintf(stderr, "mysql_store_result() failed\n"); - mysql_close(conn); - exit(1); - } - - while ((row = mysql_fetch_row(res))) { - printf("%s\n", row[0]); - } - - mysql_free_result(res); - mysql_close(conn); - - return 0; -}