mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
using prepared statements for PlayerAPI::get
This commit is contained in:
parent
948340b399
commit
c95a8d5cff
2 changed files with 13 additions and 2 deletions
|
|
@ -157,6 +157,8 @@ class PocketMinecraftServer{
|
|||
public function startDatabase(){
|
||||
$this->preparedSQL = new stdClass();
|
||||
$this->preparedSQL->entity = new stdClass();
|
||||
$this->preparedSQL->player = new stdClass();
|
||||
|
||||
$this->database = new SQLite3(":memory:");
|
||||
$this->query("PRAGMA journal_mode = OFF;");
|
||||
$this->query("PRAGMA encoding = \"UTF-8\";");
|
||||
|
|
@ -173,6 +175,10 @@ class PocketMinecraftServer{
|
|||
$this->preparedSQL->updateAction = $this->database->prepare("UPDATE actions SET last = :time WHERE ID = :id;");
|
||||
$this->preparedSQL->entity->setPosition = $this->database->prepare("UPDATE entities SET x = :x, y = :y, z = :z, pitch = :pitch, yaw = :yaw WHERE EID = :eid ;");
|
||||
$this->preparedSQL->entity->setLevel = $this->database->prepare("UPDATE entities SET level = :level WHERE EID = :eid ;");
|
||||
|
||||
$this->preparedSQL->player->getEq = $this->database->prepare("SELECT ip,port,name FROM players WHERE name = :name;"); //'$name'
|
||||
$this->preparedSQL->player->getLike = $this->database->prepare("SELECT ip,port,name FROM players WHERE name LIKE :name;"); //'$name'
|
||||
|
||||
}
|
||||
|
||||
public function query($sql, $fetch = false){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue