- Timestamp:
- Nov 27, 2012, 4:24:49 PM (12 years ago)
- Branches:
- master
- Children:
- 59061f6
- Parents:
- 8e540f4
- Location:
- server
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
server/makefile
r8e540f4 r36082e8 3 3 FLAGS = $(LIB_FLAGS) 4 4 COMMON_PATH = ../common 5 DEPENDENCIES = message.o Player.o 5 DEPENDENCIES = message.o Player.o DataAccess.o 6 6 7 7 server : server.cpp $(DEPENDENCIES) -
server/server.cpp
r8e540f4 r36082e8 14 14 #include <arpa/inet.h> 15 15 16 #include <mysql/mysql.h>17 18 16 #include <openssl/bio.h> 19 17 #include <openssl/ssl.h> … … 21 19 22 20 #include "Player.h" 21 #include "DataAccess.h" 23 22 #include "../common/message.h" 24 23 … … 239 238 } 240 239 } 241 242 int dbtest()243 {244 MYSQL *connection, mysql;245 MYSQL_RES *result;246 MYSQL_ROW row;247 int query_state;248 249 mysql_init(&mysql);250 251 connection = mysql_real_connect(&mysql,"localhost","pythonAdmin","pyMaster09*","pythondb",0,0,0);252 253 if (connection == NULL) {254 cout << mysql_error(&mysql) << endl;255 return 1;256 }else257 cout << "Connection successful" << endl;258 259 query_state = mysql_query(connection, "SELECT * FROM users");260 261 if (query_state !=0) {262 cout << mysql_error(connection) << endl;263 return 1;264 }265 266 result = mysql_store_result(connection);267 268 while ( ( row = mysql_fetch_row(result)) != NULL ) {269 cout << row[0] << ", " << row[1] << ", " << row[2] << endl;270 }271 272 mysql_free_result(result);273 mysql_close(connection);274 275 cout << "Test finished" << endl;276 277 return 0;278 }
Note:
See TracChangeset
for help on using the changeset viewer.