forked from Wavyzz/dolibarr
More complete test for escape pgsql
This commit is contained in:
@@ -171,11 +171,17 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase
|
|||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
if ($db->type == 'mysqli') {
|
if ($db->type == 'mysqli') {
|
||||||
$a = 'abc"\'def';
|
$a = 'abc"\'def'; // string is abc"'def
|
||||||
print $a;
|
print $a;
|
||||||
$result = $db->escape($a); // $result must be abc\"\'def with mysql
|
$result = $db->escape($a); // $result must be abc\"\'def
|
||||||
$this->assertEquals('abc\"\\\'def', $result);
|
$this->assertEquals('abc\"\\\'def', $result);
|
||||||
}
|
}
|
||||||
|
if ($db->type == 'pgsql') {
|
||||||
|
$a = 'abc"\'def'; // string is abc"'def
|
||||||
|
print $a;
|
||||||
|
$result = $db->escape($a); // $result must be abc"''def
|
||||||
|
$this->assertEquals('abc"\'\'def', $result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user