Fix: missing tinyint

This commit is contained in:
Regis Houssin
2012-11-11 15:10:01 +01:00
parent 7d5c4a3b38
commit 2240dd4ac6
5 changed files with 19 additions and 9 deletions

View File

@@ -297,7 +297,7 @@ class DoliDBPgsql
// To have postgresql case sensitive
$line=str_replace(' LIKE \'',' ILIKE \'',$line);
$line=str_replace(' LIKE BINARY \'',' LIKE \'',$line);
// Delete using criteria on other table must not declare twice the deleted table
// DELETE FROM tabletodelete USING tabletodelete, othertable -> DELETE FROM tabletodelete USING othertable
if (preg_match('/DELETE FROM ([a-z_]+) USING ([a-z_]+), ([a-z_]+)/i',$line,$reg))
@@ -1219,11 +1219,13 @@ class DoliDBPgsql
{
$sql = "ALTER TABLE ".$table;
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
if ($field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') $sql.="(".$field_desc['value'].")";
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
$sql.="(".$field_desc['value'].")";
}
// FIXME May not work with pgsql. May need to run a second request. If it works, just remove the FIXME tag
if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL";
dol_syslog($sql,LOG_DEBUG);
if (! $this->query($sql))
return -1;