Skip to content
Browse files

Add patch

  • Loading branch information...
1 parent cca1aca commit 7aae05e330112201ad8cf26119fff3f3d7ce8ff5 @tmcw tmcw committed May 22, 2012
Showing with 37 additions and 0 deletions.
  1. +37 −0 patch
View
37 patch
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+# Usage:
+#
+# $ patch [source] [dest]
+#
+# Inserts all tiles from [source] into [dest], replacing any old tiles
+# in [dest].
+
+SOURCE=$1
+DEST=$2
+
+if [ -z "$SOURCE" ] || [ -z "$DEST" ]; then
+ echo "Usage: merge [source] [dest]"
+ exit 1
+fi
+
+if [ ! -f $SOURCE ]; then
+ echo "File '$SOURCE' does not exist."
+ exit 1
+fi
+
+if [ ! -f $DEST ]; then
+ echo "File '$DEST' does not exist."
+ exit 1
+fi
+
+echo "Patch $SOURCE => $DEST ..."
+
+echo "
+PRAGMA journal_mode=PERSIST;
+PRAGMA page_size=80000;
+PRAGMA synchronous=OFF;
+ATTACH DATABASE '$1' AS source;
+REPLACE INTO map SELECT * FROM source.map;
+REPLACE INTO images SELECT * FROM source.images;"\
+| sqlite3 $2

0 comments on commit 7aae05e

Please sign in to comment.
Something went wrong with that request. Please try again.