Commit Graph

39 Commits

Author SHA1 Message Date
Pekka Enberg
56cca3b0d6 cql3: Add to_cql_string() to column_identifier class 2017-05-04 14:59:11 +03:00
Tomasz Grabiec
ddfee57c97 Replace iostream include with iosfwd in headers
Message-Id: <1484656119-8386-4-git-send-email-tgrabiec@scylladb.com>
2017-01-17 14:52:44 +02:00
Pekka Enberg
38a54df863 Fix pre-ScyllaDB copyright statements
People keep tripping over the old copyrights and copy-pasting them to
new files. Search and replace "Cloudius Systems" with "ScyllaDB".

Message-Id: <1460013664-25966-1-git-send-email-penberg@scylladb.com>
2016-04-08 08:12:47 +03:00
Tomasz Grabiec
b42d3a90b3 cql3: create_table_statement: Sort _defined_names by text
Currently they are sorted by address in memory, which breaks the
check for column name duplicates, which assumes sorting by text.

Fixes #975.

Message-Id: <1456937400-20475-1-git-send-email-tgrabiec@scylladb.com>
2016-03-02 18:53:43 +02:00
Pekka Enberg
f5597968ac cql3: Remove untranslated IMeasurableMemory code from column_identifier
We will not be using it so just remove the untranslated code.
2015-12-18 13:29:58 +02:00
Avi Kivity
d5cf0fb2b1 Add license notices 2015-09-20 10:43:39 +03:00
Pekka Enberg
de6b38e316 cql3: Move column_identifier implementation to .cc file
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-24 10:21:11 +02:00
Pekka Enberg
872a7215b2 cql3: Separate column_identifier::raw class
Move column_identifier::raw class definition outside of
column_identifier class.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-24 10:21:11 +02:00
Pekka Enberg
11b633208d cql3: Remove Java imports from C++ files
Remove left-over Java imports from files that are already translated to
C++.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:41:12 +03:00
Pekka Enberg
d50139351f cql3: Use pragma once everywhere
There's no benefit to using C include guards so switch to pragma once
everywhere for consistency.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:32:56 +03:00
Avi Kivity
ab60ed8813 db: s/shared_ptr<abstract_type>/data_type/
Also replace derived types (map_type, collection_type, etc.).

As we'll change data_type's definition, this reduces the number of places
that need to be modified later, and is more readable.
2015-04-29 15:09:04 +03:00
Avi Kivity
3d38708434 cql3: pass a database& instance to most foo::raw::prepare() variants
To prepare a user-defined type, we need to look up its name in the keyspace.
While we get the keyspace name as an argument to prepare(), it is useless
without the database instance.

Fix the problem by passing a database reference along with the keyspace.
This precolates through the class structure, so most cql3 raw types end up
receiving this treatment.

Origin gets along without it by using a singleton.  We can't do this due
to sharding (we could use a thread-local instance, but that's ugly too).

Hopefully the transition to a visitor will clean this up.
2015-04-20 16:15:34 +03:00
Tomasz Grabiec
2902395129 Relax includes 2015-03-30 09:01:59 +02:00
Tomasz Grabiec
e3422525c0 Use column_definition via const reference 2015-03-24 12:03:00 +01:00
Avi Kivity
aa8834a260 cql: add column_identifier::operator!=() 2015-03-16 16:44:00 +02:00
Tomasz Grabiec
8912417dd0 cql3: Convert classes from org.cassandra.cql3.selection package 2015-03-11 14:56:10 +01:00
Tomasz Grabiec
f7c425fdd9 cql3: Introduce column_identifier::name() 2015-03-11 14:56:10 +01:00
Tomasz Grabiec
fe12ad6ae1 cql3: Move argument in column_identifier constructor 2015-03-11 14:56:10 +01:00
Tomasz Grabiec
4c7480ce3b cql3: Introduce to_identifier(column_definition&) 2015-03-11 14:56:09 +01:00
Tomasz Grabiec
70059ac1d4 cql3: Add to_identifiers()
Converts org.apache.cassandra.config.ColumnDefinition#toIdentifiers(List<ColumnDefinition>);
2015-03-11 14:56:09 +01:00
Tomasz Grabiec
6ca084fdb3 cql3: Implement operator== for column_identifier::raw 2015-02-12 19:40:59 +01:00
Tomasz Grabiec
90604df376 cql3: Move method definition to the source file 2015-02-09 10:28:43 +01:00
Tomasz Grabiec
ef7ce1406f cql3: Make column_identifier ostream-printable 2015-02-09 10:28:41 +01:00
Pekka Enberg
ed45d19f72 cql3: Add std::hash for column_identifier
It's needed for unordered_map.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-02-06 10:46:12 +02:00
Tomasz Grabiec
9e6b4e823b cql3: Use move semantics where applicable 2015-02-04 10:29:04 +01:00
Tomasz Grabiec
654372f368 schema: Allow regular column names to have arbitrary type
Regular columns may have names of arbitrary type. See
https://issues.apache.org/jira/browse/CASSANDRA-8178

Primary key columns are UTF8.

This change also does some refactoring of the schema object to make
the change easier to digest (more encapsulation).
2015-02-04 10:29:00 +01:00
Tomasz Grabiec
43dd9250b9 cql3: Expose more column_identifier constructors 2015-02-04 10:29:00 +01:00
Tomasz Grabiec
fc2d98431a cql3: Implement some to_string() methods 2015-02-04 10:29:00 +01:00
Tomasz Grabiec
cbe1a3d403 schema: Introduce schema::get_column_definition() 2015-02-04 10:28:56 +01:00
Tomasz Grabiec
212bb750ac cql3: Expose column_identifier::raw::prepare_column_identifier()
It's a workaround for C++ not supporting covariant return types with
smart pointers.

When callers know that they call prepare() on column_identifier, they
expect shared_ptr<column_identifier>. But prepare() comes form
abstract base class, and is defined to return shared_ptr<selectable>,
where "selectable" is ancestor of column_identifier.

We can avoid dynamic_cast<> here by calling a non-polymorphic
prepare_column_identifier() when the type is known.

Needed from modification_statement::parsed::prepare().
2015-02-04 10:28:56 +01:00
Tomasz Grabiec
159099e854 cql3: use our schema classes instead of the converts from config:: 2015-01-29 18:55:24 +01:00
Tomasz Grabiec
90a43b5556 cql3: Make column_identifier printable 2015-01-23 18:45:28 +01:00
Tomasz Grabiec
f081902a26 cql3: Implement equality and hashing for column_identifier 2015-01-23 18:45:28 +01:00
Pekka Enberg
a88c49ede8 cql3: Make column_identifier instantiable
The class inherits from abstract base class selectable so there's methods that
we need to define.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-21 15:38:09 +02:00
Pekka Enberg
63a2ec49b3 cql3: Convert ColumnIdentifier.Raw to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-20 11:47:38 +02:00
Pekka Enberg
8d4d793695 cql3: Add to_string() to column_identifier class
It's needed for the AbstractMarker conversion.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-09 13:00:16 +02:00
Pekka Enberg
381089be09 cql3: Fix missing include in column_identifier.hh
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-09 13:00:16 +02:00
Pekka Enberg
1db158de29 cql3: convert ColumnIdentifier to C++, take 2
Minimal constructor conversion to be able to conver the Attributes class
completely.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-07 17:05:28 +02:00
Pekka Enberg
bb46ca9003 cql3: convert ColumnIdentifier to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:58 +02:00