forked from extern/egroupware
Fix excess of maximum column length issue
This commit is contained in:
parent
e94703b9a4
commit
a4b36620dd
@ -598,9 +598,18 @@ class so_sql
|
|||||||
{
|
{
|
||||||
continue; // no need to write that (unset) column
|
continue; // no need to write that (unset) column
|
||||||
}
|
}
|
||||||
|
if ($this->table_def['fd'][$db_col]['type'] == 'varchar' &&
|
||||||
|
strlen($this->data[$col]) > $this->table_def['fd'][$db_col]['precision'])
|
||||||
|
{
|
||||||
|
// truncate the field to mamimum length, if upper layers didn't care
|
||||||
|
$data[$db_col] = substr($this->data[$col],0,$this->table_def['fd'][$db_col]['precision']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$data[$db_col] = (string) $this->data[$col] === '' && $this->empty_on_write == 'NULL' ? null : $this->data[$col];
|
$data[$db_col] = (string) $this->data[$col] === '' && $this->empty_on_write == 'NULL' ? null : $this->data[$col];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$this->db->insert($this->table_name,$data,false,__LINE__,__FILE__,$this->app);
|
$this->db->insert($this->table_name,$data,false,__LINE__,__FILE__,$this->app);
|
||||||
|
|
||||||
if ($this->autoinc_id)
|
if ($this->autoinc_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user