/** * Get all the column names in a table * * @return array */ protected function getTableFields() { $connection = Connection::connect(); $driver = getenv('P_DRIVER'); if ($driver == 'pgsql') { $describe = '\\d '; } $describe = 'describe '; $q = $connection->prepare($describe . $this->getTableName($this->className)); $q->execute(); return $q->fetchAll(PDO::FETCH_COLUMN); }
/** * Delete an existing row from the database * * @param $id * @return string */ protected static function doDelete($id) { $model = self::createModelInstance(); $tableName = $model->getTableName($model->className); $connection = Connection::connect(); $delete = $connection->prepare('delete from ' . $tableName . ' where id =' . $id); return $delete->execute() ? 'deleted successfully' : 'Row not deleted'; }