pluf2

pluf2 Commit Details


Date:2008-11-16 08:27:40 (16 years 1 month ago)
Author:Loic d'Anterroches
Branch:master
Commit:0bae4c544eb41f106bc58f6639dce6ac20d25b12
Parents: 4e70f0782d4c86a191bd69e05021c8febdcf813f
Message:Fixed issue 53, compressed field invalid byte sequence for encoding "UTF8" error.

Added from/to db functions to correctly (un)escape the binary in the
correct way for PostgreSQL.
Changes:

File differences

src/Pluf/DB/PostgreSQL.php
3939
4040
4141
42
4243
4344
4445
......
211212
212213
213214
214
215
216
215217
216218
217219
218220
219221
220222
223
224
225
226
227
228
229
230
231
232
233
234
235
Pluf::loadFunction('Pluf_DB_defaultTypecast');
$this->type_cast = Pluf_DB_defaultTypecast();
$this->type_cast['Pluf_DB_Field_Boolean'] = array('Pluf_DB_PostgreSQL_BooleanFromDb', 'Pluf_DB_BooleanToDb');
$this->type_cast['Pluf_DB_Field_Compressed'] = array('Pluf_DB_PostgreSQL_CompressedFromDb', 'Pluf_DB_PostgreSQL_CompressedToDb');
$this->debug('* POSTGRESQL CONNECT');
$cstring = '';
}
}
function Pluf_DB_PostgreSQL_BooleanFromDb($val) {
function Pluf_DB_PostgreSQL_BooleanFromDb($val)
{
if (!$val) {
return false;
}
return (strtolower(substr($val, 0, 1)) == 't');
}
function Pluf_DB_PostgreSQL_CompressedToDb($val, $con)
{
if (is_null($val)) {
return 'NULL';
}
return "'".pg_escape_bytea($val)."'";
}
function Pluf_DB_PostgreSQL_CompressedFromDb($val)
{
return pg_unescape_bytea($val);
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05778s using 14 queries.