+#ifdef __ANDROID__
+ /**
+ * Note: For some unknown reason sqlite3 fails to REPLACE blocks on android,
+ * deleting them and inserting first works.
+ */
+ if (sqlite3_bind_int64(m_database_read, 1, getBlockAsInteger(blockpos)) != SQLITE_OK) {
+ infostream << "WARNING: Could not bind block position for load: "
+ << sqlite3_errmsg(m_database)<<std::endl;
+ }
+
+ if (sqlite3_step(m_database_read) == SQLITE_ROW) {
+ if (sqlite3_bind_int64(m_database_delete, 1, getBlockAsInteger(blockpos)) != SQLITE_OK) {
+ infostream << "WARNING: Could not bind block position for delete: "
+ << sqlite3_errmsg(m_database)<<std::endl;
+ }
+
+ if (sqlite3_step(m_database_delete) != SQLITE_DONE) {
+ errorstream << "WARNING: saveBlock: Block failed to delete "
+ << PP(blockpos) << ": " << sqlite3_errmsg(m_database) << std::endl;
+ return false;
+ }
+ sqlite3_reset(m_database_delete);
+ }
+ sqlite3_reset(m_database_read);
+#endif
+