Fix for Bug #4978 - Every time I add one field in one DB activity...
Added AS df in SQL query in data_fieldname_exists(). Reformatted the strings to use single quotes when quoting in SQL. These changes might solve PostgreSQL problems.
This commit is contained in:
+5
-5
@@ -1185,12 +1185,12 @@ function data_fieldname_exists($name, $dataid, $fieldid=0) {
|
||||
global $CFG;
|
||||
|
||||
if ($fieldid) {
|
||||
return record_exists_sql('SELECT * from '.$CFG->prefix.'data_fields
|
||||
WHERE name LIKE "'.$name.'" AND dataid = '.$dataid.'
|
||||
AND ((id < '.$fieldid.') OR (id > '.$fieldid.'))');
|
||||
return record_exists_sql("SELECT * from {$CFG->prefix}data_fields AS df
|
||||
WHERE df.name LIKE '$name' AND df.dataid = $dataid
|
||||
AND ((df.id < $fieldid) OR (df.id > $fieldid))");
|
||||
} else {
|
||||
return record_exists_sql('SELECT * from '.$CFG->prefix.'data_fields
|
||||
WHERE name LIKE "'.$name.'" AND dataid = '.$dataid);
|
||||
return record_exists_sql("SELECT * from {$CFG->prefix}data_fields AS df
|
||||
WHERE df.name LIKE '$name' AND df.dataid = $dataid");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user