~ubuntu-branches/ubuntu/wily/apgdiff/wily

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2009-12-02 11:11:33 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20091202111133-k5wrh3zb2pzmbv8c
Tags: 1.4-1
* New upstream version. (Without changelog, I am afraid.)
* Test suite still not enabled as it needs network access. (The junit
  version in Debian needs upgrading.)
* Optimize rules files a bit so debhelper doesn't clean twice, and quilt's
  patch target doesn't prevent build-stamp from working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * $Id: CreateSchemaParser.java 81 2007-09-01 20:26:38Z fordfrog $
3
 
 */
4
1
package cz.startnet.utils.pgdiff.parsers;
5
2
 
6
3
import cz.startnet.utils.pgdiff.schema.PgDatabase;
9
6
import java.util.regex.Matcher;
10
7
import java.util.regex.Pattern;
11
8
 
12
 
 
13
9
/**
14
10
 * Parses CREATE SCHEMA commands.
15
11
 *
16
12
 * @author fordfrog
17
 
 * @version $Id: CreateSchemaParser.java 81 2007-09-01 20:26:38Z fordfrog $
18
13
 */
19
14
public class CreateSchemaParser {
 
15
 
20
16
    /**
21
17
     * Pattern for parsing CREATE SCHEMA ... AUTHORIZATION ...
22
18
     */
23
 
    private static final Pattern PATTERN_CREATE_SCHEMA =
24
 
        Pattern.compile(
25
 
                "^CREATE[\\s]+SCHEMA[\\s]+([^\\s;]+)"
26
 
                + "(?:[\\s]+AUTHORIZATION[\\s]+([^\\s;]+))?;$",
27
 
                Pattern.CASE_INSENSITIVE);
28
 
 
 
19
    private static final Pattern PATTERN_CREATE_SCHEMA = Pattern.compile(
 
20
            "^CREATE[\\s]+SCHEMA[\\s]+([^\\s;]+)"
 
21
            + "(?:[\\s]+AUTHORIZATION[\\s]+([^\\s;]+))?;$",
 
22
            Pattern.CASE_INSENSITIVE);
29
23
    /**
30
24
     * Pattern for parsing CREATE SCHEMA AUTHORIZATION ...
31
25
     */
32
26
    private static final Pattern PATTERN_CREATE_SCHEMA_AUTHORIZATION =
33
 
        Pattern.compile(
34
 
                "^CREATE[\\s]+SCHEMA[\\s]+AUTHORIZATION[\\s]+([^\\s;]+);$",
35
 
                Pattern.CASE_INSENSITIVE);
 
27
            Pattern.compile(
 
28
            "^CREATE[\\s]+SCHEMA[\\s]+AUTHORIZATION[\\s]+([^\\s;]+);$",
 
29
            Pattern.CASE_INSENSITIVE);
36
30
 
37
31
    /**
38
32
     * Creates a new CreateSchemaParser object.
64
58
            database.addSchema(schema);
65
59
        } else {
66
60
            final Matcher matcher2 =
67
 
                PATTERN_CREATE_SCHEMA_AUTHORIZATION.matcher(command);
 
61
                    PATTERN_CREATE_SCHEMA_AUTHORIZATION.matcher(command);
68
62
 
69
63
            if (matcher2.matches()) {
70
64
                final PgSchema schema = new PgSchema(matcher.group(1));