From 8e9905b6a3300d8d401375d4360759c12de6b4c9 Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 25 Dec 2012 23:24:07 +0700 Subject: [PATCH] #16 --- Changelog | 5 +++++ package.json | 2 +- tcejdb/configure | 20 ++++++++++---------- tcejdb/configure.ac | 4 ++-- tcejdb/ejdb.c | 2 +- tcejdb/testejdb/t2.c | 15 +++++++++++++-- 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/Changelog b/Changelog index bb8fa0c..68ffb7c 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,8 @@ +2012-12-26 Anton Adamansky. + * Fixed crash on collection remove (ticket: #18) + * Incorrect dropping of all field indexes (ticket: #16) + - Release 1.0.35 + 2012-12-25 Anton Adamansky. * Nodejs database cursors more GC friendly - Release 1.0.34 diff --git a/package.json b/package.json index 5dad40b..a258e2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name" : "ejdb", - "version" : "1.0.34", + "version" : "1.0.35", "main" : "node/ejdb.js", "homepage" : "http://ejdb.org", "description" : "EJDB - Embedded JSON Database engine", diff --git a/tcejdb/configure b/tcejdb/configure index fbc5a5b..7d32ccd 100755 --- a/tcejdb/configure +++ b/tcejdb/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for tcejdb 1.0.34. +# Generated by GNU Autoconf 2.69 for tcejdb 1.0.35. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tcejdb' PACKAGE_TARNAME='tcejdb' -PACKAGE_VERSION='1.0.34' -PACKAGE_STRING='tcejdb 1.0.34' +PACKAGE_VERSION='1.0.35' +PACKAGE_STRING='tcejdb 1.0.35' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1257,7 +1257,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures tcejdb 1.0.34 to adapt to many kinds of systems. +\`configure' configures tcejdb 1.0.35 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1318,7 +1318,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of tcejdb 1.0.34:";; + short | recursive ) echo "Configuration of tcejdb 1.0.35:";; esac cat <<\_ACEOF @@ -1424,7 +1424,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -tcejdb configure 1.0.34 +tcejdb configure 1.0.35 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1722,7 +1722,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by tcejdb $as_me 1.0.34, which was +It was created by tcejdb $as_me 1.0.35, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2344,7 +2344,7 @@ fi # Messages printf '#================================================================\n' -printf '# Configuring Tokyo Cabinet version %s%s.\n' "$PACKAGE_VERSION" "$enables" +printf '# Configuring EJDB version %s%s.\n' "$PACKAGE_VERSION" "$enables" printf '#================================================================\n' @@ -4870,7 +4870,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by tcejdb $as_me 1.0.34, which was +This file was extended by tcejdb $as_me 1.0.35, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4923,7 +4923,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -tcejdb config.status 1.0.34 +tcejdb config.status 1.0.35 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/tcejdb/configure.ac b/tcejdb/configure.ac index 7e25966..5a19460 100644 --- a/tcejdb/configure.ac +++ b/tcejdb/configure.ac @@ -11,7 +11,7 @@ test -n "$CPPFLAGS" && MYCPPFLAGS="$CPPFLAGS $MYCPPFLAGS" test -n "$LDFLAGS" && MYLDFLAGS="$LDFLAGS $MYLDFLAGS" # Package name -AC_INIT(tcejdb, 1.0.34) +AC_INIT(tcejdb, 1.0.35) # Package information MYLIBVER=9 @@ -233,7 +233,7 @@ fi # Messages printf '#================================================================\n' -printf '# Configuring Tokyo Cabinet version %s%s.\n' "$PACKAGE_VERSION" "$enables" +printf '# Configuring EJDB version %s%s.\n' "$PACKAGE_VERSION" "$enables" printf '#================================================================\n' diff --git a/tcejdb/ejdb.c b/tcejdb/ejdb.c index e0ec698..32fc55f 100644 --- a/tcejdb/ejdb.c +++ b/tcejdb/ejdb.c @@ -579,7 +579,7 @@ EJDB_EXPORT bool ejdbsetindex(EJCOLL *jcoll, const char *fpath, int flags) { if (!idrop && oldiflags != flags) { //Update index meta bson imetadelta; bson_init(&imetadelta); - bson_append_int(&imetadelta, "iflags", flags); + bson_append_int(&imetadelta, "iflags", (flags | oldiflags)); bson_finish(&imetadelta); rv = _metasetbson2(jcoll, ikey, &imetadelta, true, true); bson_destroy(&imetadelta); diff --git a/tcejdb/testejdb/t2.c b/tcejdb/testejdb/t2.c index 121765e..7291cf0 100644 --- a/tcejdb/testejdb/t2.c +++ b/tcejdb/testejdb/t2.c @@ -3635,7 +3635,6 @@ void test$elemMatch() { tcxstrdel(log); ejdbquerydel(q1); - bson_init_as_query(&bsq1); bson_append_start_object(&bsq1, "complexarr"); bson_append_start_object(&bsq1, "$elemMatch"); @@ -3675,6 +3674,17 @@ void test$elemMatch() { ejdbquerydel(q1); } +void testTicket16() { + EJCOLL *coll = ejdbcreatecoll(jb, "abcd", NULL); + CU_ASSERT_PTR_NOT_NULL_FATAL(coll); + CU_ASSERT_EQUAL(coll->tdb->inum, 0); + CU_ASSERT_TRUE(ejdbsetindex(coll, "abcd", JBIDXISTR)); + CU_ASSERT_TRUE(ejdbsetindex(coll, "abcd", JBIDXNUM)); + CU_ASSERT_EQUAL(coll->tdb->inum, 2); + CU_ASSERT_TRUE(ejdbsetindex(coll, "abcd", JBIDXDROPALL)); + CU_ASSERT_EQUAL(coll->tdb->inum, 0); +} + int main() { setlocale(LC_ALL, "en_US.UTF-8"); @@ -3735,7 +3745,8 @@ int main() { (NULL == CU_add_test(pSuite, "test$addToSet", test$addToSet)) || (NULL == CU_add_test(pSuite, "test$pull", test$pull)) || (NULL == CU_add_test(pSuite, "testFindInComplexArray", testFindInComplexArray)) || - (NULL == CU_add_test(pSuite, "test$elemMatch", test$elemMatch)) + (NULL == CU_add_test(pSuite, "test$elemMatch", test$elemMatch)) || + (NULL == CU_add_test(pSuite, "testTicket16", testTicket16)) ) { CU_cleanup_registry(); return CU_get_error(); -- 2.7.4