1
0
Fork 0

Merge branch 'devel'

Conflicts:
	README.md
This commit is contained in:
Frank Celler 2012-02-22 15:37:30 +01:00
commit e42098424a
36 changed files with 1967 additions and 4239 deletions

View File

@ -30,7 +30,7 @@ boost
protected:
~error_info_base() throw()
virtual ~error_info_base() throw()
{
}
};

View File

@ -18,4 +18,4 @@
#include <boost/fusion/tuple/detail/preprocessed/make_tuple50.hpp>
#else
#error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
#endif
#endif

View File

@ -18,4 +18,4 @@
#include <boost/fusion/tuple/detail/preprocessed/tuple50.hpp>
#else
#error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
#endif
#endif

View File

@ -18,4 +18,4 @@
#include <boost/fusion/tuple/detail/preprocessed/tuple50_fwd.hpp>
#else
#error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
#endif
#endif

View File

@ -18,4 +18,4 @@
#include <boost/fusion/tuple/detail/preprocessed/tuple_tie50.hpp>
#else
#error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
#endif
#endif

View File

@ -35,20 +35,6 @@
/// @{
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTIONS-- triagens namespace
// -----------------------------------------------------------------------------
namespace triagens {
using namespace std;
typedef TRI_blob_t blob_t;
typedef TRI_datetime_t datetime_t;
typedef TRI_date_t date_t;
typedef TRI_seconds_t seconds_t;
typedef TRI_msec_t msec_t;
}
// -----------------------------------------------------------------------------
// --SECTION-- C++ header files that are always present on all systems
// -----------------------------------------------------------------------------
@ -65,6 +51,20 @@ namespace triagens {
#include <string>
#include <vector>
// -----------------------------------------------------------------------------
// --SECTIONS-- triagens namespace
// -----------------------------------------------------------------------------
namespace triagens {
using namespace std;
typedef TRI_blob_t blob_t;
typedef TRI_datetime_t datetime_t;
typedef TRI_date_t date_t;
typedef TRI_seconds_t seconds_t;
typedef TRI_msec_t msec_t;
}
// -----------------------------------------------------------------------------
// --SECTION-- noncopyable class
// -----------------------------------------------------------------------------

View File

@ -186,7 +186,7 @@ char const* TRI_last_error () {
}
else {
err = eptr->_number;
err = eptr->_sys;
sys = eptr->_sys;
}
#else
@ -229,6 +229,7 @@ int TRI_set_errno (int error) {
#elif defined(TRI_HAVE_POSIX_THREADS)
tri_error_t* eptr;
int copyErrno = errno;
eptr = pthread_getspecific(ErrorKey);
@ -240,7 +241,7 @@ int TRI_set_errno (int error) {
eptr->_number = error;
if (error == TRI_ERROR_SYS_ERROR) {
eptr->_sys = errno;
eptr->_sys = copyErrno;
}
else {
eptr->_sys = 0;

View File

@ -92,11 +92,11 @@ namespace triagens {
// directly execute the handler within the scheduler thread
if (handler->isDirect()) {
Handler::status_e status = handleRequestDirectly(task, handler);
Handler::status_e status = this->handleRequestDirectly(task, handler);
if (status != Handler::HANDLER_REQUEUE) {
done = true;
destroyHandler(handler);
this->destroyHandler(handler);
}
else {
continue;
@ -109,7 +109,7 @@ namespace triagens {
if (atask == 0) {
LOGGER_WARNING << "task is indirect, but not asynchronous";
destroyHandler(handler);
this->destroyHandler(handler);
return false;
}
else {
@ -127,7 +127,7 @@ namespace triagens {
else {
LOGGER_WARNING << "no dispatcher is known";
destroyHandler(handler);
this->destroyHandler(handler);
return false;
}
}

View File

@ -217,7 +217,6 @@ static bool isEqualElementElement (struct TRI_associative_array_s* associativeAr
void* leftElement, void* rightElement) {
HashIndexElement* hLeftElement = (HashIndexElement*)(leftElement);
HashIndexElement* hRightElement = (HashIndexElement*)(rightElement);
int result;
if (leftElement == NULL || rightElement == NULL) {
return false;
@ -245,7 +244,6 @@ static bool isEqualKeyElement (struct TRI_associative_array_s* associativeArray,
void* leftElement, void* rightElement) {
HashIndexElement* hLeftElement = (HashIndexElement*)(leftElement);
HashIndexElement* hRightElement = (HashIndexElement*)(rightElement);
int result;
if (leftElement == NULL || rightElement == NULL) {
return false;
@ -270,7 +268,7 @@ static bool isEqualKeyElement (struct TRI_associative_array_s* associativeArray,
// .............................................................................
// The actual hashing occurs here
// .............................................................................
static size_t hashElement (struct TRI_associative_array_s* associativeArray, void* element) {
static uint64_t hashElement (struct TRI_associative_array_s* associativeArray, void* element) {
HashIndexElement* hElement = (HashIndexElement*)(element);
size_t hash = TRI_InitialCrc32();
@ -284,7 +282,7 @@ static size_t hashElement (struct TRI_associative_array_s* associativeArray, voi
}
static size_t hashKey (struct TRI_associative_array_s* associativeArray, void* element) {
static uint64_t hashKey (struct TRI_associative_array_s* associativeArray, void* element) {
HashIndexElement* hElement = (HashIndexElement*)(element);
size_t hash = TRI_InitialCrc32();

View File

@ -0,0 +1,7 @@
[action]
threads = 4
[log]
level = info
severity = human
file = /var/log/voc/avocado.log

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>org.avocadodb</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/avocado</string>
<string>-c</string>
<string>/etc/voc/avocado.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

View File

@ -46,7 +46,7 @@ namespace triagens {
class HttpRequest;
namespace InputParser {
class ObjectDescriptionImpl;
struct ObjectDescriptionImpl;
////////////////////////////////////////////////////////////////////////////////
/// @ingroup Utilities

View File

@ -838,6 +838,7 @@ static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
#endif
#define YY_NO_INPUT
#ifndef YY_NO_INPUT
/* %if-c-only Standard (non-C++) definition */
/* %not-for-header */

View File

@ -128,7 +128,7 @@ namespace triagens { namespace json_parser {
{
return
(pos1.filename == pos2.filename
|| pos1.filename && pos2.filename && *pos1.filename == *pos2.filename)
|| (pos1.filename && pos2.filename && *pos1.filename == *pos2.filename))
&& pos1.line == pos2.line && pos1.column == pos2.column;
}

View File

@ -1,15 +1,39 @@
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS =
AM_CXXFLAGS =
AM_CPPFLAGS = -D_SYSCONFDIR_='"${sysconfdir}"' -D_PKGDATADIR_='"${pkgdatadir}"' -D_DATABASEDIR_='"${localstatedir}/${PACKAGE_TARNAME}"'
AM_LDFLAGS =
AM_CPPFLAGS = \
-D_SYSCONFDIR_='"${sysconfdir}"' \
-D_PKGDATADIR_='"${pkgdatadir}"' \
-D_DATABASEDIR_='"${localstatedir}/${PACKAGE_TARNAME}"' \
@BOOST_CPPFLAGS@ \
@LIBEV_CPPFLAGS@ \
@MATH_CPPFLAGS@ \
@NCURSES_CPPFLAGS@ \
@OPENSSL_CPPFLAGS@ \
@READLINE_CPPFLAGS@ \
@V8_CPPFLAGS@
AM_LDFLAGS = \
@BOOST_LDFLAGS@ \
@LIBEV_LDFLAGS@ \
@MATH_LDFLAGS@ \
@NCURSES_LDFLAGS@ \
@OPENSSL_LDFLAGS@ \
@READLINE_LDFLAGS@ \
@V8_LDFLAGS@
LIBS = \
@BOOST_LIBS@ \
@LIBEV_LIBS@ \
@MATH_LIBS@ \
@NCURSES_LIBS@ \
@OPENSSL_LIBS@ \
@READLINE_LIBS@ \
@V8_LIBS@
BUILT_SOURCES =
CLEANUP =
LIBS =
noinst_LIBRARIES = libavocadodb.a
bin_PROGRAMS = avocado
sbin_PROGRAMS = avocado
nobase_pkgdata_DATA = \
$(shell find @srcdir@/js/system -name "*.js" -print) \
@ -25,7 +49,7 @@ install-data-local:
test -d @localstatedir@//${PACKAGE_TARNAME} || mkdir -p @localstatedir@//${PACKAGE_TARNAME}
################################################################################
## avocado
## avocadodb
################################################################################
include Makefile.files

View File

@ -54,6 +54,6 @@ wiki: $(WIKI)
## CLEANUP
################################################################################
CLEANUP += $(DOXYGEN) $(WIKI)
CLEANUP += $(DOXYGEN) $(WIKI) $(subst Doxygen/xml,Doxygen/wiki,$(WIKI))

View File

@ -4,17 +4,7 @@
## avocadodb
################################################################################
libavocadodb_a_CPPFLAGS = \
$(AM_CPPFLAGS) \
@BOOST_CPPFLAGS@ \
@LIBEV_CPPFLAGS@ \
@MATH_CPPFLAGS@ \
@NCURSES_CPPFLAGS@ \
@OPENSSL_CPPFLAGS@ \
@READLINE_CPPFLAGS@ \
@V8_CPPFLAGS@
libavocadodb_a_SOURCES = \
avocado_SOURCES = \
Admin/ApplicationAdminServer.cpp \
Admin/RestAdminBaseHandler.cpp \
Admin/RestAdminFeConfigurationHandler.cpp \
@ -99,6 +89,16 @@ libavocadodb_a_SOURCES = \
Logger/LoggerStream.cpp \
Logger/LoggerTiming.cpp \
ProgramOptions/program-options.c \
QL/ParserWrapper.cpp \
QL/ast-node.c \
QL/ast-query.c \
QL/error.c \
QL/formatter.c \
QL/javascripter.c \
QL/optimize.c \
QL/parser-context.c \
QL/parser.c \
QL/tokens.c \
Rest/AddressPort.cpp \
Rest/AnyServer.cpp \
Rest/HttpRequest.cpp \
@ -106,6 +106,16 @@ libavocadodb_a_SOURCES = \
Rest/Initialise.cpp \
Rest/SslInterface.cpp \
Rest/Url.cpp \
RestHandler/RestActionHandler.cpp \
RestHandler/RestDocumentHandler.cpp \
RestHandler/RestSystemActionHandler.cpp \
RestHandler/RestVocbaseBaseHandler.cpp \
RestServer/ActionDispatcherThread.cpp \
RestServer/AvocadoHttpServer.cpp \
RestServer/AvocadoServer.cpp \
RestServer/JSLoader.cpp \
RestServer/SystemActionDispatcherThread.cpp \
RestServer/avocado.cpp \
ResultGenerator/HtmlResultGenerator.cpp \
ResultGenerator/Initialise.cpp \
ResultGenerator/JsonResultGenerator.cpp \
@ -130,11 +140,11 @@ libavocadodb_a_SOURCES = \
ShapedJson/shape-accessor.c \
ShapedJson/shaped-json.c \
V8/v8-actions.cpp \
V8/v8-conv.cpp \
V8/v8-json.cpp \
V8/v8-line-editor.cpp \
V8/v8-shell.cpp \
V8/v8-utils.cpp \
V8/v8-conv.cpp \
V8/v8-line-editor.cpp \
V8/v8-vocbase.cpp \
Variant/VariantArray.cpp \
Variant/VariantBlob.cpp \
@ -156,79 +166,25 @@ libavocadodb_a_SOURCES = \
Variant/VariantUInt64.cpp \
Variant/VariantUInt8.cpp \
Variant/VariantVector.cpp \
VocBase/data-feeder.c \
VocBase/join-execute.c \
VocBase/order.c \
VocBase/blob-collection.c \
VocBase/collection.c \
VocBase/compactor.c \
VocBase/data-feeder.c \
VocBase/datafile.c \
VocBase/document-collection.c \
VocBase/fluent-query.c \
VocBase/select-result.c \
VocBase/join.c \
VocBase/query.c \
VocBase/headers.c \
VocBase/index.c \
VocBase/join-execute.c \
VocBase/join.c \
VocBase/order.c \
VocBase/query.c \
VocBase/result-set.c \
VocBase/select-result.c \
VocBase/simple-collection.c \
VocBase/synchroniser.c \
VocBase/voc-shaper.c \
VocBase/vocbase.c \
QL/ParserWrapper.cpp \
QL/ast-node.c \
QL/ast-query.c \
QL/error.c \
QL/formatter.c \
QL/javascripter.c \
QL/optimize.c \
QL/parser-context.c \
QL/parser.c \
QL/tokens.c
avocado_CPPFLAGS = \
$(AM_CPPFLAGS) \
@BOOST_CPPFLAGS@ \
@LIBEV_CPPFLAGS@ \
@MATH_CPPFLAGS@ \
@NCURSES_CPPFLAGS@ \
@OPENSSL_CPPFLAGS@ \
@READLINE_CPPFLAGS@ \
@V8_CPPFLAGS@
avocado_LDFLAGS = \
-L. \
@BOOST_LDFLAGS@ \
@LIBEV_LDFLAGS@ \
@MATH_LDFLAGS@ \
@NCURSES_LDFLAGS@ \
@OPENSSL_LDFLAGS@ \
@READLINE_LDFLAGS@ \
@V8_LDFLAGS@
avocado_LDADD = \
-lavocadodb \
@BOOST_LIBS@ \
@LIBEV_LIBS@ \
@MATH_LIBS@ \
@NCURSES_LIBS@ \
@OPENSSL_LIBS@ \
@READLINE_LIBS@ \
@V8_LIBS@
avocado_DEPENDENCIES = @builddir@/libavocadodb.a
avocado_SOURCES = \
RestHandler/RestActionHandler.cpp \
RestHandler/RestDocumentHandler.cpp \
RestHandler/RestSystemActionHandler.cpp \
RestHandler/RestVocbaseBaseHandler.cpp \
RestServer/ActionDispatcherThread.cpp \
RestServer/AvocadoHttpServer.cpp \
RestServer/AvocadoServer.cpp \
RestServer/JSLoader.cpp \
RestServer/SystemActionDispatcherThread.cpp \
RestServer/avocado.cpp
VocBase/vocbase.c
################################################################################
## JavaScript source code as header
@ -243,7 +199,6 @@ JAVASCRIPT_HEADER = \
js/server/js-json.h \
js/server/js-shell.h
BUILT_SOURCES += $(JAVASCRIPT_HEADER)
################################################################################

File diff suppressed because it is too large Load Diff

View File

@ -1348,9 +1348,7 @@ bool TRI_ParseArgumentsProgramOptions (TRI_program_options_t * options,
int argc,
char ** argv) {
extern char *optarg;
extern int opterr;
extern int optind;
extern int optopt;
TRI_string_buffer_t buffer;
TRI_PO_item_t * item;

View File

@ -208,6 +208,32 @@ QL_ast_node_type_group_e QLAstNodeGetTypeGroup (const QL_ast_node_type_e type) {
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief get the reverse of a relational operator
////////////////////////////////////////////////////////////////////////////////
QL_ast_node_type_e QLAstNodeGetReversedRelationalOperator (const QL_ast_node_type_e type) {
if (type == QLNodeBinaryOperatorIdentical ||
type == QLNodeBinaryOperatorEqual ||
type == QLNodeBinaryOperatorUnidentical ||
type == QLNodeBinaryOperatorUnequal) {
return type;
}
if (type == QLNodeBinaryOperatorLess) {
return QLNodeBinaryOperatorGreaterEqual;
}
if (type == QLNodeBinaryOperatorLessEqual) {
return QLNodeBinaryOperatorGreater;
}
if (type == QLNodeBinaryOperatorGreater) {
return QLNodeBinaryOperatorLessEqual;
}
if (type == QLNodeBinaryOperatorGreaterEqual) {
return QLNodeBinaryOperatorLess;
}
assert(false);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief get the label string for a unary operator
////////////////////////////////////////////////////////////////////////////////

View File

@ -169,6 +169,12 @@ const char* QLAstNodeGetName (const QL_ast_node_type_e);
QL_ast_node_type_group_e QLAstNodeGetTypeGroup (const QL_ast_node_type_e);
////////////////////////////////////////////////////////////////////////////////
/// @brief get the reverse of a relational operator
////////////////////////////////////////////////////////////////////////////////
QL_ast_node_type_e QLAstNodeGetReversedRelationalOperator (const QL_ast_node_type_e);
////////////////////////////////////////////////////////////////////////////////
/// @brief get the label string for a unary operator
////////////////////////////////////////////////////////////////////////////////

View File

@ -158,6 +158,22 @@ bool QLAstQueryIsValidAlias (QL_ast_query_t* query, const char* alias) {
return (0 != TRI_LookupByKeyAssociativePointer(&query->_from._collections, alias));
}
////////////////////////////////////////////////////////////////////////////////
/// @brief Return the collection name for its alias
////////////////////////////////////////////////////////////////////////////////
char* QLAstQueryGetCollectionNameForAlias (QL_ast_query_t* query,
const char* alias) {
QL_ast_query_collection_t* collection;
collection = (QL_ast_query_collection_t*)
TRI_LookupByKeyAssociativePointer(&query->_from._collections, alias);
if (!collection) {
return NULL;
}
return collection->_name;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief Add a collection to the query
////////////////////////////////////////////////////////////////////////////////

View File

@ -214,6 +214,12 @@ void QLAstQueryAddRefCount (QL_ast_query_t*, const char*);
bool QLAstQueryIsValidAlias (QL_ast_query_t*, const char*);
////////////////////////////////////////////////////////////////////////////////
/// @brief Return the collection name for its alias
////////////////////////////////////////////////////////////////////////////////
char* QLAstQueryGetCollectionNameForAlias (QL_ast_query_t*, const char*);
////////////////////////////////////////////////////////////////////////////////
/// @brief Add a collection to the query
////////////////////////////////////////////////////////////////////////////////

View File

@ -208,6 +208,46 @@ double QLOptimizeGetDouble (const QL_ast_node_t const* node) {
return 0.0;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief check if a document declaration is static or dynamic
////////////////////////////////////////////////////////////////////////////////
bool QLOptimizeIsStaticDocument (QL_ast_node_t* node) {
bool result;
if (node->_next) {
while (node->_next) {
result = QLOptimizeIsStaticDocument(node->_next);
if (!result) {
return false;
}
node = node->_next;
}
return true;
}
if (node->_lhs) {
result = QLOptimizeIsStaticDocument(node->_lhs);
if (!result) {
return false;
}
}
if (node->_rhs) {
result = QLOptimizeIsStaticDocument(node->_rhs);
if (!result) {
return false;
}
}
if (node->_type == QLNodeReferenceCollectionAlias ||
node->_type == QLNodeControlFunctionCall ||
node->_type == QLNodeControlTernary ||
node->_type == QLNodeContainerMemberAccess) {
return false;
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief convert a node to a null value node
////////////////////////////////////////////////////////////////////////////////
@ -870,6 +910,10 @@ void QLOptimizeFreeRangeVector (TRI_vector_pointer_t* vector) {
if (range->_field) {
TRI_Free(range->_field);
}
if (range->_refValue._field) {
TRI_FreeString(range->_refValue._field);
}
TRI_Free(range);
}
@ -922,9 +966,20 @@ static TRI_vector_pointer_t* QLOptimizeCombineRanges (const QL_ast_node_type_e t
}
}
previous = QLOptimizeGetRangeByHash(range->_hash, vector);
if (type == QLNodeBinaryOperatorOr) {
// only use logical || operator for same field. if field name differs, an ||
// effectively kills all ranges
if (vector->_length >0 && !previous) {
QLOptimizeFreeRangeVector(vector);
TRI_InitVectorPointer(vector);
goto EXIT;
}
}
if (!previous) {
// push range on stack
// push range into result vector
TRI_PushBackVectorPointer(vector, range);
// remove range from original vector to avoid double freeing
@ -1298,6 +1353,7 @@ static QL_optimize_range_t* QLOptimizeCreateRange (QL_ast_node_t* memberNode,
QL_optimize_range_t* range;
TRI_string_buffer_t* name;
QL_ast_node_t* lhs;
QL_javascript_conversion_t* documentJs;
// get the field name
name = QLOptimizeGetMemberNameString(memberNode, false);
@ -1313,6 +1369,9 @@ static QL_optimize_range_t* QLOptimizeCreateRange (QL_ast_node_t* memberNode,
return NULL;
}
range->_refValue._field = NULL;
range->_refValue._collection = NULL;
// get value
if (valueNode->_type == QLNodeValueNumberDouble ||
valueNode->_type == QLNodeValueNumberDoubleString) {
@ -1322,7 +1381,13 @@ static QL_optimize_range_t* QLOptimizeCreateRange (QL_ast_node_t* memberNode,
else if (valueNode->_type == QLNodeValueString) {
// range is of type string
range->_valueType = RANGE_TYPE_STRING;
}
}
else if (valueNode->_type == QLNodeValueDocument) {
range->_valueType = RANGE_TYPE_JSON;
}
else if (valueNode->_type == QLNodeContainerMemberAccess) {
range->_valueType = RANGE_TYPE_FIELD;
}
else {
assert(false);
}
@ -1340,14 +1405,37 @@ static QL_optimize_range_t* QLOptimizeCreateRange (QL_ast_node_t* memberNode,
if (type == QLNodeBinaryOperatorIdentical ||
type == QLNodeBinaryOperatorEqual) {
// === and == , range is [ value (inc) ... value (inc) ]
if (range->_valueType == RANGE_TYPE_DOUBLE) {
if (range->_valueType == RANGE_TYPE_FIELD) {
range->_refValue._collection =
((QL_ast_node_t*) valueNode->_lhs)->_value._stringValue;
name = QLOptimizeGetMemberNameString(valueNode, false);
if (name) {
range->_refValue._field = TRI_DuplicateString(name->_buffer);
TRI_FreeStringBuffer(name);
TRI_Free(name);
}
}
else if (range->_valueType == RANGE_TYPE_DOUBLE) {
range->_minValue._doubleValue = QLOptimizeGetDouble(valueNode);
range->_maxValue._doubleValue = range->_minValue._doubleValue;
}
else if (range->_valueType == RANGE_TYPE_STRING) {
else if (range->_valueType == RANGE_TYPE_STRING) {
range->_minValue._stringValue = valueNode->_value._stringValue;
range->_maxValue._stringValue = range->_minValue._stringValue;
}
else if (range->_valueType == RANGE_TYPE_JSON) {
documentJs = QLJavascripterInit();
if (!documentJs) {
TRI_FreeStringBuffer(name);
TRI_Free(name);
TRI_Free(range);
return NULL;
}
QLJavascripterConvert(documentJs, valueNode);
range->_minValue._stringValue = documentJs->_buffer->_buffer;
range->_maxValue._stringValue = range->_minValue._stringValue;
QLJavascripterFree(documentJs);
}
range->_minStatus = RANGE_VALUE_INCLUDED;
range->_maxStatus = RANGE_VALUE_INCLUDED;
}
@ -1449,19 +1537,43 @@ TRI_vector_pointer_t* QLOptimizeCondition (QL_ast_node_t* node) {
type == QLNodeBinaryOperatorLessEqual ||
type == QLNodeBinaryOperatorGreaterEqual) {
// comparison operator
if (lhs->_type == QLNodeContainerMemberAccess &&
rhs->_type == QLNodeContainerMemberAccess) {
// collection.attribute relop collection.attribute
return QLOptimizeMergeRangeVectors(
QLOptimizeCreateRangeVector(QLOptimizeCreateRange(lhs, rhs, type)),
QLOptimizeCreateRangeVector(QLOptimizeCreateRange(rhs, lhs, type))
);
}
else if (lhs->_type == QLNodeContainerMemberAccess &&
(type == QLNodeBinaryOperatorIdentical ||
type == QLNodeBinaryOperatorEqual) &&
rhs->_type == QLNodeValueDocument &&
QLOptimizeIsStaticDocument(rhs)) {
// collection.attribute == document
return QLOptimizeCreateRangeVector(QLOptimizeCreateRange(lhs, rhs, type));
}
else if (lhs->_type == QLNodeContainerMemberAccess &&
(rhs->_type == QLNodeValueNumberDouble ||
rhs->_type == QLNodeValueNumberDoubleString ||
rhs->_type == QLNodeValueString)) {
// collection.attrbiute relop value
// collection.attribute relop value
return QLOptimizeCreateRangeVector(QLOptimizeCreateRange(lhs, rhs, type));
}
else if (rhs->_type == QLNodeContainerMemberAccess &&
(type == QLNodeBinaryOperatorIdentical ||
type == QLNodeBinaryOperatorEqual) &&
lhs->_type == QLNodeValueDocument &&
QLOptimizeIsStaticDocument(lhs)) {
// document == collection.attribute
return QLOptimizeCreateRangeVector(QLOptimizeCreateRange(rhs, lhs, type));
} else if (rhs->_type == QLNodeContainerMemberAccess &&
(lhs->_type == QLNodeValueNumberDouble ||
lhs->_type == QLNodeValueNumberDoubleString ||
lhs->_type == QLNodeValueString)) {
lhs->_type == QLNodeValueString)) {
// value relop collection.attrbiute
return QLOptimizeCreateRangeVector(QLOptimizeCreateRange(rhs, lhs, type));
return QLOptimizeCreateRangeVector(
QLOptimizeCreateRange(rhs, lhs, QLAstNodeGetReversedRelationalOperator(type)));
}
}
@ -1555,22 +1667,25 @@ void QLOptimizeDetermineIndexes (QL_ast_query_t* query) {
TRI_index_definition_t* indexDefinition;
QL_ast_node_t* node;
char* collectionName;
char* alias;
size_t i, j, k, matches;
size_t count = 0;
return;
node = (QL_ast_node_t*) query->_from._base->_next;
assert(node != 0);
// enum all collections used in query
while (node != 0) {
ranges = 0;
if (count++ == 0) {
collectionName = ((QL_ast_node_t*) node->_lhs)->_value._stringValue;
alias = ((QL_ast_node_t*) node->_rhs)->_value._stringValue;
ranges = QLOptimizeCondition(query->_where._base);
}
else {
collectionName = ((QL_ast_node_t*) ((QL_ast_node_t*) node->_lhs)->_lhs)->_value._stringValue;
alias = ((QL_ast_node_t*) ((QL_ast_node_t*) node->_lhs)->_rhs)->_value._stringValue;
}
// accessType = TABLE_SCAN;
@ -1578,6 +1693,7 @@ return;
if (ranges) {
indexDefinitions = TRI_GetCollectionIndexes(query->_vocbase, collectionName);
// enum all indexes
for (i = 0; i < indexDefinitions._length; i++) {
indexDefinition = (TRI_index_definition_t*) indexDefinitions._buffer[i];
@ -1585,8 +1701,8 @@ return;
for (j = 0 ; j < indexDefinition->_fields._length; j++) {
for (k = 0; k < ranges->_length; k++) {
range = (QL_optimize_range_t*) ranges->_buffer[k];
// check if collection is the same
if (strcmp(range->_collection, collectionName) != 0) {
// check if collection name matches
if (strcmp(range->_collection, alias) != 0) {
continue;
}
@ -1606,7 +1722,8 @@ return;
range->_minValue._doubleValue != range->_maxValue._doubleValue) {
continue;
}
if (range->_valueType == RANGE_TYPE_STRING &&
if ((range->_valueType == RANGE_TYPE_STRING ||
range->_valueType == RANGE_TYPE_JSON) &&
strcmp(range->_minValue._stringValue, range->_maxValue._stringValue) != 0) {
continue;
}

View File

@ -38,6 +38,7 @@
#include "QL/ast-query.h"
#include "QL/parser-context.h"
#include "QL/formatter.h"
#include "QL/javascripter.h"
#include "VocBase/index.h"
#ifdef __cplusplus
@ -98,12 +99,16 @@ QL_optimize_range_type_e;
////////////////////////////////////////////////////////////////////////////////
/// @brief Range value types
///
/// Currently supported types are doubles (numbers) and strings
/// Currently supported types are collection attributes (fields), doubles
/// (numbers), strings, and JSON documents.
////////////////////////////////////////////////////////////////////////////////
typedef enum {
RANGE_TYPE_DOUBLE = 0,
RANGE_TYPE_STRING = 1
RANGE_TYPE_FIELD = 1,
RANGE_TYPE_DOUBLE = 2,
RANGE_TYPE_STRING = 3,
RANGE_TYPE_JSON = 4
}
QL_optimize_range_value_type_e;
@ -146,6 +151,10 @@ typedef struct QL_optimize_range_s {
double _doubleValue;
char* _stringValue;
} _maxValue;
struct {
char* _collection;
char *_field;
} _refValue;
uint64_t _hash;
QL_optimize_range_type_e _minStatus;
QL_optimize_range_type_e _maxStatus;

View File

@ -7,12 +7,8 @@ effort to operate for the administrator.
## Compilation
1. Install Dependencies: V8, boost, libev
2. make setup
3. ./configure --with-boost=PATH_TO_BOOST --with-libev=PATH_TO_LIBEV --with-v8=PATH_TO_V8
4. make
5. create a directory `/var/lib/avocado` where you are allowed to read and write
6. "./avocado /var/lib/avocado" to start a REST server or "./avocado /var/lib/avocado --shell" for debugging
Please check the <a href="https://github.com/triAGENS/AvocadoDB/wiki">wiki</a>
for installation and compilation instructions:
### Mac OS X Hints
@ -28,3 +24,11 @@ This will install AvocadoDB and all dependencies.
avocado> db.examples.count();
avocado> db.examples.save({ Hallo: "World" });
avocado> db.examples.select();
## Caveat
Please note that this is a very early version if AvocadoDB. There will be
bugs and we'd realy appreciate it if you
<a href="https://github.com/triAGENS/AvocadoDB/issues">report</a> them:
https://github.com/triAGENS/AvocadoDB/issues

View File

@ -142,6 +142,10 @@ namespace triagens {
void ShutdownRest () {
#ifdef TRI_HAVE_POSIX_THREADS
opensslCleanup();
#endif
TRI_ShutdownUrl();
TRIAGENS_BASICS_SHUTDOWN;

View File

@ -408,7 +408,6 @@ void AvocadoServer::buildApplicationServer () {
if (! ok) {
LOGGER_FATAL << "cannot create action directory '" << pathString << "': " << TRI_last_error();
cerr << "cannot create action directory '" << pathString << "': " << TRI_last_error() << "\n";
LOGGER_INFO << "please use the '--database.directory' option";
exit(EXIT_FAILURE);
}

View File

@ -36,7 +36,7 @@
namespace triagens {
namespace basics {
class StringBuffer;
struct StringBuffer;
}
namespace rest {

View File

@ -413,7 +413,7 @@ static TRI_fluent_query_t* ExtractFluentQuery (v8::Handle<v8::Object> queryObjec
TRI_vocbase_col_t const* collection = LoadCollection(queryObject, err);
if (collection == 0) {
return false;
return 0;
}
TRI_fluent_query_t* query = TRI_CreateCollectionQuery(collection);

View File

@ -1104,7 +1104,7 @@ static TRI_json_t* JsonHashIndex (TRI_index_t* idx, TRI_doc_collection_t* collec
TRI_json_t* json;
const TRI_shape_path_t* path;
TRI_hash_index_t* hashIndex;
char** fieldList;
char const** fieldList;
char* fieldCounter;
// ..........................................................................

View File

@ -321,10 +321,8 @@ static bool ToJavaScriptHashDocument (TRI_qry_select_t* s,
TRI_rc_result_t* result,
void* storage) {
TRI_doc_mptr_t masterPointer;
TRI_doc_mptr_t* document;
TRI_doc_collection_t* collection;
TRI_sim_collection_t* simCollection;
collection = result->_context->_primary;
@ -354,7 +352,6 @@ static bool ToJavaScriptHashDocument (TRI_qry_select_t* s,
static TRI_rc_result_t* NextHashCollectionCursor (TRI_rc_cursor_t* c) {
collection_cursor_t* cursor;
TRI_doc_collection_t* collection;
TRI_sim_collection_t* simCollection;
cursor = (collection_cursor_t*) c;
collection = cursor->base._context->_primary;

View File

@ -1667,7 +1667,7 @@ static bool CreateImmediateIndexes (TRI_sim_collection_t* collection,
ok = idx->insert(idx, header);
i < n ? idx : NULL;
// i < n ? idx : NULL;
if (! ok) {
result = false;
}

15
configure vendored
View File

@ -5277,8 +5277,21 @@ if test x$GCC == xyes; then
WALL="${WALL} -Werror"
fi
if test x$tr_DARWIN == xyes; then
WALL="${WALL} -Wno-deprecated-declarations"
fi
WALLC="${WALL} -Wshadow -Wstrict-prototypes -Wdeclaration-after-statement"
WALLCXX="${WALL} -Wstrict-null-sentinel -Woverloaded-virtual -Wno-variadic-macros"
WALLCXX="${WALL} -Woverloaded-virtual -Wno-variadic-macros"
case $CXX in
*clang++*)
;;
*)
WALLCXX="${WALLCXX} -Wstrict-null-sentinel"
;;
esac
if test x$tr_WEFFCXX == xyes; then
WALLCXX="${WALLCXX} -Weffc++"

520
js/tests/aql.js Normal file
View File

@ -0,0 +1,520 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief tests for "aql.js"
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief test suite
////////////////////////////////////////////////////////////////////////////////
function aqlTestSuite () {
var collection = null;
////////////////////////////////////////////////////////////////////////////////
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
function setUp () {
this.collection = db.UnitTestsNumbersList;
if (this.collection.count() == 0) {
for (var i = 0; i <= 20; i++) {
for (var j = 0; j <= i; j++) {
this.collection.save({ value1: i, value2: j, value3: i * j});
}
}
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
function tearDown () {
}
////////////////////////////////////////////////////////////////////////////////
/// @brief execute a given query
////////////////////////////////////////////////////////////////////////////////
function executeQuery (query) {
var aQuery = AQL_PREPARE(db, query);
if (aQuery) {
return aQuery.execute();
}
return aQuery;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief execute a given query and return the results as an array
////////////////////////////////////////////////////////////////////////////////
function getQueryResults (query) {
var aCursor = this.executeQuery(query);
if (aCursor) {
var results = [ ];
while (aCursor.hasNext()) {
results.push(aCursor.next());
}
return results;
}
return aCursor;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief assemble a query string from the parameters given
////////////////////////////////////////////////////////////////////////////////
function assembleQuery (value1, value2, limit) {
var query = 'SELECT { } FROM ' + this.collection._name + ' c WHERE ';
var cond = '';
if (value1 !== undefined) {
cond += value1;
}
if (value2 !== undefined) {
if (cond != '') {
cond += ' && ';
}
cond += value2;
}
query += cond;
if (limit !== undefined) {
query += ' LIMIT ' + limit;
}
print("Q: " + query);
return query;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief check the length of a query result set
////////////////////////////////////////////////////////////////////////////////
function checkLength (expected, value1, value2, limit) {
var query = this.assembleQuery(value1, value2, limit);
var result = this.getQueryResults(query);
assertTrue(result instanceof Array);
var actual = result.length;
assertEqual(expected, actual);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for a simple eq condition matches
////////////////////////////////////////////////////////////////////////////////
function testResultLengthsEqIndividual1 () {
for (i = 0; i <= 20; i++) {
this.checkLength(i + 1, 'c.value1 == ' + i);
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for a simple eq condition matches
////////////////////////////////////////////////////////////////////////////////
function testResultLengthsEqIndividual2 () {
for (i = 0; i <= 20; i++) {
this.checkLength(21 - i, undefined, 'c.value2 == ' + i);
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for combined eq conditions match
////////////////////////////////////////////////////////////////////////////////
function testResultLengthsEqCombined () {
for (i = 0; i <= 20; i++) {
for (j = 0; j <= i; j++) {
this.checkLength(1, 'c.value1 == ' + i, 'c.value2 == ' + j);
}
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for range queries matches
////////////////////////////////////////////////////////////////////////////////
function testResultLengthsBetweenIndividual1 () {
for (i = 0; i <= 20; i++) {
this.checkLength(i + 1, 'c.value1 >= ' + i, 'c.value1 <= ' + i);
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for (senseless) range queries matches
////////////////////////////////////////////////////////////////////////////////
function testResultLengthsBetweenIndividual2 () {
for (i = 0; i <= 20; i++) {
this.checkLength(0, 'c.value1 > ' + i, 'c.value1 < ' + i);
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for single-range queries matches
////////////////////////////////////////////////////////////////////////////////
function testResultLengthsLessIndividual1 () {
var expected = 0;
for (i = 0; i <= 20; i++) {
for (var j = 0; j <= i; j++, expected++);
this.checkLength(expected, 'c.value1 <= ' + i);
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for range queries matches
////////////////////////////////////////////////////////////////////////////////
function testResultLengthsLessIndividual2 () {
var expected = 0;
for (i = 0; i <= 20; i++) {
expected += 21 - i;
this.checkLength(expected, 'c.value2 <= ' + i);
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for out-of-range queries is 0
////////////////////////////////////////////////////////////////////////////////
function testNonResultsIndividual1 () {
this.checkLength(0, 'c.value1 < 0');
this.checkLength(0, 'c.value1 <= -0.01');
this.checkLength(0, 'c.value1 < -0.1');
this.checkLength(0, 'c.value1 <= -0.1');
this.checkLength(0, 'c.value1 <= -1');
this.checkLength(0, 'c.value1 <= -1.0');
this.checkLength(0, 'c.value1 < -10');
this.checkLength(0, 'c.value1 <= -100');
this.checkLength(0, 'c.value1 == 21');
this.checkLength(0, 'c.value1 == 110');
this.checkLength(0, 'c.value1 == 20.001');
this.checkLength(0, 'c.value1 > 20');
this.checkLength(0, 'c.value1 >= 20.01');
this.checkLength(0, 'c.value1 > 100');
this.checkLength(0, 'c.value1 >= 100');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for out-of-range queries is 0
////////////////////////////////////////////////////////////////////////////////
function testNonResultsIndividual2 () {
this.checkLength(0, 'c.value2 < 0');
this.checkLength(0, 'c.value2 <= -0.01');
this.checkLength(0, 'c.value2 < -0.1');
this.checkLength(0, 'c.value2 <= -0.1');
this.checkLength(0, 'c.value2 <= -1');
this.checkLength(0, 'c.value2 <= -1.0');
this.checkLength(0, 'c.value2 < -10');
this.checkLength(0, 'c.value2 <= -100');
this.checkLength(0, 'c.value2 == 21');
this.checkLength(0, 'c.value2 === 21');
this.checkLength(0, 'c.value2 == 110');
this.checkLength(0, 'c.value2 == 20.001');
this.checkLength(0, 'c.value2 > 20');
this.checkLength(0, 'c.value2 >= 20.01');
this.checkLength(0, 'c.value2 > 100');
this.checkLength(0, 'c.value2 >= 100');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for out-of-range queries is 0
////////////////////////////////////////////////////////////////////////////////
function testNonResultsCombined () {
this.checkLength(0, 'c.value1 > 0', 'c.value2 > 20');
this.checkLength(0, 'c.value1 >= 0', 'c.value2 > 20');
this.checkLength(0, 'c.value1 < 0', 'c.value2 > 0');
this.checkLength(0, 'c.value1 < 0', 'c.value2 >= 0');
this.checkLength(0, 'c.value1 == 21', 'c.value2 == 0');
this.checkLength(0, 'c.value1 == 21', 'c.value2 == 1');
this.checkLength(0, 'c.value1 == 21', 'c.value2 >= 0');
this.checkLength(0, 'c.value1 == 1', 'c.value2 == 21');
this.checkLength(0, 'c.value1 == 0', 'c.value2 == 21');
this.checkLength(0, 'c.value1 >= 0', 'c.value2 == 21');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for (illogical) ranges is 0
////////////////////////////////////////////////////////////////////////////////
function testNonResultsIllogical () {
this.checkLength(0, 'c.value1 > 0', 'c.value1 > 20');
this.checkLength(0, 'c.value1 >= 0', 'c.value1 > 20');
this.checkLength(0, 'c.value1 == 0', 'c.value1 > 20');
this.checkLength(0, 'c.value1 === 0', 'c.value1 > 20');
this.checkLength(0, 'c.value1 !== 0', 'c.value1 > 20');
this.checkLength(0, 'c.value1 != 0', 'c.value1 > 20');
this.checkLength(0, 'c.value1 > 20', 'c.value1 > 0');
this.checkLength(0, 'c.value1 > 20', 'c.value1 >= 0');
this.checkLength(0, 'c.value1 >= 21', 'c.value1 > 0');
this.checkLength(0, 'c.value1 >= 21', 'c.value1 >= 0');
this.checkLength(0, 'c.value1 >= 21', 'c.value1 == 0');
this.checkLength(0, 'c.value1 >= 21', 'c.value1 === 0');
this.checkLength(0, 'c.value1 >= 21', 'c.value1 !== 0');
this.checkLength(0, 'c.value1 >= 21', 'c.value1 != 0');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for limit queries matches
////////////////////////////////////////////////////////////////////////////////
function testLimitNonOffset1 () {
this.checkLength(0, 'c.value1 == 0', undefined, '0');
this.checkLength(0, 'c.value1 == 0', undefined, '0,0');
this.checkLength(1, 'c.value1 == 0', undefined, '1');
this.checkLength(1, 'c.value1 == 0', undefined, '2');
this.checkLength(1, 'c.value1 == 0', undefined, '3');
this.checkLength(1, 'c.value1 == 0', undefined, '0,1');
this.checkLength(1, 'c.value1 == 0', undefined, '0,2');
this.checkLength(1, 'c.value1 == 0', undefined, '0,3');
this.checkLength(1, 'c.value1 == 0', undefined, '0,-1');
this.checkLength(1, 'c.value1 == 0', undefined, '0,-2');
this.checkLength(1, 'c.value1 == 0', undefined, '0,-3');
this.checkLength(1, 'c.value1 == 0', undefined, '-1');
this.checkLength(1, 'c.value1 == 0', undefined, '-2');
this.checkLength(1, 'c.value1 == 0', undefined, '-3');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for limit queries w/ offset matches
////////////////////////////////////////////////////////////////////////////////
function testLimitOffset1 () {
this.checkLength(0, 'c.value1 == 0', undefined, '1,1');
this.checkLength(0, 'c.value1 == 0', undefined, '1,-1');
this.checkLength(0, 'c.value1 == 0', undefined, '1,0');
this.checkLength(0, 'c.value1 == 0', undefined, '1,2');
this.checkLength(0, 'c.value1 == 0', undefined, '1,-2');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for limit queries matches
////////////////////////////////////////////////////////////////////////////////
function testLimitNonOffset2 () {
this.checkLength(0, 'c.value1 == 3', undefined, '0');
this.checkLength(0, 'c.value1 == 3', undefined, '0,0');
this.checkLength(1, 'c.value1 == 3', undefined, '1');
this.checkLength(2, 'c.value1 == 3', undefined, '2');
this.checkLength(3, 'c.value1 == 3', undefined, '3');
this.checkLength(1, 'c.value1 == 3', undefined, '0,1');
this.checkLength(2, 'c.value1 == 3', undefined, '0,2');
this.checkLength(3, 'c.value1 == 3', undefined, '0,3');
this.checkLength(1, 'c.value1 == 3', undefined, '0,-1');
this.checkLength(2, 'c.value1 == 3', undefined, '0,-2');
this.checkLength(3, 'c.value1 == 3', undefined, '0,-3');
this.checkLength(1, 'c.value1 == 3', undefined, '-1');
this.checkLength(2, 'c.value1 == 3', undefined, '-2');
this.checkLength(3, 'c.value1 == 3', undefined, '-3');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for limit queries w/ offset matches
////////////////////////////////////////////////////////////////////////////////
function testLimitOffset2 () {
this.checkLength(1, 'c.value1 == 3', undefined, '1,1');
this.checkLength(1, 'c.value1 == 3', undefined, '1,-1');
this.checkLength(0, 'c.value1 == 3', undefined, '1,0');
this.checkLength(2, 'c.value1 == 3', undefined, '1,2');
this.checkLength(3, 'c.value1 == 3', undefined, '1,3');
this.checkLength(2, 'c.value1 == 3', undefined, '1,-2');
this.checkLength(3, 'c.value1 == 3', undefined, '1,-3');
this.checkLength(2, 'c.value1 == 3', undefined, '2,2');
this.checkLength(2, 'c.value1 == 3', undefined, '2,3');
this.checkLength(2, 'c.value1 == 3', undefined, '2,-2');
this.checkLength(2, 'c.value1 == 3', undefined, '2,-3');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for limit queries matches
////////////////////////////////////////////////////////////////////////////////
function testLimitNonOffset3 () {
this.checkLength(0, 'c.value1 == 10', undefined, '0');
this.checkLength(10, 'c.value1 == 10', undefined, '10');
this.checkLength(10, 'c.value1 == 10', undefined, '0,10');
this.checkLength(11, 'c.value1 == 10', undefined, '0,11');
this.checkLength(11, 'c.value1 == 10', undefined, '0,12');
this.checkLength(11, 'c.value1 == 10', undefined, '0,100');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for limit queries w/ offset matches
////////////////////////////////////////////////////////////////////////////////
function testLimitOffset3 () {
this.checkLength(10, 'c.value1 == 10', undefined, '1,10');
this.checkLength(10, 'c.value1 == 10', undefined, '1,100');
this.checkLength(10, 'c.value1 == 10', undefined, '1,-10');
this.checkLength(10, 'c.value1 == 10', undefined, '1,-100');
this.checkLength(9, 'c.value1 == 10', undefined, '2,10');
this.checkLength(9, 'c.value1 == 10', undefined, '2,11');
this.checkLength(1, 'c.value1 == 10', undefined, '10,10');
this.checkLength(1, 'c.value1 == 10', undefined, '10,-10');
this.checkLength(0, 'c.value1 == 10', undefined, '100,1');
this.checkLength(0, 'c.value1 == 10', undefined, '100,10');
this.checkLength(0, 'c.value1 == 10', undefined, '100,100');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if the number of results for some prefab queries matches
////////////////////////////////////////////////////////////////////////////////
function testMixedQueries () {
this.checkLength(175,'c.value1 != 0', 'c.value2 < 11');
this.checkLength(0,'c.value1 < 0', 'c.value2 > 14');
this.checkLength(0,'c.value1 === 0', 'c.value2 === 18');
this.checkLength(0,'c.value1 < 0', 'c.value2 >= 19');
this.checkLength(1,'c.value1 == 0', 'c.value2 != 2');
this.checkLength(0,'c.value1 < 0', 'c.value2 == 3');
this.checkLength(0,'c.value1 <= 0', 'c.value2 > 4');
this.checkLength(111,'c.value1 >= 0', 'c.value2 < 6');
this.checkLength(7,'c.value1 > 10', 'c.value2 == 14');
this.checkLength(7,'c.value1 != 10', 'c.value2 === 14');
this.checkLength(11,'c.value1 == 10', 'c.value2 != 19');
this.checkLength(3,'c.value1 == 10', 'c.value2 <= 2');
this.checkLength(3,'c.value1 < 10', 'c.value2 === 7');
this.checkLength(12,'c.value1 != 10', 'c.value2 == 8');
this.checkLength(50,'c.value1 >= 11', 'c.value2 < 5');
this.checkLength(6,'c.value1 === 11', 'c.value2 < 6');
this.checkLength(10,'c.value1 != 12', 'c.value2 === 10');
this.checkLength(132,'c.value1 > 12', 'c.value2 != 12');
this.checkLength(13,'c.value1 === 12', 'c.value2 != 14');
this.checkLength(0,'c.value1 === 12', 'c.value2 == 15');
this.checkLength(0,'c.value1 <= 12', 'c.value2 > 18');
this.checkLength(204,'c.value1 != 12', 'c.value2 != 6');
this.checkLength(91,'c.value1 > 13', 'c.value2 <= 12');
this.checkLength(0,'c.value1 == 13', 'c.value2 >= 17');
this.checkLength(39,'c.value1 <= 13', 'c.value2 < 3');
this.checkLength(21,'c.value1 < 13', 'c.value2 >= 7');
this.checkLength(15,'c.value1 == 14', 'c.value2 != 17');
this.checkLength(3,'c.value1 > 14', 'c.value2 == 18');
this.checkLength(1,'c.value1 != 14', 'c.value2 >= 20');
this.checkLength(119,'c.value1 >= 14', 'c.value2 != 6');
this.checkLength(15,'c.value1 == 15', 'c.value2 != 3');
this.checkLength(45,'c.value1 <= 15', 'c.value2 > 6');
this.checkLength(7,'c.value1 == 15', 'c.value2 < 7');
this.checkLength(99,'c.value1 < 15', 'c.value2 <= 8');
this.checkLength(54,'c.value1 >= 15', 'c.value2 <= 8');
this.checkLength(1,'c.value1 === 16', 'c.value2 == 3');
this.checkLength(16,'c.value1 === 16', 'c.value2 != 6');
this.checkLength(152,'c.value1 < 17', 'c.value2 != 16');
this.checkLength(6,'c.value1 >= 17', 'c.value2 > 17');
this.checkLength(16,'c.value1 <= 17', 'c.value2 === 2');
this.checkLength(33,'c.value1 < 17', 'c.value2 < 2');
this.checkLength(9,'c.value1 <= 18', 'c.value2 === 10');
this.checkLength(205,'c.value1 != 18', 'c.value2 != 13');
this.checkLength(171,'c.value1 < 18', 'c.value2 != 20');
this.checkLength(0,'c.value1 === 18', 'c.value2 > 20');
this.checkLength(161,'c.value1 < 18', 'c.value2 != 8');
this.checkLength(2,'c.value1 > 18', 'c.value2 === 8');
this.checkLength(1,'c.value1 == 19', 'c.value2 === 15');
this.checkLength(2,'c.value1 >= 19', 'c.value2 == 18');
this.checkLength(178,'c.value1 < 19', 'c.value2 != 7');
this.checkLength(7,'c.value1 > 1', 'c.value2 == 14');
this.checkLength(213,'c.value1 > 1', 'c.value2 <= 15');
this.checkLength(1,'c.value1 > 1', 'c.value2 == 20');
this.checkLength(0,'c.value1 == 1', 'c.value2 === 5');
this.checkLength(55,'c.value1 <= 20', 'c.value2 > 10');
this.checkLength(5,'c.value1 >= 20', 'c.value2 >= 16');
this.checkLength(0,'c.value1 != 20', 'c.value2 === 20');
this.checkLength(9,'c.value1 == 20', 'c.value2 <= 8');
this.checkLength(10,'c.value1 >= 20', 'c.value2 <= 9');
this.checkLength(3,'c.value1 > 2', 'c.value2 == 18');
this.checkLength(10,'c.value1 <= 3', 'c.value2 <= 15');
this.checkLength(6,'c.value1 < 3', 'c.value2 != 4');
this.checkLength(17,'c.value1 != 3', 'c.value2 == 4');
this.checkLength(208,'c.value1 > 3', 'c.value2 != 8');
this.checkLength(188,'c.value1 > 4', 'c.value2 <= 13');
this.checkLength(0,'c.value1 < 4', 'c.value2 === 4');
this.checkLength(101,'c.value1 >= 4', 'c.value2 <= 5');
this.checkLength(0,'c.value1 == 4', 'c.value2 > 7');
this.checkLength(205,'c.value1 != 5', 'c.value2 >= 1');
this.checkLength(150,'c.value1 >= 5', 'c.value2 < 10');
this.checkLength(6,'c.value1 === 5', 'c.value2 < 14');
this.checkLength(4,'c.value1 >= 5', 'c.value2 === 17');
this.checkLength(4,'c.value1 > 5', 'c.value2 === 17');
this.checkLength(0,'c.value1 <= 5', 'c.value2 == 18');
this.checkLength(1,'c.value1 === 5', 'c.value2 == 2');
this.checkLength(215,'c.value1 >= 5', 'c.value2 != 20');
this.checkLength(15,'c.value1 > 5', 'c.value2 == 3');
this.checkLength(202,'c.value1 >= 6', 'c.value2 != 13');
this.checkLength(3,'c.value1 >= 6', 'c.value2 >= 19');
this.checkLength(150,'c.value1 >= 6', 'c.value2 > 3');
this.checkLength(7,'c.value1 == 7', 'c.value2 > 0');
this.checkLength(55,'c.value1 >= 7', 'c.value2 >= 11');
this.checkLength(55,'c.value1 != 7', 'c.value2 >= 11');
this.checkLength(0,'c.value1 <= 7', 'c.value2 == 16');
this.checkLength(0,'c.value1 == 7', 'c.value2 == 20');
this.checkLength(203,'c.value1 >= 7', 'c.value2 <= 20');
this.checkLength(5,'c.value1 <= 7', 'c.value2 === 3');
this.checkLength(14,'c.value1 >= 7', 'c.value2 === 5');
this.checkLength(36,'c.value1 <= 7', 'c.value2 <= 7');
this.checkLength(174,'c.value1 > 8', 'c.value2 != 1');
this.checkLength(9,'c.value1 === 8', 'c.value2 != 10');
this.checkLength(167,'c.value1 != 8', 'c.value2 < 11');
this.checkLength(9,'c.value1 === 8', 'c.value2 < 14');
this.checkLength(0,'c.value1 <= 8', 'c.value2 == 20');
this.checkLength(0,'c.value1 == 8', 'c.value2 >= 9');
this.checkLength(4,'c.value1 >= 9', 'c.value2 === 17');
this.checkLength(55,'c.value1 <= 9', 'c.value2 <= 18');
this.checkLength(48,'c.value1 >= 9', 'c.value2 <= 3');
this.checkLength(12,'c.value1 >= 9', 'c.value2 == 5');
this.checkLength(2,'c.value1 <= 9', 'c.value2 == 8');
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief executes the test suite
////////////////////////////////////////////////////////////////////////////////
jsUnity.run(aqlTestSuite);
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
// End:

View File

@ -87,8 +87,21 @@ if test x$GCC == xyes; then
WALL="${WALL} -Werror"
fi
if test x$tr_DARWIN == xyes; then
WALL="${WALL} -Wno-deprecated-declarations"
fi
WALLC="${WALL} -Wshadow -Wstrict-prototypes -Wdeclaration-after-statement"
WALLCXX="${WALL} -Wstrict-null-sentinel -Woverloaded-virtual -Wno-variadic-macros"
WALLCXX="${WALL} -Woverloaded-virtual -Wno-variadic-macros"
case $CXX in
*clang++*)
;;
*)
WALLCXX="${WALLCXX} -Wstrict-null-sentinel"
;;
esac
if test x$tr_WEFFCXX == xyes; then
WALLCXX="${WALLCXX} -Weffc++"