Just to set the context:
---------------------------------------
Arturs Sosins: Like PDO.
Manuel Lemos: No, PDO, it emulates everything. Don't use PDO. For this purpose, PDO is not a good idea because it emulates the prepared statements. So it will do the same. It will paste the file contents in the query.
---------------------------------------
Please, read the manual before posting such affirmation:
As stated in php PDO_MYSQL driver documentation:
php.net/manual/en/ref.pdo-mysql.php
"PDO_MYSQL will take advantage of native prepared statement support present in MySQL 4.1 and higher. If you're using an older version of the mysql client libraries, PDO will emulate them for you."
So if the installed MySql library support it it will use it. Try a PDO::setAttribute(PDO::ATTR_EMULATE_PREPARES, false); and test it. Sure, would be nice if the driver didn't fallback if forced and triggered an error instead.
As for trying to store a 2g file in a DB, it's surely not a good idea but a LONGBLOB could do the trick. The only obstacle could be the memory limit of PHP and/or MySQL.