Changeset - 621d85a64fff
[Not reviewed]
0 1 0
Vitaly Takmazov - 9 years ago 2016-05-27 22:48:51
vitalyster@gmail.com
MySQL: do not forget to use table prefix
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
libtransport/MySQLBackend.cpp
Show inline comments
 
@@ -397,25 +397,25 @@ bool MySQLBackend::createDatabase() {
 
				"`var` varchar(50) collate utf8_bin NOT NULL,"
 
				"`type` smallint(4) unsigned NOT NULL,"
 
				"`value` varchar(255) collate utf8_bin NOT NULL,"
 
				"PRIMARY KEY (`user_id`,`var`),"
 
				"KEY `user_id` (`user_id`)"
 
			") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;");
 

	
 
		exec("CREATE TABLE IF NOT EXISTS `" + m_prefix + "db_version` ("
 
				"`ver` int(10) unsigned NOT NULL default '1',"
 
				"UNIQUE KEY `ver` (`ver`)"
 
			") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;");
 

	
 
		exec("INSERT IGNORE INTO db_version (ver) VALUES ('2');");
 
		exec("INSERT IGNORE INTO `" + m_prefix + "db_version` (ver) VALUES ('2');");
 
	}
 

	
 
	return true;
 
}
 

	
 
bool MySQLBackend::exec(const std::string &query) {
 
	if (mysql_query(&m_conn, query.c_str())) {
 
		LOG4CXX_ERROR(logger, query << " " << mysql_error(&m_conn));
 
		return false;
 
	}
 
	return true;
 
}
0 comments (0 inline, 0 general)