Overview
Comment:rendre publique ces méthodes bien utiles
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9e037ff8543fc30c3d3ac20dda5e5fa8e387a822
User & Date: bohwaz on 2014-03-21 03:44:44
Other Links: manifest | tags
Context
2014-03-21
03:45
Donner l'URL vers un plugin check-in: e57c4023d7 user: bohwaz tags: trunk
03:44
rendre publique ces méthodes bien utiles check-in: 9e037ff854 user: bohwaz tags: trunk
03:43
Mise en avant des numéros dans les listes check-in: 84fea36049 user: bohwaz tags: trunk
Changes

Modified src/include/class.db.php from [5025f71f76] to [aedffdc1cb].

16
17
18
19
20
21
22




23
24
25
26
27
28
29
...
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
...
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
...
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
...
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348

class DB extends \SQLite3
{
    static protected $_instance = null;

    protected $_running_sum = 0.0;





    static public function getInstance($create = false)
    {
        return self::$_instance ?: self::$_instance = new DB($create);
    }

    private function __clone()
    {
................................................................................
    {
        if ($mode != SQLITE3_BOTH && $mode != SQLITE3_ASSOC && $mode != SQLITE3_NUM)
        {
            throw new \InvalidArgumentException('Mode argument should be either SQLITE3_BOTH, SQLITE3_ASSOC or SQLITE3_NUM.');
        }

        $args = array_slice(func_get_args(), 2);
        return $this->_fetchResult($this->simpleStatement($query, $args), $mode);
    }

    public function simpleStatementFetchAssoc($query)
    {
        $args = array_slice(func_get_args(), 1);
        return $this->_fetchResultAssoc($this->simpleStatement($query, $args));
    }

    public function simpleStatementFetchAssocKey($query, $mode = SQLITE3_BOTH)
    {
        if ($mode != SQLITE3_BOTH && $mode != SQLITE3_ASSOC && $mode != SQLITE3_NUM)
        {
            throw new \InvalidArgumentException('Mode argument should be either SQLITE3_BOTH, SQLITE3_ASSOC or SQLITE3_NUM.');
        }

        $args = array_slice(func_get_args(), 2);
        return $this->_fetchResultAssocKey($this->simpleStatement($query, $args), $mode);
    }

    public function escapeAuto($value, $name = '')
    {
        $type = $this->_getArgType($value, $name);

        switch ($type)
................................................................................
        {
            return $row;
        }
    }

    public function queryFetch($query, $mode = SQLITE3_BOTH)
    {
        return $this->_fetchResult($this->query($query), $mode);
    }

    public function queryFetchAssoc($query)
    {
        return $this->_fetchResultAssoc($this->query($query));
    }

    public function queryFetchAssocKey($query, $mode = SQLITE3_BOTH)
    {
        return $this->_fetchResultAssocKey($this->query($query), $mode);
    }

    protected function _fetchResult($result, $mode)
    {
        $out = [];

        while ($row = $result->fetchArray($mode))
        {
            $out[] = $row;
        }
................................................................................

        $result->finalize();
        unset($result, $row);

        return $out;
    }

    protected function _fetchResultAssoc($result)
    {
        $out = [];

        while ($row = $result->fetchArray(SQLITE3_NUM))
        {
            $out[$row[0]] = $row[1];
        }
................................................................................

        $result->finalize();
        unset($result, $row);

        return $out;
    }

    protected function _fetchResultAssocKey($result, $mode)
    {
        $out = [];

        while ($row = $result->fetchArray($mode))
        {
            $key = current($row);
            $out[$key] = $row;







>
>
>
>







 







|





|










|







 







|




|




|


|







 







|







 







|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
...
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
...
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
...
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352

class DB extends \SQLite3
{
    static protected $_instance = null;

    protected $_running_sum = 0.0;

    const NUM = \SQLITE3_NUM;
    const ASSOC = \SQLITE3_ASSOC;
    const BOTH = \SQLITE3_BOTH;

    static public function getInstance($create = false)
    {
        return self::$_instance ?: self::$_instance = new DB($create);
    }

    private function __clone()
    {
................................................................................
    {
        if ($mode != SQLITE3_BOTH && $mode != SQLITE3_ASSOC && $mode != SQLITE3_NUM)
        {
            throw new \InvalidArgumentException('Mode argument should be either SQLITE3_BOTH, SQLITE3_ASSOC or SQLITE3_NUM.');
        }

        $args = array_slice(func_get_args(), 2);
        return $this->fetchResult($this->simpleStatement($query, $args), $mode);
    }

    public function simpleStatementFetchAssoc($query)
    {
        $args = array_slice(func_get_args(), 1);
        return $this->fetchResultAssoc($this->simpleStatement($query, $args));
    }

    public function simpleStatementFetchAssocKey($query, $mode = SQLITE3_BOTH)
    {
        if ($mode != SQLITE3_BOTH && $mode != SQLITE3_ASSOC && $mode != SQLITE3_NUM)
        {
            throw new \InvalidArgumentException('Mode argument should be either SQLITE3_BOTH, SQLITE3_ASSOC or SQLITE3_NUM.');
        }

        $args = array_slice(func_get_args(), 2);
        return $this->fetchResultAssocKey($this->simpleStatement($query, $args), $mode);
    }

    public function escapeAuto($value, $name = '')
    {
        $type = $this->_getArgType($value, $name);

        switch ($type)
................................................................................
        {
            return $row;
        }
    }

    public function queryFetch($query, $mode = SQLITE3_BOTH)
    {
        return $this->fetchResult($this->query($query), $mode);
    }

    public function queryFetchAssoc($query)
    {
        return $this->fetchResultAssoc($this->query($query));
    }

    public function queryFetchAssocKey($query, $mode = SQLITE3_BOTH)
    {
        return $this->fetchResultAssocKey($this->query($query), $mode);
    }

    public function fetchResult($result, $mode = \SQLITE3_BOTH)
    {
        $out = [];

        while ($row = $result->fetchArray($mode))
        {
            $out[] = $row;
        }
................................................................................

        $result->finalize();
        unset($result, $row);

        return $out;
    }

    protected function fetchResultAssoc($result)
    {
        $out = [];

        while ($row = $result->fetchArray(SQLITE3_NUM))
        {
            $out[$row[0]] = $row[1];
        }
................................................................................

        $result->finalize();
        unset($result, $row);

        return $out;
    }

    protected function fetchResultAssocKey($result, $mode = \SQLITE3_BOTH)
    {
        $out = [];

        while ($row = $result->fetchArray($mode))
        {
            $key = current($row);
            $out[$key] = $row;