Skip to content

Instantly share code, notes, and snippets.

@thejhh
Created April 9, 2012 05:22
Show Gist options
  • Select an option

  • Save thejhh/2341654 to your computer and use it in GitHub Desktop.

Select an option

Save thejhh/2341654 to your computer and use it in GitHub Desktop.
mysql> SELECT * FROM freeciv_client_unitlog;
+------------+---------------------+-----------+--------+--------+------------------+---------+--------------+---------+
| unitlog_id | created | unit_name | unit_x | unit_y | player_name | unit_hp | unit_veteran | unit_id |
+------------+---------------------+-----------+--------+--------+------------------+---------+--------------+---------+
| 1 | 0000-00-00 00:00:00 | Trireme | 60 | 1 | Domenico Fattori | 10 | 0 | 164 |
| 2 | 0000-00-00 00:00:00 | Trireme | 67 | 14 | Domenico Fattori | 10 | 1 | 397 |
| 3 | 0000-00-00 00:00:00 | Trireme | 66 | 15 | Domenico Fattori | 10 | 1 | 397 |
| 4 | 0000-00-00 00:00:00 | Trireme | 65 | 16 | Domenico Fattori | 10 | 1 | 397 |
+------------+---------------------+-----------+--------+--------+------------------+---------+--------------+---------+
4 rows in set (0.00 sec)
High level C-code for executing this query at client:
client_mysql_insert(
"INSERT INTO `" CLIENT_MYSQL_UNITLOG_TABLE "` "
"(created,unit_name,unit_x,unit_y,player_name,unit_hp,unit_veteran,unit_id) "
"VALUES (unix_timestamp(),%s,%d,%d,%s,%d,%d,%d)",
unit_rule_name(punit),
TILE_XY(punit->tile),
punit->owner->name,
punit->hp,
punit->veteran,
punit->id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment