NAME

DBIO::Sybase::Diff::View - Diff Sybase ASE views

VERSION

version 0.900007

DESCRIPTION

Compares two view sets (the views of the models DBIO::Sybase::Introspect produces) and generates the view operations:

  • a view only in the target: CREATE VIEW name AS ...;

  • a view only in the source: DROP VIEW name;

  • a view on both sides with another definition: DROP VIEW and CREATE VIEW. ASE has no ALTER VIEW.

The definitions are compared as the text after AS (DBIO::Sybase::Introspect::Views) with every run of white space reduced to one blank, so a view deployed with another layout is not a change. Nothing else is normalised: a different spelling of the same query is a change, and the view is dropped and created again.

DBIO::Sybase::Diff puts the drops before the changes to tables and the creates after them: a removed or changed view must not be there when the table under it is dropped or altered, and a new or changed one needs the tables and columns it reads. Between views the order follows depends_on (sysdepends): a view that reads from another is created after it and dropped before it. A cycle cannot exist on a server; in a model that has one the diff refuses with a DBIO::Exception naming the views.

Only the removed and the changed views are dropped. A view on a changed view that is itself unchanged is left alone; when the server refuses to create the changed one because of it, that error is the answer, it is not caught. A table changing kind (table to view or the other way) is not handled: the CREATE VIEW or DROP VIEW runs against an object of the other kind and the server refuses it.

Each op's as_sql ends in ;, so "apply" in DBIO::Sybase::Deploy sends every view statement as a batch of its own, which CREATE VIEW needs (see "EVERY STATEMENT ENDS IN ;" in DBIO::Sybase::Diff).

METHODS

diff

my @ops = DBIO::Sybase::Diff::View->diff($source_views, $target_views);

The ops, the drops first (dependents before what they read from), then the creates (what a view reads from first); each in name order where the dependencies leave a choice.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.