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    149           $this->exec('ROLLBACK;');
   150    150           $this->_transaction = 0;
   151    151           return true;
   152    152       }
   153    153   
   154    154       public function getArgType($arg, $name = '')
   155    155       {
   156         -        if (is_float($arg))
   157         -            return SQLITE3_FLOAT;
   158         -        elseif (is_int($arg))
   159         -            return SQLITE3_INTEGER;
   160         -        elseif (is_bool($arg))
   161         -            return SQLITE3_INTEGER;
   162         -        elseif (is_null($arg))
   163         -            return SQLITE3_NULL;
   164         -        elseif (is_string($arg))
   165         -            return SQLITE3_TEXT;
   166         -        else
   167         -            throw new \InvalidArgumentException('Argument '.$name.' is of invalid type '.gettype($arg));
          156  +        switch (gettype($arg))
          157  +        {
          158  +            case 'double':
          159  +                return SQLITE3_FLOAT;
          160  +            case 'integer':
          161  +            case 'boolean':
          162  +                return SQLITE3_INTEGER;
          163  +            case 'NULL':
          164  +                return SQLITE3_NULL;
          165  +            case 'string':
          166  +                return SQLITE3_TEXT;
          167  +            default:
          168  +                throw new \InvalidArgumentException('Argument '.$name.' is of invalid type '.gettype($arg));
          169  +        }
   168    170       }
   169    171   
   170    172       public function simpleStatement($query, $args = [])
   171    173       {
   172    174           $statement = $this->prepare($query);
   173    175           $nb = $statement->paramCount();
   174    176