From 2cfe8af8f1f0c01a14d031cd82cddd42ff91e537 Mon Sep 17 00:00:00 2001 From: Erdao <66999583+TwinIsland@users.noreply.github.com> Date: Thu, 29 Dec 2022 22:29:01 -0600 Subject: [PATCH] Update Plugin.php sqlite version --- Plugin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Plugin.php b/Plugin.php index 41adb03..d37b2cd 100644 --- a/Plugin.php +++ b/Plugin.php @@ -34,7 +34,7 @@ public static function activate() // 创建表 $dbname =$db->getPrefix() . 'exsearch'; - $sql = "SHOW TABLES LIKE '%" . $dbname . "%'"; + $sql = "SELECT * FROM sqlite_master WHERE type='table' AND name='".$dbname."'"; if (count($db->fetchAll($sql)) == 0) { $sql = ' DROP TABLE IF EXISTS `'.$dbname.'`; @@ -43,7 +43,7 @@ public static function activate() `key` char(32) not null, `data` longtext, primary key (`id`) - ) default charset=utf8'; + )'; $sqls = explode(';', $sql); foreach ($sqls as $sql) { @@ -179,7 +179,7 @@ private static function clean() { $db = Typecho_Db::get(); $dbname = $db->getPrefix() . 'exsearch'; - $sql = "SHOW TABLES LIKE '%" . $dbname . "%'"; + $sql = "SELECT * FROM sqlite_master WHERE type='table' AND name='".$dbname."'"; if(count($db->fetchAll($sql)) != 0){ $db->query($db->delete('table.exsearch')->where('id >= ?', 0)); } @@ -331,4 +331,4 @@ public static function footer()