Skip to content

Commit 1225b0c

Browse files
committed
修正sqlite数据库在pdo下的bug
1 parent 9c5c404 commit 1225b0c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

var/Typecho/Db.php

+10
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,16 @@ public function getConfig()
167167
return $this->_config;
168168
}
169169

170+
/**
171+
* 重置连接池
172+
*
173+
* @return void
174+
*/
175+
public function flushPool()
176+
{
177+
$this->_connectedPool = array();
178+
}
179+
170180
/**
171181
* 选择数据库
172182
*

var/Upgrade.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ public static function v0_6r9_4_3($db, $options)
239239
$db->query('DROP TABLE ' . $prefix . 'users_' . $uuid, Typecho_Db::WRITE);
240240
$db->query('CREATE UNIQUE INDEX ' . $prefix . 'users_name ON ' . $prefix . 'users ("name")', Typecho_Db::WRITE);
241241
$db->query('CREATE UNIQUE INDEX ' . $prefix . 'users_mail ON ' . $prefix . 'users ("mail")', Typecho_Db::WRITE);
242+
$db->flushPool();
242243

243244
break;
244245

@@ -322,6 +323,7 @@ public static function v0_6r9_4_3($db, $options)
322323
$db->query('INSERT INTO ' . $prefix . 'metas SELECT * FROM ' . $prefix . 'metas' . $uuid, Typecho_Db::WRITE);
323324
$db->query('DROP TABLE ' . $prefix . 'metas' . $uuid, Typecho_Db::WRITE);
324325
$db->query('CREATE INDEX ' . $prefix . 'metas_slug ON ' . $prefix . 'metas ("slug")', Typecho_Db::WRITE);
326+
$db->flushPool();
325327

326328
break;
327329

@@ -773,6 +775,7 @@ public static function v0_7r9_10_20($db, $options)
773775
$db->query('DROP TABLE ' . $prefix . 'contents_tmp', Typecho_Db::WRITE);
774776
$db->query('CREATE UNIQUE INDEX ' . $prefix . 'contents_slug ON ' . $prefix . 'contents ("slug")', Typecho_Db::WRITE);
775777
$db->query('CREATE INDEX ' . $prefix . 'contents_created ON ' . $prefix . 'contents ("created")', Typecho_Db::WRITE);
778+
$db->flushPool();
776779

777780
break;
778781

@@ -1154,7 +1157,7 @@ public function v0_9r14_2_24($db, $options)
11541157
$db->query('INSERT INTO ' . $prefix . 'metas SELECT * FROM ' . $prefix . 'metas' . $uuid, Typecho_Db::WRITE);
11551158
$db->query('DROP TABLE ' . $prefix . 'metas' . $uuid, Typecho_Db::WRITE);
11561159
$db->query('CREATE INDEX ' . $prefix . 'metas_slug ON ' . $prefix . 'metas ("slug")', Typecho_Db::WRITE);
1157-
1160+
$db->flushPool();
11581161
break;
11591162

11601163
default:

0 commit comments

Comments
 (0)