Commit Graph

57 Commits

Author SHA1 Message Date
Calle Wilund
a18889380e cql3::functions::functions: dispatch token function 2015-07-08 10:02:31 +02:00
Calle Wilund
b17c3bf6df TokenFct Java->C++ 2015-07-08 10:02:31 +02:00
Paweł Dziepak
296a77b7f3 cql3: fix *asblob() and blobas*() functions names
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-08 10:02:30 +02:00
Pekka Enberg
42cfcfb32d database: Remove compose() function
Convert code to use the deserialize() function and drop the duplicate
compose() wrapper that we inherited from Origin.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-27 16:22:35 +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
6290dee438 db: const correctness for abstract_type and friends
Types are immutable.
2015-04-29 15:40:38 +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
d87fbe9eb8 cql3: Fix references to obsolete collection types
The code was using the wrong version of list_type_impl and
collection_type_impl.
2015-04-17 15:08:06 +02:00
Avi Kivity
5f05fa7087 cql3: move function_call.hh code to .cc file 2015-04-11 17:31:54 +03:00
Avi Kivity
e4276784b1 cql3: unprotect some 'class function' methods
'protected' is more strict in C++ than in Java, and these functions need
to be accessed from elsewhere.
2015-04-05 15:48:42 +03:00
Avi Kivity
adcd5e09c7 cql3: convert aggregate functions to serialization_format 2015-04-05 15:48:01 +03:00
Avi Kivity
86c09046fd cql3: allow null function arguments and return types
Change function argument types and return values to bytes_opt.

Note: a comment in the code says that NULL arguments are not supported,
but it seems prudent to prepare for the day they will be.
2015-04-03 12:16:19 +02:00
Avi Kivity
22ee20c751 cql3: move functions.hh code into .cc 2015-04-03 00:30:49 +03:00
Avi Kivity
4f3aaa988c cql3: make function_name friendlier to ANTLR
ANTLR wants default constructors, and to modify fields afterwards.
2015-04-01 21:02:00 +03:00
Avi Kivity
c2f3b90ef1 cql3: convert function_call.hh to C++ some more 2015-04-01 21:01:20 +03:00
Avi Kivity
89b3883783 cql3: fix too eager move in functions.hh
Can't use f and move it in the same expression.
2015-04-01 20:54:54 +03:00
Avi Kivity
db1df139e2 cql3: convert functions.hh to C++ some more 2015-04-01 20:52:21 +03:00
Avi Kivity
84b0a71716 cql3: convert function_name to C++ some more (native_function bits) 2015-04-01 20:49:35 +03:00
Avi Kivity
a59d8b384f cql3: convert scalar_functions from protocol_version to serialization_format 2015-04-01 20:48:07 +03:00
Avi Kivity
03bbcf55c2 cql3: fix max() function
Registration was done with a null shared_ptr<> instead of make_shared(),
and as a result the max template wasn't even instantiated, so it did not
even build.
2015-04-01 20:17:10 +03:00
Tomasz Grabiec
2902395129 Relax includes 2015-03-30 09:01:59 +02:00
Avi Kivity
579a794d14 cql3: de-virtualize cql3_type
cql3_type is a wrapper around data_type, so there's no need for a class
hierarchy -- anything that depends on the actual type can be forwarded
to abstract_type_impl.

We can now use this as a value type (dropping shared_ptr<cql3_type>), but
that is left for later.
2015-03-26 16:04:55 +01:00
Avi Kivity
f983ab41a3 db: get rid of object_opt
As Tomasz noticed, boost::any can be empty, so optional<> functionality is
not needed.
2015-03-24 08:23:34 +01:00
Tomasz Grabiec
9e6b4e823b cql3: Use move semantics where applicable 2015-02-04 10:29:04 +01:00
Tomasz Grabiec
d243fb7a01 cql3: Pass sstrings as const& where applicable 2015-02-04 10:29:00 +01:00
Tomasz Grabiec
d8982abf81 cql3: Allow bind_and_get() to return an optional value
In Origin it can be null and it has a different meaning than empty
value. See org.apache.cassandra.cql3.Constants.Setter#execute.
2015-01-29 19:41:00 +01:00
Tomasz Grabiec
3c3e3e5140 cql3: add missing multi-inclusion guard to function_call.hh 2015-01-25 18:46:15 +01:00
Avi Kivity
dad0858f5f cql: partially convert Functions to C++ 2015-01-14 17:12:08 +02:00
Avi Kivity
08a7425b4a cql: fix minor build errors 2015-01-14 11:38:41 +02:00
Avi Kivity
3a039188cf cql: fix bytes_conversion_fcts build errors 2015-01-14 11:38:41 +02:00
Avi Kivity
2e6004a3ce cql: fix aggregate_fcts build errors 2015-01-14 11:38:41 +02:00
Avi Kivity
73d9d3fd64 cql: switch from unique_ptr<function> to shared_ptr<function>
The Functions class wants to store functions in a map and hand them out later,
so we need a shared_ptr.

(could have had a map of name -> function factory, maybe one day)
2015-01-14 11:38:41 +02:00
Avi Kivity
69f61e31ea cql3: convert BytesConversionFcts 2015-01-13 11:34:29 +02:00
Avi Kivity
91f19afbe5 cql: convert UuidFcts 2015-01-12 14:47:55 +02:00
Avi Kivity
41a224f314 cql: convert FunctionCall to C++ 2015-01-12 11:19:34 +02:00
Avi Kivity
d3ccdf8d3d cql: make scalar_function contents public 2015-01-12 11:17:00 +02:00
Avi Kivity
8c65782af8 cql: move print operator from abstract_function to function
More usable in the base type.
2015-01-12 11:16:23 +02:00
Avi Kivity
0b9595b58a cql: convert TimeuuidFcts to C++ 2015-01-11 15:46:03 +02:00
Avi Kivity
c26e42b1b2 cql: add helper for creating native function out of a lambda 2015-01-11 15:46:03 +02:00
Avi Kivity
1fe6bf687d db: de-pimpl data_type
Since origin tends to cast around, we should allow that too, by exposing
the implementation type and using a shared_ptr instead of a value class.
2015-01-05 15:55:30 +02:00
Avi Kivity
80408329e0 db: rename data types to conform to origin conventions 2015-01-05 13:48:38 +02:00
Avi Kivity
7cab37ddad cql: convert AggregateFcts to C++
Use templates to reduce code duplication for each data type.
2014-12-31 16:09:21 +02:00
Avi Kivity
719a7f87f3 cql: add helpers for constructing native aggregate functions 2014-12-31 16:06:28 +02:00
Avi Kivity
f303499d01 cql: fix native_aggregate_function base classes
Must be public.
2014-12-31 16:05:50 +02:00
Avi Kivity
adc78b8959 cql: fix function/abstract_function inheritence
Make a few functions virtual and fix the types.
2014-12-31 16:04:22 +02:00
Avi Kivity
35608909b0 cql: use optional<bytes> for function arguments and return types
Allow null values.
2014-12-31 16:03:43 +02:00
Avi Kivity
f9c7eb3e9b cql3: convert NativeScalarFunction to C++ 2014-12-30 09:00:22 +02:00
Avi Kivity
66138dc189 cql3: convert NativeAggregateFunction to C++
Requires virtual inheritence from functions::function due to an
inheritence diamond.
2014-12-30 09:00:22 +02:00
Avi Kivity
9a2c40c931 cql3: convert AggregateFunction to C++ 2014-12-30 09:00:22 +02:00