CREATE TABLE
482483484485486487488489490491492493494
@VisibleForTesting public static CFMetaData compile(String cql, String keyspace) { try { CreateTableStatement statement = (CreateTableStatement) QueryProcessor.parseStatement(cql).prepare().statement; CFMetaData cfm = newSystemMetadata(keyspace, statement.columnFamily(), "", statement.comparator, null); statement.applyPropertiesTo(cfm); return cfm.rebuild(); } catch (RequestValidationException e) { throw new RuntimeException(e);
479480481482483484485486487488489490491
546547548549550551552553554555556557558
{ try { CFStatement parsed = (CFStatement)QueryProcessor.parseStatement(cql); parsed.prepareKeyspace(keyspace); CreateTableStatement statement = (CreateTableStatement) parsed.prepare().statement; CFMetaData cfm = newSystemMetadata(keyspace, statement.columnFamily(), "", statement.comparator); statement.applyPropertiesTo(cfm); return cfm.rebuild(); } catch (RequestValidationException e) { throw new RuntimeException(e);
90919293949596979899100101102103104105106107108109110111112113114
read(end); return false; } private KSPropDefs parseKSPropDefs() { KSPropDefs defs = new KSPropDefs(); try { read("WITH"); do { String name = readUniqueIdentifier().toLowerCase(Locale.US); read("="); if (readIf("{")) { defs.addProperty(name, parseMap()); } else { Expression value = readExpression(); defs.addProperty(name, value.optimize(session).getValue(session).toString()); } } while (readIf("AND")); defs.validate(); } catch (SyntaxException e) { throw getSyntaxError(); } return defs; }
122123124125126127128129130
if (readIf("AUTHORIZATION")) { command.setAuthorization(readUniqueIdentifier()); } else { command.setAuthorization(session.getUser().getName()); } KSPropDefs defs = parseKSPropDefs(); command.setKSPropDefs(defs); return command; }
131132133134135136137138139140
protected Prepared parseAlterKeyspace() { AlterKeyspace command = new AlterKeyspace(session); command.setKeyspaceName(readUniqueIdentifier()); KSPropDefs defs = parseKSPropDefs(); command.setKSPropDefs(defs); command.validate(); return command; }
185186187188189190191192193194195196
statement.getBoundsTerms(), queryValues.size())); if (!(statement instanceof ModificationStatement)) throw new InvalidRequestException("Invalid statement in batch: only UPDATE, INSERT and DELETE statements are allowed."); ModificationStatement mst = (ModificationStatement)statement; if (mst.isCounter()) { if (type != BatchStatement.Type.COUNTER) throw new InvalidRequestException("Cannot include counter statement in a non-counter batch"); } else