~ubuntu-branches/ubuntu/utopic/apgdiff/utopic-proposed

« back to all changes in this revision

Viewing changes to src/main/java/cz/startnet/utils/pgdiff/PgDiffSequences.java

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2010-10-11 09:08:18 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20101011090818-s0bzw1ieg6rmpfld
Tags: 2.2.2-1
* New upstream version.
* Using changelog included in zipfile, thanks Miroslav for providing this.
* Update manpage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
     * @param writer writer the output should be written to
30
30
     * @param oldSchema original schema
31
31
     * @param newSchema new schema
 
32
     * @param searchPathHelper search path helper
32
33
     */
33
34
    public static void createSequences(final PrintWriter writer,
34
 
            final PgSchema oldSchema, final PgSchema newSchema) {
 
35
            final PgSchema oldSchema, final PgSchema newSchema,
 
36
            final SearchPathHelper searchPathHelper) {
35
37
        // Add new sequences
36
38
        for (final PgSequence sequence : newSchema.getSequences()) {
37
39
            if (oldSchema == null
38
40
                    || !oldSchema.containsSequence(sequence.getName())) {
 
41
                searchPathHelper.outputSearchPath(writer);
39
42
                writer.println();
40
43
                writer.println(sequence.getCreationSQL());
41
44
            }
48
51
     * @param writer writer the output should be written to
49
52
     * @param oldSchema original schema
50
53
     * @param newSchema new schema
 
54
     * @param searchPathHelper search path helper
51
55
     */
52
56
    public static void dropSequences(final PrintWriter writer,
53
 
            final PgSchema oldSchema, final PgSchema newSchema) {
 
57
            final PgSchema oldSchema, final PgSchema newSchema,
 
58
            final SearchPathHelper searchPathHelper) {
54
59
        // Drop sequences that do not exist in new schema
55
60
        if (oldSchema != null) {
56
61
            for (final PgSequence sequence : oldSchema.getSequences()) {
57
62
                if (!newSchema.containsSequence(sequence.getName())) {
 
63
                    searchPathHelper.outputSearchPath(writer);
58
64
                    writer.println();
59
65
                    writer.println(sequence.getDropSQL());
60
66
                }
69
75
     * @param arguments object containing arguments settings
70
76
     * @param oldSchema original schema
71
77
     * @param newSchema new schema
 
78
     * @param searchPathHelper search path helper
72
79
     */
73
80
    public static void alterSequences(final PrintWriter writer,
74
81
            final PgDiffArguments arguments, final PgSchema oldSchema,
75
 
            final PgSchema newSchema) {
 
82
            final PgSchema newSchema, final SearchPathHelper searchPathHelper) {
76
83
        final StringBuilder sbSQL = new StringBuilder(100);
77
84
 
78
85
        for (final PgSequence newSequence : newSchema.getSequences()) {
141
148
                }
142
149
 
143
150
                if (sbSQL.length() > 0) {
 
151
                    searchPathHelper.outputSearchPath(writer);
144
152
                    writer.println();
145
153
                    writer.print("ALTER SEQUENCE "
146
154
                            + PgDiffUtils.getQuotedName(newSequence.getName()));