summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-03-15 13:43:33 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-03-15 13:43:33 +0100
commit0dba5653994d79ddbe1f7c03f6363b7eee780313 (patch)
treeae849383c350e6ca1df0687633f62fde4bfe216d /core/src/ch/asynk
parentd7df2eb811b11eab996728c7dfe0a01aae2eb9df (diff)
downloadRustAndDust-0dba5653994d79ddbe1f7c03f6363b7eee780313.zip
RustAndDust-0dba5653994d79ddbe1f7c03f6363b7eee780313.tar.gz
DB: add storeTurn(int) that copies data from games table
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/rustanddust/util/DB.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/util/DB.java b/core/src/ch/asynk/rustanddust/util/DB.java
index 2e108ca..f143585 100644
--- a/core/src/ch/asynk/rustanddust/util/DB.java
+++ b/core/src/ch/asynk/rustanddust/util/DB.java
@@ -247,6 +247,19 @@ public class DB
return getGameId(opponent, battle, mode);
}
+ private static final String COPY_TURN = "insert into turns(game,turn,player,hash,payload) select _id, turn, player, hash, payload from games where _id=%d;";
+
+ public boolean storeTurn(int game)
+ {
+ try {
+ exec(String.format(COPY_TURN, game));
+ } catch (SQLiteGdxException e) {
+ RustAndDust.error("storeTurn");
+ return false;
+ }
+ return true;
+ }
+
private static final String INSERT_TURN = "insert into turns(game,turn,player,hash,payload) values (%d,%d,%d,'%s','%s');";
public boolean storeTurn(int game, int turn, int player, String payload)