/[LeafOK_CVS]/lbbs/src/database.c
ViewVC logotype

Diff of /lbbs/src/database.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.7 by sysadm, Mon Apr 28 03:30:59 2025 UTC Revision 1.9 by sysadm, Wed Apr 30 09:18:19 2025 UTC
# Line 16  Line 16 
16   ***************************************************************************/   ***************************************************************************/
17    
18  #include "common.h"  #include "common.h"
19    #include "log.h"
20  #include <mysql.h>  #include <mysql.h>
21  #include <stdio.h>  #include <stdio.h>
22    
# Line 23  MYSQL * Line 24  MYSQL *
24  db_open()  db_open()
25  {  {
26          MYSQL *db;          MYSQL *db;
27            char sql[1024];
28    
29          db = mysql_init(NULL);          db = mysql_init(NULL);
30          if (db == NULL)          if (db == NULL)
# Line 39  db_open() Line 41  db_open()
41                  return NULL;                  return NULL;
42          }          }
43    
44          if (mysql_query(db, "SET CHARACTER SET gb2312") != 0)          if (mysql_set_character_set(db, "gb2312") != 0)
45          {          {
46                  log_error("SET CHARACTER SET failed\n");                  log_error("Set character set failed\n");
47                  return NULL;                  return NULL;
48          }          }
49    
50          if (mysql_query(db, "SET NAMES \'gb2312\'") != 0)          sprintf(sql,
51                    "SET time_zone = '%s'",
52                    DB_timezone);
53    
54            if (mysql_query(db, sql) != 0)
55          {          {
56                  log_error("SET NAMES failed\n");                  log_error("Set timezone failed\n");
57                  return NULL;                  return NULL;
58          }          }
59    


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1