当前位置: 首页>>代码示例>>PHP>>正文


PHP dbconnection::query方法代码示例

本文整理汇总了PHP中dbconnection::query方法的典型用法代码示例。如果您正苦于以下问题:PHP dbconnection::query方法的具体用法?PHP dbconnection::query怎么用?PHP dbconnection::query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dbconnection的用法示例。


在下文中一共展示了dbconnection::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteScene

 public static function deleteScene($pack)
 {
     $pack->auth->game_id = dbconnection::queryObject("SELECT * FROM scenes WHERE scene_id = '{$pack->scene_id}'")->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM scenes WHERE scene_id = '{$pack->scene_id}' LIMIT 1");
     //cleanup
     $s = dbconnection::queryObject("SELECT * FROM scenes WHERE game_id = '{$pack->game_id}' LIMIT 1");
     $s_id = $s ? $s->scene_id : 0;
     dbconnection::query("UPDATE games SET intro_scene_id = '{$s_id}' WHERE intro_scene_id = '{$pack->scene_id}'");
     $triggers = dbconnection::queryArray("SELECT * FROM triggers WHERE scene_id  = '{$pack->scene_id}'");
     for ($i = 0; $i < count($triggers); $i++) {
         $pack->trigger_id = $triggers[$i]->trigger_id;
         triggers::deleteTrigger($pack);
     }
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'SCENE' AND object_id = '{$pack->scene_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::deleteInstance($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:25,代码来源:scenes.php

示例2: __call

 /**
  * [__call description]
  * @param  [string] $name [virtual function name]
  * @param  [array] $args [arguments of virtual function]
  * @return [type]       [description]
  */
 public function __call($name, $args)
 {
     $syntax = str_replace("String", '', $name) . "Caller";
     if (method_exists($this, $syntax)) {
         $string = $this->{$syntax}($args);
     }
     if (preg_match("/^(insert|delete|update|select)(String)?\$/", $name)) {
         if (class_exists('\\cls\\sql') && method_exists('\\cls\\sql', "call")) {
             sql_cls::call($this->maker, $name);
         }
         $this->groupby($string);
         $this->order($string);
         $string .= count($this->maker->limit) > 0 ? " LIMIT " . join($this->maker->limit, ', ') : '';
         // echo "\n<pre>\n";
         // echo($string)."\n\n";
         // echo "\n</pre>\n";
         if (preg_match("/String\$/", $name)) {
             return $string;
         } else {
             $connection = new dbconnection();
             $result = $connection->query($string);
             return $result;
         }
     } else {
         return $string;
     }
 }
开发者ID:evazzadeh,项目名称:Saloos,代码行数:33,代码来源:sql.php

示例3: deleteItem

 public static function deleteItem($pack)
 {
     $item = dbconnection::queryObject("SELECT * FROM items WHERE item_id = '{$pack->item_id}'");
     $pack->auth->game_id = $item->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM items WHERE item_id = '{$pack->item_id}' LIMIT 1");
     //cleanup
     $options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE link_type = 'EXIT_TO_ITEM' AND link_id = '{$pack->item_id}'");
     for ($i = 0; $i < count($options); $i++) {
         $pack->dialog_option_id = $options[$i]->dialog_option_id;
         dialogs::deleteDialogOption($pack);
     }
     $tabs = dbconnection::queryArray("SELECT * FROM tabs WHERE type = 'ITEM' AND content_id = '{$pack->item_id}'");
     for ($i = 0; $i < count($tabs); $i++) {
         $pack->tab_id = $tabs[$i]->tab_id;
         tabs::deleteTab($pack);
     }
     $tags = dbconnection::queryArray("SELECT * FROM object_tags WHERE object_type = 'ITEM' AND object_id = '{$pack->item_id}'");
     for ($i = 0; $i < count($tags); $i++) {
         $pack->object_tag_id = $tags[$i]->object_tag_id;
         tags::deleteObjectTag($pack);
     }
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'ITEM' AND object_id = '{$pack->item_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::deleteInstance($pack);
     }
     $factories = dbconnection::queryArray("SELECT * FROM factories WHERE object_type = 'ITEM' AND object_id = '{$pack->item_id}'");
     for ($i = 0; $i < count($factories); $i++) {
         $pack->factory_id = $factories[$i]->factory_id;
         factories::deleteFactory($pack);
     }
     $events = dbconnection::queryArray("SELECT * FROM events WHERE (event = 'GIVE_ITEM_PLAYER' OR event = 'TAKE_ITEM_PLAYER' OR event = 'GIVE_ITEM_GAME' OR event = 'TAKE_ITEM_GAME') AND content_id = '{$pack->item_id}'");
     for ($i = 0; $i < count($events); $i++) {
         $pack->event_id = $events[$i]->event_id;
         events::deleteEvent($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_VIEWED_ITEM' AND content_id = '{$pack->item_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_HAS_ITEM' AND content_id = '{$pack->item_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'GAME_HAS_ITEM' AND content_id = '{$pack->item_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:58,代码来源:items.php

示例4: removeEditorFromGame

 public static function removeEditorFromGame($pack)
 {
     $pack->auth->game_id = $pack->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     //note $pack->user_id is DIFFERENT than $pack->auth->user_id
     dbconnection::query("DELETE FROM user_games WHERE user_id = '{$pack->user_id}' AND game_id = '{$pack->game_id}'");
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:12,代码来源:editors.php

示例5: deletePlaque

 public static function deletePlaque($pack)
 {
     $plaque = dbconnection::queryObject("SELECT * FROM plaques WHERE plaque_id = '{$pack->plaque_id}'");
     $pack->auth->game_id = $plaque->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM plaques WHERE plaque_id = '{$pack->plaque_id}' LIMIT 1");
     //cleanup
     /* Comment out until we've decided on desired behavior...
        $eventpack = dbconnection::queryObject("SELECT * FROM event_packages WHERE event_package_id = '{$plaque->event_package_id}'");
        if($eventpack)
        {
            $pack->event_package_id = $eventpack->event_package_id;
            events::deleteEventPackage($pack);
        }
        */
     $options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE link_type = 'EXIT_TO_PLAQUE' AND link_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($options); $i++) {
         $pack->dialog_option_id = $options[$i]->dialog_option_id;
         dialogs::deleteDialogOption($pack);
     }
     $tabs = dbconnection::queryArray("SELECT * FROM tabs WHERE type = 'PLAQUE' AND content_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($tabs); $i++) {
         $pack->tab_id = $tabs[$i]->tab_id;
         tabs::deleteTab($pack);
     }
     $tags = dbconnection::queryArray("SELECT * FROM object_tags WHERE object_type = 'PLAQUE' AND object_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($tags); $i++) {
         $pack->object_tag_id = $tags[$i]->object_tag_id;
         tags::deleteObjectTag($pack);
     }
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'PLAQUE' AND object_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::deleteInstance($pack);
     }
     $factories = dbconnection::queryArray("SELECT * FROM factories WHERE object_type = 'PLAQUE' AND object_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($factories); $i++) {
         $pack->factory_id = $factories[$i]->factory_id;
         factories::deleteFactory($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_VIEWED_PLAQUE' AND content_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:51,代码来源:plaques.php

示例6: deleteGroup

 public static function deleteGroup($pack)
 {
     $group = dbconnection::queryObject("SELECT * FROM groups WHERE group_id = '{$pack->group_id}'");
     $pack->auth->game_id = $group->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM groups WHERE group_id = '{$pack->group_id}' LIMIT 1");
     //cleanup
     dbconnection::query("UPDATE game_user_groups SET group_id = 0 WHERE game_id = '{$group->game_id}' AND group_id = '{$group->group_id}';");
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:14,代码来源:groups.php

示例7: applyUpgrade

 private static function applyUpgrade($user_id, $maj, $min)
 {
     $file = "db/upgrades/" . $maj . "." . $min . ".sql";
     $upgrade = fopen($file, "r");
     while (!feof($upgrade)) {
         $query = fgets($upgrade);
         if (preg_match("@^\\s*\$@is", $query)) {
             continue;
         }
         //ignore whitespace
         dbconnection::query($query);
     }
     fclose($upgrade);
     dbconnection::queryInsert("INSERT INTO db_upgrades (user_id, version_major, version_minor, timestamp) VALUES ('{$user_id}', '{$maj}', '{$min}', CURRENT_TIMESTAMP)");
 }
开发者ID:kimblemj,项目名称:server,代码行数:15,代码来源:db.php

示例8: deleteOverlay

 public static function deleteOverlay($pack)
 {
     $overlay = dbconnection::queryObject("SELECT * FROM overlays WHERE overlay_id = '{$pack->overlay_id}'");
     $pack->auth->game_id = $overlay->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM overlays WHERE overlay_id = '{$pack->overlay_id}' LIMIT 1");
     //cleanup
     $reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$overlay->requirement_root_package_id}'");
     if ($reqPack) {
         $pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
         requirements::deleteRequirementPackage($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:18,代码来源:overlays.php

示例9: deleteWebHook

 public static function deleteWebHook($pack)
 {
     $webhook = dbconnection::queryObject("SELECT * FROM web_hooks WHERE web_hook_id = '{$pack->web_hook_id}'");
     $pack->auth->game_id = $webhook->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM web_hooks WHERE web_hook_id = '{$pack->web_hook_id}' LIMIT 1");
     //cleanup
     $reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$webhook->requirement_root_package_id}'");
     if ($reqPack) {
         $pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
         requirements::deleteRequirementPackage($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_HAS_RECEIVED_INCOMING_WEB_HOOK' AND content_id = '{$pack->web_hook_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:23,代码来源:web_hooks.php

示例10: deleteTab

 public static function deleteTab($pack)
 {
     $tab = dbconnection::queryObject("SELECT * FROM tabs WHERE tab_id = '{$pack->tab_id}'");
     $pack->auth->game_id = $tab->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM tabs WHERE tab_id = '{$pack->tab_id}' LIMIT 1");
     //cleanup
     $options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE link_type = 'EXIT_TO_TAB' AND link_id = '{$pack->tab_id}'");
     for ($i = 0; $i < count($options); $i++) {
         $pack->dialog_option_id = $options[$i]->dialog_option_id;
         dialogs::deleteDialogOption($pack);
     }
     $reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$tab->requirement_root_package_id}'");
     if ($reqPack) {
         $pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
         requirements::deleteRequirementPackage($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:23,代码来源:tabs.php

示例11: deleteNoteComment

 public static function deleteNoteComment($pack)
 {
     $note_comment = dbconnection::queryObject("SELECT * FROM note_comments WHERE note_comment_id = '{$pack->note_comment_id}'");
     $note = dbconnection::queryObject("SELECT * FROM notes WHERE note_id = '{$note_comment->note_id}'");
     $pack->auth->game_id = $note_comment->game_id;
     $pack->auth->permission = "read_write";
     //tl;dr: must be game owner, note owner, or comment owner to delete comment
     if (!(users::authenticateUser($pack->auth) && ($pack->auth->user_id == $note_comment->user_id || $pack->auth->user_id == $note->user_id)) && !editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM note_comments WHERE note_comment_id = '{$pack->note_comment_id}' LIMIT 1");
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:14,代码来源:note_comments.php

示例12: deleteMedia

 public static function deleteMedia($pack)
 {
     $media_sql = dbconnection::queryObject("SELECT * FROM media WHERE media_id = '{$pack->media_id}'");
     $pack->auth->game_id = $media_sql->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     if (!unlink(Config::v2_gamedata_folder . "/" . $media_sql->file_folder . "/" . $media_sql->file_name)) {
         return new return_package(1, "Could not delete file.");
     }
     dbconnection::query("DELETE FROM media WHERE media_id = '{$pack->media_id}' LIMIT 1");
     //cleanup
     dbconnection::query("UPDATE games SET media_id = 0 WHERE media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE games SET icon_media_id = 0 WHERE icon_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE tabs SET icon_media_id = 0 WHERE icon_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE items SET media_id = 0 WHERE media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE items SET icon_media_id = 0 WHERE icon_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE dialogs SET icon_media_id = 0 WHERE icon_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE dialog_characters SET media_id = 0 WHERE media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE plaques SET media_id = 0 WHERE media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE plaques SET icon_media_id = 0 WHERE icon_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE web_pages SET icon_media_id = 0 WHERE icon_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE tags SET media_id = 0 WHERE media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE overlays SET media_id = 0 WHERE media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE note_media SET media_id = 0 WHERE media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE quests SET active_media_id = 0 WHERE active_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE quests SET active_icon_media_id = 0 WHERE active_icon_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE quests SET complete_media_id = 0 WHERE complete_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE quests SET complete_icon_media_id = 0 WHERE complete_icon_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE triggers SET icon_media_id = 0 WHERE icon_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE factories SET trigger_icon_media_id = 0 WHERE trigger_icon_media_id = '{$pack->media_id}'");
     dbconnection::query("UPDATE users SET media_id = 0 WHERE media_id = '{$pack->media_id}'");
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:36,代码来源:media.php

示例13: cleanOrphans

 public static function cleanOrphans($pack)
 {
     $tables = array();
     $tables[] = "dialog_characters";
     $tables[] = "dialog_options";
     $tables[] = "dialog_scripts";
     $tables[] = "dialogs";
     $tables[] = "event_packages";
     $tables[] = "events";
     $tables[] = "factories";
     $tables[] = "game_comments";
     $tables[] = "instances";
     $tables[] = "items";
     $tables[] = "media";
     $tables[] = "note_comments";
     $tables[] = "note_likes";
     $tables[] = "notes";
     $tables[] = "object_tags";
     $tables[] = "overlays";
     $tables[] = "plaques";
     $tables[] = "quests";
     $tables[] = "requirement_and_packages";
     $tables[] = "requirement_atoms";
     $tables[] = "requirement_root_packages";
     $tables[] = "scenes";
     $tables[] = "tabs";
     $tables[] = "tags";
     $tables[] = "triggers";
     $tables[] = "user_game_scenes";
     $tables[] = "user_games";
     $tables[] = "web_hooks";
     $tables[] = "web_pages";
     for ($i = 0; $i < count($tables); $i++) {
         $arr = dbconnection::queryArray("SELECT {$tables[$i]}.game_id as game_id, games.game_id as n_game_id FROM {$tables[$i]} LEFT JOIN games ON {$tables[$i]}.game_id = games.game_id WHERE games.game_id IS NULL GROUP BY game_id;");
         for ($j = 0; $j < count($arr); $j++) {
             if ($tables[$i] == "media" && $arr[$j]->game_id == 0) {
                 continue;
             }
             //allow default media
             if ($pack->execute) {
                 dbconnection::query("DELETE FROM {$tables[$i]} WHERE game_id = '{$arr[$j]->game_id}';");
             } else {
                 //dry run
                 echo "DELETE FROM {$tables[$i]} WHERE game_id = '{$arr[$j]->game_id}'; (game_id = '{$arr[$j]->game_id}')\n";
             }
         }
     }
     //instances
     $types = array();
     $tables = array();
     $ids = array();
     $types[] = "PLAQUE";
     $tables[] = "plaques";
     $ids[] = "plaque_id";
     $types[] = "ITEM";
     $tables[] = "items";
     $ids[] = "item_id";
     $types[] = "DIALOG";
     $tables[] = "dialogs";
     $ids[] = "dialog_id";
     $types[] = "WEB_PAGE";
     $tables[] = "web_pages";
     $ids[] = "web_page_id";
     $types[] = "NOTE";
     $tables[] = "notes";
     $ids[] = "note_id";
     $types[] = "FACTORY";
     $tables[] = "factories";
     $ids[] = "factory_id";
     for ($i = 0; $i < count($types); $i++) {
         $arr = dbconnection::queryArray("SELECT instances.* FROM instances LEFT JOIN {$tables[$i]} ON instances.object_id = {$tables[$i]}.{$ids[$i]} WHERE instances.object_type = '{$types[$i]}' AND {$tables[$i]}.{$ids[$i]} IS NULL;");
         for ($j = 0; $j < count($arr); $j++) {
             if ($pack->execute) {
                 dbconnection::query("DELETE FROM instances WHERE instance_id = '{$arr[$j]->instance_id}';");
             } else {
                 //dry run
                 echo "DELETE FROM instances WHERE instance_id = '{$arr[$j]->instance_id}'; (game_id = '{$arr[$j]->game_id}')\n";
             }
         }
     }
     //triggers
     $arr = dbconnection::queryArray("SELECT triggers.* FROM triggers LEFT JOIN instances ON triggers.instance_id = instances.instance_id WHERE instances.instance_id IS NULL;");
     for ($j = 0; $j < count($arr); $j++) {
         if ($pack->execute) {
             dbconnection::query("DELETE FROM triggers WHERE trigger_id = '{$arr[$j]->trigger_id}';");
         } else {
             //dry run
             echo "DELETE FROM triggers WHERE trigger_id = '{$arr[$j]->trigger_id}'; (game_id = '{$arr[$j]->game_id}')\n";
         }
     }
     //requirements
     // \/ query to manually see requirement tree in SQL. nice for debugging.
     //SELECT ratom.requirement_atom_id, rand.requirement_and_package_id, rroot.requirement_root_package_id FROM requirement_atoms as ratom LEFT JOIN requirement_and_packages as rand ON ratom.requirement_and_package_id = rand.requirement_and_package_id LEFT JOIN requirement_root_packages as rroot ON rand.requirement_root_package_id = rroot.requirement_root_package_id WHERE rand.game_id = 3259;
     $arr = dbconnection::queryArray("SELECT requirement_and_packages.* FROM requirement_and_packages LEFT JOIN requirement_root_packages ON requirement_and_packages.requirement_root_package_id = requirement_root_packages.requirement_root_package_id WHERE requirement_root_packages.requirement_root_package_id IS NULL;");
     for ($j = 0; $j < count($arr); $j++) {
         if ($pack->execute) {
             dbconnection::query("DELETE FROM requirement_and_packages WHERE requirement_and_package_id = '{$arr[$j]->requirement_and_package_id}';");
         } else {
             //dry run
             echo "DELETE FROM requirement_and_packages WHERE requirement_and_package_id = '{$arr[$j]->requirement_and_package_id}'; (game_id = '{$arr[$j]->game_id}')\n";
//.........这里部分代码省略.........
开发者ID:kimblemj,项目名称:server,代码行数:101,代码来源:games.php

示例14: deleteFactory

 public static function deleteFactory($pack)
 {
     $factory = dbconnection::queryObject("SELECT * FROM factories WHERE factory_id = '{$pack->factory_id}'");
     $pack->auth->game_id = $factory->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM factories WHERE factory_id = '{$pack->factory_id}' LIMIT 1");
     //cleanup
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE factory_id = '{$pack->factory_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::deleteInstance($pack);
     }
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'FACTORY' AND object_id = '{$pack->factory_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::deleteInstance($pack);
     }
     $reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$factory->requirement_root_package_id}'");
     if ($reqPack) {
         $pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
         requirements::deleteRequirementPackage($pack);
     }
     $reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$factory->trigger_requirement_root_package_id}'");
     if ($reqPack) {
         $pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
         requirements::deleteRequirementPackage($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:33,代码来源:factories.php

示例15: unlikeNote

 public static function unlikeNote($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM note_likes" . " WHERE game_id = '" . intval($pack->game_id) . "'" . " AND note_id = '" . intval($pack->note_id) . "'" . " AND user_id = '" . intval($pack->auth->user_id) . "'" . " LIMIT 1");
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:9,代码来源:notes.php


注:本文中的dbconnection::query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。