Overview
Comment:Gestion un peu plus intelligente des transactions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a172283519af45c5c8d72e0c4a18b29855cb3f54
User & Date: bohwaz on 2014-04-15 05:12:16
Other Links: manifest | tags
Context
2014-04-15
05:12
Afficher les erreurs utilisateurs en mode texte check-in: 492a8b9e8b user: bohwaz tags: trunk
05:12
Gestion un peu plus intelligente des transactions check-in: a172283519 user: bohwaz tags: trunk
03:32
Les éléments sont dans squelettes/ maintenant check-in: 7c71886252 user: bohwaz tags: trunk
Changes

Modified src/include/class.db.php from [366f753ead] to [1638255074].

16
17
18
19
20
21
22


23
24
25
26
27
28
29
...
132
133
134
135
136
137
138


































139
140
141
142
143
144
145

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);
................................................................................
        return $this->escapeString($str);
    }

    public function e($str)
    {
        return $this->escapeString($str);
    }



































    protected function _getArgType($arg, $name = '')
    {
        if (is_float($arg))
            return SQLITE3_FLOAT;
        elseif (is_int($arg))
            return SQLITE3_INTEGER;







>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181

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

    protected $_running_sum = 0.0;

    protected $_transaction = 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);
................................................................................
        return $this->escapeString($str);
    }

    public function e($str)
    {
        return $this->escapeString($str);
    }

    public function begin()
    {
        if (!$this->_transaction)
        {
            $this->exec('BEGIN;');
        }

        $this->_transaction++;

        return $this->_transaction == 1 ? true : false;
    }

    public function commit()
    {
        if ($this->_transaction == 1)
        {
            $this->exec('END;');
        }

        if ($this->_transaction > 0)
        {
            $this->_transaction--;
        }

        return $this->_transaction ? false : true;
    }

    public function rollback()
    {
        $this->exec('ROLLBACK;');
        $this->_transaction = 0;
        return true;
    }

    protected function _getArgType($arg, $name = '')
    {
        if (is_float($arg))
            return SQLITE3_FLOAT;
        elseif (is_int($arg))
            return SQLITE3_INTEGER;