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:
vyshane
2006-03-27 06:19:34 +00:00
parent cb3689b917
commit b395a1e44a
+5 -5
View File
@@ -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");
}
}