Differences From Artifact [a844357902]:

To Artifact [92c22689a2]:


1


2
3
4
5
6
7
8
<?php



function str_replace_first ($search, $replace, $subject)
{
    $pos = strpos($subject, $search);

    if ($pos !== false)
    {

>
>







1
2
3
4
5
6
7
8
9
10
<?php

namespace Garradin;

function str_replace_first ($search, $replace, $subject)
{
    $pos = strpos($subject, $search);

    if ($pos !== false)
    {
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

    public function __toString()
    {
        return $this->instruction;
    }
}

class Garradin_DB extends SQLite3
{
    static protected $_instance = null;

    protected $_running_sum = 0.0;

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

    private function __clone()
    {
    }

    public function __construct()







|







|







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

    public function __toString()
    {
        return $this->instruction;
    }
}

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

    protected $_running_sum = 0.0;

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

    private function __clone()
    {
    }

    public function __construct()
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
        if (!$exists)
        {
            $this->exec('BEGIN;');
            $this->exec(file_get_contents(GARRADIN_DB_SCHEMA));
            $this->exec('END;');
        }

        $this->createFunction('transliterate_to_ascii', array('utils', 'transliterateToAscii'));
        $this->createFunction('base64', 'base64_encode');
        $this->createFunction('rank', array($this, 'sql_rank'));
        $this->createFunction('running_sum', array($this, 'sql_running_sum'));
    }

    public function sql_running_sum($data)
    {







|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
        if (!$exists)
        {
            $this->exec('BEGIN;');
            $this->exec(file_get_contents(GARRADIN_DB_SCHEMA));
            $this->exec('END;');
        }

        $this->createFunction('transliterate_to_ascii', array('Garradin\utils', 'transliterateToAscii'));
        $this->createFunction('base64', 'base64_encode');
        $this->createFunction('rank', array($this, 'sql_rank'));
        $this->createFunction('running_sum', array($this, 'sql_running_sum'));
    }

    public function sql_running_sum($data)
    {