DATACASS-96 - minor edits
This commit is contained in:
@@ -14,14 +14,13 @@ public enum CqlConstantType {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public boolean isValid(CharSequence candidate) {
|
||||
public boolean matches(CharSequence candidate) {
|
||||
return pattern.matcher(candidate).matches();
|
||||
}
|
||||
|
||||
public static class Regex {
|
||||
|
||||
// TODO: any sequence of characters encased in single quotes, as long as single quotes are doubled
|
||||
public static final String STRING_REGEX = "\\'[.TODO]*+\\'";
|
||||
public static final String STRING_REGEX = "'((?:[^']+|'')*)'";
|
||||
public static final Pattern STRING_PATTERN = Pattern.compile(STRING_REGEX);
|
||||
|
||||
public static final String INTEGER_REGEX = "\\-?[0-9]+";
|
||||
@@ -33,10 +32,10 @@ public enum CqlConstantType {
|
||||
public static final String BOOLEAN_REGEX = "(?i)true|false";
|
||||
public static final Pattern BOOLEAN_PATTERN = Pattern.compile(BOOLEAN_REGEX);
|
||||
|
||||
public static final String UUID_REGEX = "(?i)[0-9A-F]{8}+\\-[0-9A-F]{4}+\\-[0-9A-F]{4}+\\-[0-9A-F]{4}+\\-[0-9A-F]{12}+";
|
||||
public static final String UUID_REGEX = "(?i)[0-9a-f]{8}+\\-[0-9a-f]{4}+\\-[0-9a-f]{4}+\\-[0-9a-f]{4}+\\-[0-9a-f]{12}+";
|
||||
public static final Pattern UUID_PATTERN = Pattern.compile(UUID_REGEX);
|
||||
|
||||
public static final String BLOB_REGEX = "(?i)0[X](0-9A-F)+";
|
||||
public static final String BLOB_REGEX = "(?i)0[x](0-9a-f)+";
|
||||
public static final Pattern BLOB_PATTERN = Pattern.compile(BLOB_REGEX);
|
||||
}
|
||||
}
|
||||
@@ -117,9 +117,9 @@ public final class CqlIdentifier implements Comparable<CqlIdentifier> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identifier <em>without</em> encasing quotes, regardless of the value of {@link #isQuoted()}. If
|
||||
* {@link #isQuoted()} is <code>true</code>, then this value will be the same as {@link #toCql()} and
|
||||
* {@link #toString()}. If {@link #isQuoted()} is <code>false</code>, it will be different.
|
||||
* Returns the identifier <em>without</em> encasing quotes, regardless of the value of {@link #isQuoted()}. For
|
||||
* example, if {@link #isQuoted()} is <code>true</code>, then this value will be the same as {@link #toCql()} and
|
||||
* {@link #toString()}.
|
||||
* <p/>
|
||||
* This is needed, for example, to get the correct {@link TableMetadata} from
|
||||
* {@link KeyspaceMetadata#getTable(String)}: the given string must <em>not</em> be quoted.
|
||||
|
||||
@@ -42,9 +42,9 @@ public class CqlTableSpecificationAssertions {
|
||||
|
||||
public static void assertTable(TableDescriptor expected, String keyspace, Session session) {
|
||||
TableMetadata tmd = session.getCluster().getMetadata().getKeyspace(keyspace.toLowerCase())
|
||||
.getTable(CqlStringUtils.unquote(expected.getName().toCql())); // TODO: talk to Datastax about unquoting
|
||||
.getTable(expected.getName().getUnquoted()); // TODO: talk to Datastax about unquoting
|
||||
|
||||
assertEquals(CqlStringUtils.unquote(expected.getName().toCql()), tmd.getName()); // TODO: talk to Datastax
|
||||
assertEquals(expected.getName().getUnquoted(), tmd.getName()); // TODO: talk to Datastax
|
||||
assertPartitionKeyColumns(expected, tmd);
|
||||
assertPrimaryKeyColumns(expected, tmd);
|
||||
assertColumns(expected.getColumns(), tmd.getColumns());
|
||||
@@ -171,7 +171,7 @@ public class CqlTableSpecificationAssertions {
|
||||
}
|
||||
|
||||
public static void assertColumn(ColumnSpecification expected, ColumnMetadata actual) {
|
||||
assertEquals(expected.getName().toCql(), actual.getName());
|
||||
assertEquals(expected.getName().toCql(), actual.getName()); // TODO: expected.getName().getUnquoted()?
|
||||
assertEquals(expected.getType(), actual.getType());
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ public class CreateTableCqlGeneratorTests {
|
||||
public static final List<String> FUNKY_LEGAL_NAMES;
|
||||
|
||||
static {
|
||||
List<String> funkies = new ArrayList<String>(Arrays.asList(new String[] {}));
|
||||
List<String> funkies = new ArrayList<String>(Arrays.asList(new String[] { /* TODO */}));
|
||||
// TODO: should these work? "a \"\" x", "a\"\"\"\"x", "a b"
|
||||
for (ReservedKeyword funky : ReservedKeyword.values()) {
|
||||
funkies.add(funky.name());
|
||||
|
||||
Reference in New Issue
Block a user