summaryrefslogtreecommitdiff
path: root/app/Note.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2015-05-11 22:23:21 +0100
committerGreg Roach <fisharebest@gmail.com>2015-05-11 22:23:21 +0100
commit64d9078a3a1fe7f0c5c5c13973b3b90b6329590e (patch)
treebca630cb543f9074a894dec3907da689c830dd62 /app/Note.php
parent7fbd64661ef00d66914301f07eeec846dc7fcf36 (diff)
downloadwebtrees-64d9078a3a1fe7f0c5c5c13973b3b90b6329590e.tar.gz
webtrees-64d9078a3a1fe7f0c5c5c13973b3b90b6329590e.tar.bz2
webtrees-64d9078a3a1fe7f0c5c5c13973b3b90b6329590e.zip
Performance - automatically re-use all prepared statements
Diffstat (limited to 'app/Note.php')
-rw-r--r--app/Note.php15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/Note.php b/app/Note.php
index 5f4bdb1c89..73833912e1 100644
--- a/app/Note.php
+++ b/app/Note.php
@@ -82,14 +82,13 @@ class Note extends GedcomRecord {
}
/** {@inheritdoc} */
- protected static function fetchGedcomRecord($xref, $gedcom_id) {
- static $statement = null;
-
- if ($statement === null) {
- $statement = Database::prepare("SELECT o_gedcom FROM `##other` WHERE o_id=? AND o_file=? AND o_type='NOTE'");
- }
-
- return $statement->execute(array($xref, $gedcom_id))->fetchOne();
+ protected static function fetchGedcomRecord($xref, $tree_id) {
+ return Database::prepare(
+ "SELECT o_gedcom FROM `##other` WHERE o_id = :xref AND o_file = :tree_id AND o_type = 'NOTE'"
+ )->execute(array(
+ 'xref' => $xref,
+ 'tree_id' => $tree_id
+ ))->fetchOne();
}
/**