Update indexes for the prepared statement
This commit is contained in:
parent
4fefc79f5f
commit
e0545ce9af
3 changed files with 15 additions and 15 deletions
|
@ -53,7 +53,7 @@ mod_name=Zontreck's Library Mod
|
|||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=GPLv3
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1201.13.042424.0045
|
||||
mod_version=1201.13.042424.0126
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
|
|
@ -83,15 +83,15 @@ public abstract class BlockRestoreQueue
|
|||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
pstmt = DatabaseWrapper.get().prepareStatement("INSERT INTO `blocks` (queueName, posX, posY, posZ, snapshotID, block) VALUES (?, ?, ?, ?, ?, ?);");
|
||||
pstmt.setString(0, getRestoreQueueName());
|
||||
pstmt.setInt(1, block.position.getX());
|
||||
pstmt.setInt(2, block.position.getY());
|
||||
pstmt.setInt(3, block.position.getZ());
|
||||
pstmt.setInt(4, 0);
|
||||
pstmt.setString(1, getRestoreQueueName());
|
||||
pstmt.setInt(2, block.position.getX());
|
||||
pstmt.setInt(3, block.position.getY());
|
||||
pstmt.setInt(4, block.position.getZ());
|
||||
pstmt.setInt(5, 0);
|
||||
ByteArrayOutputStream blockState = new ByteArrayOutputStream();
|
||||
DataOutputStream dos0 = new DataOutputStream(blockState);
|
||||
NbtIo.write(block.serialize(), dos0);
|
||||
pstmt.setBytes(5, blockState.toByteArray());
|
||||
pstmt.setBytes(6, blockState.toByteArray());
|
||||
|
||||
|
||||
DatabaseWrapper.get().executePreparedStatement(pstmt);
|
||||
|
@ -124,7 +124,7 @@ public abstract class BlockRestoreQueue
|
|||
} else
|
||||
sel = DatabaseWrapper.get().prepareStatement("SELECT * FROM `blocks` WHERE queueName=? LIMIT 1;");
|
||||
|
||||
sel.setString(0, getRestoreQueueName());
|
||||
sel.setString(1, getRestoreQueueName());
|
||||
ResultSet res = DatabaseWrapper.get().executePreparedStatementQuery(sel);
|
||||
// Now retrieve the block from the database
|
||||
if (res.next()) {
|
||||
|
@ -141,10 +141,10 @@ public abstract class BlockRestoreQueue
|
|||
}
|
||||
} catch (SQLException e001) {
|
||||
PreparedStatement pstat = DatabaseWrapper.get().prepareStatement("DELETE FROM `blocks` WHERE queueName=? AND posX=? AND posY=? AND posZ=?;");
|
||||
pstat.setString(0, getRestoreQueueName());
|
||||
pstat.setInt(1, block.position.getX());
|
||||
pstat.setInt(2, block.position.getY());
|
||||
pstat.setInt(3, block.position.getZ());
|
||||
pstat.setString(1, getRestoreQueueName());
|
||||
pstat.setInt(2, block.position.getX());
|
||||
pstat.setInt(3, block.position.getY());
|
||||
pstat.setInt(4, block.position.getZ());
|
||||
DatabaseWrapper.get().executePreparedStatement(pstat);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ public class DatabaseMigrations
|
|||
try {
|
||||
|
||||
PreparedStatement pstat = DatabaseWrapper.get().prepareStatement("REPLACE INTO `migrations` (tableID, version) VALUES (?,?);");
|
||||
pstat.setString(0, tableID);
|
||||
pstat.setInt(1, version);
|
||||
pstat.setString(1, tableID);
|
||||
pstat.setInt(2, version);
|
||||
|
||||
pstat.execute();
|
||||
} catch (SQLException ex)
|
||||
|
@ -162,7 +162,7 @@ public class DatabaseMigrations
|
|||
{
|
||||
try{
|
||||
PreparedStatement pst = DatabaseWrapper.get().prepareStatement("SELECT * FROM `migrations` WHERE tableID=?;");
|
||||
pst.setString(0, tableID);
|
||||
pst.setString(1, tableID);
|
||||
|
||||
var result = pst.executeQuery();
|
||||
if(!result.next())
|
||||
|
|
Reference in a new issue