function getRowIdentifier($table)
{
$oldtable = $table;
$c_schema = $this->_schema;
$this->clean($c_schema);
$this->clean($table);
$status = $this->beginTransaction();
if ($status != 0) {
return -1;
}
// Get the first primary or unique index (sorting primary keys first) that
// is NOT a partial index.
$sql = "\n\t\t\tSELECT indrelid, indkey\n\t\t\tFROM pg_catalog.pg_index\n\t\t\tWHERE indisunique AND indrelid=(\n\t\t\t\tSELECT oid FROM pg_catalog.pg_class\n\t\t\t\tWHERE relname='{$table}' AND relnamespace=(\n\t\t\t\t\tSELECT oid FROM pg_catalog.pg_namespace\n\t\t\t\t\tWHERE nspname='{$c_schema}'\n\t\t\t\t)\n\t\t\t) AND indpred IS NULL AND indexprs IS NULL\n\t\t\tORDER BY indisprimary DESC LIMIT 1";
$rs = $this->selectSet($sql);
// If none, check for an OID column. Even though OIDs can be duplicated, the edit and delete row
// functions check that they're only modiying a single row. Otherwise, return empty array.
if ($rs->recordCount() == 0) {
// Check for OID column
$temp = array();
if ($this->hasObjectID($table)) {
$temp = array('oid');
}
$this->endTransaction();
return $temp;
} else {
$attnames = $this->getAttributeNames($oldtable, explode(' ', $rs->fields['indkey']));
if (!is_array($attnames)) {
$this->rollbackTransaction();
return -1;
} else {
$this->endTransaction();
return $attnames;
}
}
}