@@ 96-122 (lines=27) @@ | ||
93 | * @param int $ttl |
|
94 | * @return IteratorInterface |
|
95 | */ |
|
96 | protected function getIterator($sql, $param = null, $ttl = null) |
|
97 | { |
|
98 | $debug = $this->getDebug(); |
|
99 | $start = 0; |
|
100 | if ($debug) { |
|
101 | $log = LogHandler::getInstance(); |
|
102 | $log->debug("Class name: " . get_class($this)); |
|
103 | $log->debug("SQL: " . $sql); |
|
104 | if (!is_null($param)) { |
|
105 | $s = ""; |
|
106 | foreach ($param as $key => $value) { |
|
107 | if ($s != "") { |
|
108 | $s .= ", "; |
|
109 | } |
|
110 | $s .= "[$key]=$value"; |
|
111 | } |
|
112 | $log->debug("Params: $s"); |
|
113 | } |
|
114 | $start = microtime(true); |
|
115 | } |
|
116 | $it = $this->getDBDataset()->getIterator($sql, $param, $ttl); |
|
117 | if ($debug) { |
|
118 | $end = microtime(true); |
|
119 | $log->debug("Execution Time: " . ($end - $start) . " segundos "); |
|
120 | } |
|
121 | return $it; |
|
122 | } |
|
123 | ||
124 | protected function getScalar($sql, $param = null) |
|
125 | { |
|
@@ 124-150 (lines=27) @@ | ||
121 | return $it; |
|
122 | } |
|
123 | ||
124 | protected function getScalar($sql, $param = null) |
|
125 | { |
|
126 | $debug = $this->getDebug(); |
|
127 | $start = 0; |
|
128 | if ($debug) { |
|
129 | $log = LogHandler::getInstance(); |
|
130 | $log->debug("Class name: " . get_class($this)); |
|
131 | $log->debug("SQL: " . $sql); |
|
132 | if (!is_null($param)) { |
|
133 | $s = ""; |
|
134 | foreach ($param as $key => $value) { |
|
135 | if ($s != "") { |
|
136 | $s .= ", "; |
|
137 | } |
|
138 | $s .= "[$key]=$value"; |
|
139 | } |
|
140 | $log->debug("Params: $s"); |
|
141 | } |
|
142 | $start = microtime(true); |
|
143 | } |
|
144 | $scalar = $this->getDBDataset()->getScalar($sql, $param); |
|
145 | if ($debug) { |
|
146 | $end = microtime(true); |
|
147 | $log->debug("Execution Time: " . ($end - $start) . " segundos "); |
|
148 | } |
|
149 | return $scalar; |
|
150 | } |
|
151 | ||
152 | /** |
|
153 | * Get a SQLHelper object |