Overview
Comment:Optimisation : un seul appel pour savoir le type
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: acafe5646049b56881e5bc9d0fe73dae6f2d3566
User & Date: bohwaz on 2015-01-18 07:03:44
Other Links: manifest | tags
Context
2015-01-18
07:10
Correction pour sous-pages avec {parent} check-in: 88c2588e64 user: bohwaz tags: trunk
07:03
Optimisation : un seul appel pour savoir le type check-in: acafe56460 user: bohwaz tags: trunk
05:16
Forcer le type de bindValue, sinon bindValue(1, 0) ne fonctionne pas correctement (WTF) check-in: bb7d06009b user: bohwaz tags: trunk
Changes

Modified src/include/lib/Garradin/DB.php from [0be01e7f47] to [7406e12909].

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
        $this->exec('ROLLBACK;');
        $this->_transaction = 0;
        return true;
    }

    public function getArgType($arg, $name = '')
    {
        if (is_float($arg))


            return SQLITE3_FLOAT;
        elseif (is_int($arg))
            return SQLITE3_INTEGER;
        elseif (is_bool($arg))

            return SQLITE3_INTEGER;
        elseif (is_null($arg))

            return SQLITE3_NULL;
        elseif (is_string($arg))

            return SQLITE3_TEXT;
        else

            throw new \InvalidArgumentException('Argument '.$name.' is of invalid type '.gettype($arg));

    }

    public function simpleStatement($query, $args = [])
    {
        $statement = $this->prepare($query);
        $nb = $statement->paramCount();








|
>
>
|
<
<
|
>
|
<
>
|
<
>
|
<
>
|
>







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
        $this->exec('ROLLBACK;');
        $this->_transaction = 0;
        return true;
    }

    public function getArgType($arg, $name = '')
    {
        switch (gettype($arg))
        {
            case 'double':
                return SQLITE3_FLOAT;


            case 'integer':
            case 'boolean':
                return SQLITE3_INTEGER;

            case 'NULL':
                return SQLITE3_NULL;

            case 'string':
                return SQLITE3_TEXT;

            default:
                throw new \InvalidArgumentException('Argument '.$name.' is of invalid type '.gettype($arg));
        }
    }

    public function simpleStatement($query, $args = [])
    {
        $statement = $this->prepare($query);
        $nb = $statement->paramCount();