RethinkDB driver for C++

Overview

RethinkDB driver for C++

This driver is compatible with RethinkDB 2.0. It is based on the official RethinkDB Python driver.

Example

14).run(*conn); for (R::Datum& user : cursor) { printf("%s\n", user.as_json().c_str()); } }">
#include 
   
    
#include 
    
     
#include 
     
      

namespace R = RethinkDB;

int main() {
  std::unique_ptr
      
        conn = R::connect("localhost", 28015);
  R::Cursor cursor = R::table("users").filter(R::row["age"] > 14).run(*conn);
  for (R::Datum& user : cursor) {
      printf("%s\n", user.as_json().c_str());
  }
}

      
     
    
   

Build

Requires a modern C++ compiler. to build and install, run:

make
make install

Will build include/rethinkdb.h, librethinkdb++.a and librethinkdb++.so into the build/ directory.

To include documentation from the Python driver in the header file, pass the following argument to make.

make INCLUDE_PYTHON_DOCS=yes

To build in debug mode:

make DEBUG=yes

To install to a specific location:

make install prefix=/usr/local DESTDIR=

Status

Still in early stages of development.

Tests

This driver is tested against the upstream ReQL tests from the RethinkDB repo, which are programmatically translated from Python to C++. As of 34dc13c, all tests pass:

$ make test
...
SUCCESS: 2053 tests passed
Comments
  • Crash when building with clang using libc++

    Crash when building with clang using libc++

    For a (private) project I'm working on I build using Clang with the libc++ standard library.

    To be able to link I need to use Clang and libc++ when building librethinkdb++ too. Building is not a problem, the problem comes when I try to run the code when I get a crash.

    Here is the simple example program I use to test this:

    #include <iostream>
    #include <rethinkdb.h>
    
    namespace R = RethinkDB;
    
    int main()
    {
        auto conn = R::connect();
        if (conn)
        {
            std::cout << "Connected\n" << std::flush;
            R::Cursor databases = R::db_list().run(*conn);
            for (R::Datum const& db : databases)
            {
                std::cout << *db.get_string() << '\n';
            }
        }
        else
        {
            std::cerr << "Could not connect to server\n";
        }
    
        return 0;
    }
    
    

    I build using the above program using the same flags as the library is, and link with the static library (static or shared doesn't matter):

    clang++ -stdlib=libc++ -ggdb -std=c++11 -I'build/gen' -Wall -pthread -fPIC list_databases.cpp  -o list_databases build/librethinkdb++.a
    

    When I run the program this happens:

    Connected
    *** Error in `./list_databases': double free or corruption (!prev): 0x000000000172a240 ***
    ======= Backtrace: =========
    /lib/x86_64-linux-gnu/libc.so.6(+0x70c8b)[0x7f9ef366dc8b]
    /lib/x86_64-linux-gnu/libc.so.6(+0x77066)[0x7f9ef3674066]
    /lib/x86_64-linux-gnu/libc.so.6(+0x7785e)[0x7f9ef367485e]
    ./list_databases[0x404f62]
    ./list_databases[0x404ba5]
    ./list_databases[0x457239]
    ./list_databases[0x455574]
    ./list_databases[0x404344]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f9ef361d2b1]
    ./list_databases[0x4036da]
    ======= Memory map: ========
    00400000-0046c000 r-xp 00000000 08:04 15074177                           /home/arrow/tmp/librethinkdbxx/list_databases
    0066b000-0066c000 r--p 0006b000 08:04 15074177                           /home/arrow/tmp/librethinkdbxx/list_databases
    0066c000-0066d000 rw-p 0006c000 08:04 15074177                           /home/arrow/tmp/librethinkdbxx/list_databases
    01728000-01749000 rw-p 00000000 00:00 0                                  [heap]
    7f9eec000000-7f9eec021000 rw-p 00000000 00:00 0 
    7f9eec021000-7f9ef0000000 ---p 00000000 00:00 0 
    7f9ef2f9c000-7f9ef2fa6000 r-xp 00000000 08:01 1570680                    /lib/x86_64-linux-gnu/libnss_files-2.24.so
    7f9ef2fa6000-7f9ef31a6000 ---p 0000a000 08:01 1570680                    /lib/x86_64-linux-gnu/libnss_files-2.24.so
    7f9ef31a6000-7f9ef31a7000 r--p 0000a000 08:01 1570680                    /lib/x86_64-linux-gnu/libnss_files-2.24.so
    7f9ef31a7000-7f9ef31a8000 rw-p 0000b000 08:01 1570680                    /lib/x86_64-linux-gnu/libnss_files-2.24.so
    7f9ef31a8000-7f9ef31ae000 rw-p 00000000 00:00 0 
    7f9ef31ae000-7f9ef31b5000 r-xp 00000000 08:01 1570696                    /lib/x86_64-linux-gnu/librt-2.24.so
    7f9ef31b5000-7f9ef33b4000 ---p 00007000 08:01 1570696                    /lib/x86_64-linux-gnu/librt-2.24.so
    7f9ef33b4000-7f9ef33b5000 r--p 00006000 08:01 1570696                    /lib/x86_64-linux-gnu/librt-2.24.so
    7f9ef33b5000-7f9ef33b6000 rw-p 00007000 08:01 1570696                    /lib/x86_64-linux-gnu/librt-2.24.so
    7f9ef33b6000-7f9ef33fb000 r-xp 00000000 08:01 150256                     /usr/local/lib/libc++abi.so.1.0
    7f9ef33fb000-7f9ef35fa000 ---p 00045000 08:01 150256                     /usr/local/lib/libc++abi.so.1.0
    7f9ef35fa000-7f9ef35fc000 r--p 00044000 08:01 150256                     /usr/local/lib/libc++abi.so.1.0
    7f9ef35fc000-7f9ef35fd000 rw-p 00046000 08:01 150256                     /usr/local/lib/libc++abi.so.1.0
    7f9ef35fd000-7f9ef3792000 r-xp 00000000 08:01 1570372                    /lib/x86_64-linux-gnu/libc-2.24.so
    7f9ef3792000-7f9ef3992000 ---p 00195000 08:01 1570372                    /lib/x86_64-linux-gnu/libc-2.24.so
    7f9ef3992000-7f9ef3996000 r--p 00195000 08:01 1570372                    /lib/x86_64-linux-gnu/libc-2.24.so
    7f9ef3996000-7f9ef3998000 rw-p 00199000 08:01 1570372                    /lib/x86_64-linux-gnu/libc-2.24.so
    7f9ef3998000-7f9ef399c000 rw-p 00000000 00:00 0 
    7f9ef399c000-7f9ef39b4000 r-xp 00000000 08:01 1570692                    /lib/x86_64-linux-gnu/libpthread-2.24.so
    7f9ef39b4000-7f9ef3bb3000 ---p 00018000 08:01 1570692                    /lib/x86_64-linux-gnu/libpthread-2.24.so
    7f9ef3bb3000-7f9ef3bb4000 r--p 00017000 08:01 1570692                    /lib/x86_64-linux-gnu/libpthread-2.24.so
    7f9ef3bb4000-7f9ef3bb5000 rw-p 00018000 08:01 1570692                    /lib/x86_64-linux-gnu/libpthread-2.24.so
    7f9ef3bb5000-7f9ef3bb9000 rw-p 00000000 00:00 0 
    7f9ef3bb9000-7f9ef3bcf000 r-xp 00000000 08:01 1569953                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f9ef3bcf000-7f9ef3dce000 ---p 00016000 08:01 1569953                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f9ef3dce000-7f9ef3dcf000 r--p 00015000 08:01 1569953                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f9ef3dcf000-7f9ef3dd0000 rw-p 00016000 08:01 1569953                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f9ef3dd0000-7f9ef3ed3000 r-xp 00000000 08:01 1570646                    /lib/x86_64-linux-gnu/libm-2.24.so
    7f9ef3ed3000-7f9ef40d2000 ---p 00103000 08:01 1570646                    /lib/x86_64-linux-gnu/libm-2.24.so
    7f9ef40d2000-7f9ef40d3000 r--p 00102000 08:01 1570646                    /lib/x86_64-linux-gnu/libm-2.24.so
    7f9ef40d3000-7f9ef40d4000 rw-p 00103000 08:01 1570646                    /lib/x86_64-linux-gnu/libm-2.24.so
    7f9ef40d4000-7f9ef418c000 r-xp 00000000 08:01 150463                     /usr/local/lib/libc++.so.1.0
    7f9ef418c000-7f9ef438c000 ---p 000b8000 08:01 150463                     /usr/local/lib/libc++.so.1.0
    7f9ef438c000-7f9ef4391000 r--p 000b8000 08:01 150463                     /usr/local/lib/libc++.so.1.0
    7f9ef4391000-7f9ef4392000 rw-p 000bd000 08:01 150463                     /usr/local/lib/libc++.so.1.0
    7f9ef4392000-7f9ef4395000 rw-p 00000000 00:00 0 
    7f9ef4395000-7f9ef43b8000 r-xp 00000000 08:01 1569970                    /lib/x86_64-linux-gnu/ld-2.24.so
    7f9ef4587000-7f9ef458b000 rw-p 00000000 00:00 0 
    7f9ef45b3000-7f9ef45b7000 rw-p 00000000 00:00 0 
    7f9ef45b7000-7f9ef45b8000 r--p 00022000 08:01 1569970                    /lib/x86_64-linux-gnu/ld-2.24.so
    7f9ef45b8000-7f9ef45b9000 rw-p 00023000 08:01 1569970                    /lib/x86_64-linux-gnu/ld-2.24.so
    7f9ef45b9000-7f9ef45ba000 rw-p 00000000 00:00 0 
    7fffe860c000-7fffe862d000 rw-p 00000000 00:00 0                          [stack]
    7fffe8726000-7fffe8729000 r--p 00000000 00:00 0                          [vvar]
    7fffe8729000-7fffe872b000 r-xp 00000000 00:00 0                          [vdso]
    ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
    fish: Job 2, “./list_databases” terminated by signal SIGABRT (Abort)
    

    Valgrind gives more details:

    ==29615== Memcheck, a memory error detector
    ==29615== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
    ==29615== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
    ==29615== Command: ./list_databases
    ==29615== 
    Connected
    ==29615== Invalid read of size 8
    ==29615==    at 0x457384: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1329)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Address 0x6038bb8 is 8 bytes inside a block of size 32 free'd
    ==29615==    at 0x4C2BDFB: free (vg_replace_malloc.c:530)
    ==29615==    by 0x457673: __deallocate (new:176)
    ==29615==    by 0x457673: deallocate (memory:1762)
    ==29615==    by 0x457673: deallocate (memory:1522)
    ==29615==    by 0x457673: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::deallocate() (vector:935)
    ==29615==    by 0x4572FE: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1327)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Block was alloc'd at
    ==29615==    at 0x4C2ABCF: malloc (vg_replace_malloc.c:299)
    ==29615==    by 0x4EBCA59: operator new(unsigned long) (in /usr/local/lib/libc++.so.1.0)
    ==29615==    by 0x40F170: __allocate (new:168)
    ==29615==    by 0x40F170: allocate (memory:1759)
    ==29615==    by 0x40F170: allocate (memory:1514)
    ==29615==    by 0x40F170: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::allocate(unsigned long) (vector:923)
    ==29615==    by 0x40EF7F: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::vector(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> > const&) (vector:1197)
    ==29615==    by 0x40DC32: RethinkDB::Response::Response(RethinkDB::Datum&&) (connection_p.h:53)
    ==29615==    by 0x408A01: RethinkDB::ReadLock::read_loop(unsigned long, RethinkDB::CacheLock&&, double) (connection.cc:263)
    ==29615==    by 0x4085BF: RethinkDB::ConnectionPrivate::wait_for_response(unsigned long, double) (connection.cc:221)
    ==29615==    by 0x40A2BE: RethinkDB::Connection::start_query(RethinkDB::Term*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (connection.cc:328)
    ==29615==    by 0x4415AC: RethinkDB::Term::run(RethinkDB::Connection&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (term.cc:58)
    ==29615==    by 0x40415E: main (list_databases.cpp:12)
    ==29615== 
    ==29615== Invalid read of size 8
    ==29615==    at 0x457398: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1330)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Address 0x6038bc0 is 16 bytes inside a block of size 32 free'd
    ==29615==    at 0x4C2BDFB: free (vg_replace_malloc.c:530)
    ==29615==    by 0x457673: __deallocate (new:176)
    ==29615==    by 0x457673: deallocate (memory:1762)
    ==29615==    by 0x457673: deallocate (memory:1522)
    ==29615==    by 0x457673: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::deallocate() (vector:935)
    ==29615==    by 0x4572FE: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1327)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Block was alloc'd at
    ==29615==    at 0x4C2ABCF: malloc (vg_replace_malloc.c:299)
    ==29615==    by 0x4EBCA59: operator new(unsigned long) (in /usr/local/lib/libc++.so.1.0)
    ==29615==    by 0x40F170: __allocate (new:168)
    ==29615==    by 0x40F170: allocate (memory:1759)
    ==29615==    by 0x40F170: allocate (memory:1514)
    ==29615==    by 0x40F170: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::allocate(unsigned long) (vector:923)
    ==29615==    by 0x40EF7F: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::vector(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> > const&) (vector:1197)
    ==29615==    by 0x40DC32: RethinkDB::Response::Response(RethinkDB::Datum&&) (connection_p.h:53)
    ==29615==    by 0x408A01: RethinkDB::ReadLock::read_loop(unsigned long, RethinkDB::CacheLock&&, double) (connection.cc:263)
    ==29615==    by 0x4085BF: RethinkDB::ConnectionPrivate::wait_for_response(unsigned long, double) (connection.cc:221)
    ==29615==    by 0x40A2BE: RethinkDB::Connection::start_query(RethinkDB::Term*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (connection.cc:328)
    ==29615==    by 0x4415AC: RethinkDB::Term::run(RethinkDB::Connection&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (term.cc:58)
    ==29615==    by 0x40415E: main (list_databases.cpp:12)
    ==29615== 
    ==29615== Invalid read of size 8
    ==29615==    at 0x4573C3: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1331)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Address 0x6038bc8 is 24 bytes inside a block of size 32 free'd
    ==29615==    at 0x4C2BDFB: free (vg_replace_malloc.c:530)
    ==29615==    by 0x457673: __deallocate (new:176)
    ==29615==    by 0x457673: deallocate (memory:1762)
    ==29615==    by 0x457673: deallocate (memory:1522)
    ==29615==    by 0x457673: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::deallocate() (vector:935)
    ==29615==    by 0x4572FE: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1327)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Block was alloc'd at
    ==29615==    at 0x4C2ABCF: malloc (vg_replace_malloc.c:299)
    ==29615==    by 0x4EBCA59: operator new(unsigned long) (in /usr/local/lib/libc++.so.1.0)
    ==29615==    by 0x40F170: __allocate (new:168)
    ==29615==    by 0x40F170: allocate (memory:1759)
    ==29615==    by 0x40F170: allocate (memory:1514)
    ==29615==    by 0x40F170: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::allocate(unsigned long) (vector:923)
    ==29615==    by 0x40EF7F: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::vector(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> > const&) (vector:1197)
    ==29615==    by 0x40DC32: RethinkDB::Response::Response(RethinkDB::Datum&&) (connection_p.h:53)
    ==29615==    by 0x408A01: RethinkDB::ReadLock::read_loop(unsigned long, RethinkDB::CacheLock&&, double) (connection.cc:263)
    ==29615==    by 0x4085BF: RethinkDB::ConnectionPrivate::wait_for_response(unsigned long, double) (connection.cc:221)
    ==29615==    by 0x40A2BE: RethinkDB::Connection::start_query(RethinkDB::Term*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (connection.cc:328)
    ==29615==    by 0x4415AC: RethinkDB::Term::run(RethinkDB::Connection&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (term.cc:58)
    ==29615==    by 0x40415E: main (list_databases.cpp:12)
    ==29615== 
    ==29615== Invalid write of size 8
    ==29615==    at 0x457408: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1332)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Address 0x6038bc8 is 24 bytes inside a block of size 32 free'd
    ==29615==    at 0x4C2BDFB: free (vg_replace_malloc.c:530)
    ==29615==    by 0x457673: __deallocate (new:176)
    ==29615==    by 0x457673: deallocate (memory:1762)
    ==29615==    by 0x457673: deallocate (memory:1522)
    ==29615==    by 0x457673: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::deallocate() (vector:935)
    ==29615==    by 0x4572FE: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1327)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Block was alloc'd at
    ==29615==    at 0x4C2ABCF: malloc (vg_replace_malloc.c:299)
    ==29615==    by 0x4EBCA59: operator new(unsigned long) (in /usr/local/lib/libc++.so.1.0)
    ==29615==    by 0x40F170: __allocate (new:168)
    ==29615==    by 0x40F170: allocate (memory:1759)
    ==29615==    by 0x40F170: allocate (memory:1514)
    ==29615==    by 0x40F170: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::allocate(unsigned long) (vector:923)
    ==29615==    by 0x40EF7F: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::vector(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> > const&) (vector:1197)
    ==29615==    by 0x40DC32: RethinkDB::Response::Response(RethinkDB::Datum&&) (connection_p.h:53)
    ==29615==    by 0x408A01: RethinkDB::ReadLock::read_loop(unsigned long, RethinkDB::CacheLock&&, double) (connection.cc:263)
    ==29615==    by 0x4085BF: RethinkDB::ConnectionPrivate::wait_for_response(unsigned long, double) (connection.cc:221)
    ==29615==    by 0x40A2BE: RethinkDB::Connection::start_query(RethinkDB::Term*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (connection.cc:328)
    ==29615==    by 0x4415AC: RethinkDB::Term::run(RethinkDB::Connection&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (term.cc:58)
    ==29615==    by 0x40415E: main (list_databases.cpp:12)
    ==29615== 
    ==29615== Invalid write of size 8
    ==29615==    at 0x457416: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1332)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Address 0x6038bc0 is 16 bytes inside a block of size 32 free'd
    ==29615==    at 0x4C2BDFB: free (vg_replace_malloc.c:530)
    ==29615==    by 0x457673: __deallocate (new:176)
    ==29615==    by 0x457673: deallocate (memory:1762)
    ==29615==    by 0x457673: deallocate (memory:1522)
    ==29615==    by 0x457673: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::deallocate() (vector:935)
    ==29615==    by 0x4572FE: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1327)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Block was alloc'd at
    ==29615==    at 0x4C2ABCF: malloc (vg_replace_malloc.c:299)
    ==29615==    by 0x4EBCA59: operator new(unsigned long) (in /usr/local/lib/libc++.so.1.0)
    ==29615==    by 0x40F170: __allocate (new:168)
    ==29615==    by 0x40F170: allocate (memory:1759)
    ==29615==    by 0x40F170: allocate (memory:1514)
    ==29615==    by 0x40F170: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::allocate(unsigned long) (vector:923)
    ==29615==    by 0x40EF7F: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::vector(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> > const&) (vector:1197)
    ==29615==    by 0x40DC32: RethinkDB::Response::Response(RethinkDB::Datum&&) (connection_p.h:53)
    ==29615==    by 0x408A01: RethinkDB::ReadLock::read_loop(unsigned long, RethinkDB::CacheLock&&, double) (connection.cc:263)
    ==29615==    by 0x4085BF: RethinkDB::ConnectionPrivate::wait_for_response(unsigned long, double) (connection.cc:221)
    ==29615==    by 0x40A2BE: RethinkDB::Connection::start_query(RethinkDB::Term*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (connection.cc:328)
    ==29615==    by 0x4415AC: RethinkDB::Term::run(RethinkDB::Connection&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (term.cc:58)
    ==29615==    by 0x40415E: main (list_databases.cpp:12)
    ==29615== 
    ==29615== Invalid write of size 8
    ==29615==    at 0x457425: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1332)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Address 0x6038bb8 is 8 bytes inside a block of size 32 free'd
    ==29615==    at 0x4C2BDFB: free (vg_replace_malloc.c:530)
    ==29615==    by 0x457673: __deallocate (new:176)
    ==29615==    by 0x457673: deallocate (memory:1762)
    ==29615==    by 0x457673: deallocate (memory:1522)
    ==29615==    by 0x457673: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::deallocate() (vector:935)
    ==29615==    by 0x4572FE: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1327)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Block was alloc'd at
    ==29615==    at 0x4C2ABCF: malloc (vg_replace_malloc.c:299)
    ==29615==    by 0x4EBCA59: operator new(unsigned long) (in /usr/local/lib/libc++.so.1.0)
    ==29615==    by 0x40F170: __allocate (new:168)
    ==29615==    by 0x40F170: allocate (memory:1759)
    ==29615==    by 0x40F170: allocate (memory:1514)
    ==29615==    by 0x40F170: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::allocate(unsigned long) (vector:923)
    ==29615==    by 0x40EF7F: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::vector(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> > const&) (vector:1197)
    ==29615==    by 0x40DC32: RethinkDB::Response::Response(RethinkDB::Datum&&) (connection_p.h:53)
    ==29615==    by 0x408A01: RethinkDB::ReadLock::read_loop(unsigned long, RethinkDB::CacheLock&&, double) (connection.cc:263)
    ==29615==    by 0x4085BF: RethinkDB::ConnectionPrivate::wait_for_response(unsigned long, double) (connection.cc:221)
    ==29615==    by 0x40A2BE: RethinkDB::Connection::start_query(RethinkDB::Term*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (connection.cc:328)
    ==29615==    by 0x4415AC: RethinkDB::Term::run(RethinkDB::Connection&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, RethinkDB::Term> > >&&) (term.cc:58)
    ==29615==    by 0x40415E: main (list_databases.cpp:12)
    ==29615== 
    ==29615== Invalid free() / delete / delete[] / realloc()
    ==29615==    at 0x4C2BDFB: free (vg_replace_malloc.c:530)
    ==29615==    by 0x404F61: __deallocate (new:176)
    ==29615==    by 0x404F61: deallocate (memory:1762)
    ==29615==    by 0x404F61: deallocate (memory:1522)
    ==29615==    by 0x404F61: std::__1::__vector_base<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::~__vector_base() (vector:445)
    ==29615==    by 0x404BA4: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::~vector() (vector:450)
    ==29615==    by 0x457238: RethinkDB::CursorPrivate::~CursorPrivate() (cursor_p.h:8)
    ==29615==    by 0x455573: operator() (memory:2565)
    ==29615==    by 0x455573: reset (memory:2771)
    ==29615==    by 0x455573: ~unique_ptr (memory:2739)
    ==29615==    by 0x455573: RethinkDB::Cursor::~Cursor() (cursor.cc:27)
    ==29615==    by 0x404343: main (list_databases.cpp:17)
    ==29615==  Address 0x6038c10 is 0 bytes inside a block of size 128 free'd
    ==29615==    at 0x4C2BDFB: free (vg_replace_malloc.c:530)
    ==29615==    by 0x404F61: __deallocate (new:176)
    ==29615==    by 0x404F61: deallocate (memory:1762)
    ==29615==    by 0x404F61: deallocate (memory:1522)
    ==29615==    by 0x404F61: std::__1::__vector_base<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::~__vector_base() (vector:445)
    ==29615==    by 0x404BA4: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::~vector() (vector:450)
    ==29615==    by 0x404B36: RethinkDB::Datum::datum_value::destroy(RethinkDB::Datum::Type) (datum.h:268)
    ==29615==    by 0x404A43: RethinkDB::Datum::~Datum() (datum.h:105)
    ==29615==    by 0x457591: destroy (memory:1826)
    ==29615==    by 0x457591: __destroy<RethinkDB::Datum> (memory:1694)
    ==29615==    by 0x457591: destroy<RethinkDB::Datum> (memory:1562)
    ==29615==    by 0x457591: __destruct_at_end (vector:417)
    ==29615==    by 0x457591: clear (vector:361)
    ==29615==    by 0x457591: clear (vector:731)
    ==29615==    by 0x457591: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::deallocate() (vector:934)
    ==29615==    by 0x4572FE: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::__move_assign(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >&, std::__1::integral_constant<bool, true>) (vector:1327)
    ==29615==    by 0x455CFD: operator= (vector:1303)
    ==29615==    by 0x455CFD: RethinkDB::CursorPrivate::convert_single() const (cursor.cc:60)
    ==29615==    by 0x4557C6: RethinkDB::Cursor::has_next(double) const (cursor.cc:121)
    ==29615==    by 0x456D3D: RethinkDB::Cursor::iterator::operator!=(RethinkDB::Cursor::iterator const&) const (cursor.cc:211)
    ==29615==    by 0x4041E1: main (list_databases.cpp:13)
    ==29615==  Block was alloc'd at
    ==29615==    at 0x4C2ABCF: malloc (vg_replace_malloc.c:299)
    ==29615==    by 0x4EBCA59: operator new(unsigned long) (in /usr/local/lib/libc++.so.1.0)
    ==29615==    by 0x40F170: __allocate (new:168)
    ==29615==    by 0x40F170: allocate (memory:1759)
    ==29615==    by 0x40F170: allocate (memory:1514)
    ==29615==    by 0x40F170: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::allocate(unsigned long) (vector:923)
    ==29615==    by 0x40EF7F: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::vector(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> > const&) (vector:1197)
    ==29615==    by 0x41160F: RethinkDB::Datum::datum_value::set(RethinkDB::Datum::Type, RethinkDB::Datum::datum_value const&) (datum.h:254)
    ==29615==    by 0x410F82: RethinkDB::Datum::datum_value::datum_value(RethinkDB::Datum::Type, RethinkDB::Datum::datum_value const&) (datum.h:227)
    ==29615==    by 0x40E74F: RethinkDB::Datum::Datum(RethinkDB::Datum const&) (datum.h:43)
    ==29615==    by 0x40F320: construct<RethinkDB::Datum, RethinkDB::Datum &> (memory:1771)
    ==29615==    by 0x40F320: __construct<RethinkDB::Datum, RethinkDB::Datum &> (memory:1682)
    ==29615==    by 0x40F320: construct<RethinkDB::Datum, RethinkDB::Datum &> (memory:1528)
    ==29615==    by 0x40F320: __construct_range_forward<RethinkDB::Datum *, RethinkDB::Datum *> (memory:1612)
    ==29615==    by 0x40F320: _ZNSt3__16vectorIN9RethinkDB5DatumENS_9allocatorIS2_EEE18__construct_at_endIPS2_EENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeES9_S9_m (vector:1015)
    ==29615==    by 0x40EFA5: std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> >::vector(std::__1::vector<RethinkDB::Datum, std::__1::allocator<RethinkDB::Datum> > const&) (vector:1198)
    ==29615==    by 0x40DC32: RethinkDB::Response::Response(RethinkDB::Datum&&) (connection_p.h:53)
    ==29615==    by 0x408A01: RethinkDB::ReadLock::read_loop(unsigned long, RethinkDB::CacheLock&&, double) (connection.cc:263)
    ==29615==    by 0x4085BF: RethinkDB::ConnectionPrivate::wait_for_response(unsigned long, double) (connection.cc:221)
    ==29615== 
    ==29615== 
    ==29615== HEAP SUMMARY:
    ==29615==     in use at exit: 0 bytes in 0 blocks
    ==29615==   total heap usage: 105 allocs, 106 frees, 102,478 bytes allocated
    ==29615== 
    ==29615== All heap blocks were freed -- no leaks are possible
    ==29615== 
    ==29615== For counts of detected and suppressed errors, rerun with: -v
    ==29615== ERROR SUMMARY: 7 errors from 7 contexts (suppressed: 0 from 0)
    

    Is it a mistake on my part? A but in Clang? A bug in libc++? Or a bug in librethinkdb++?

    I am using a recent (a few days old) checkout of Clang and libc++ and built from source.

    I'm on a Debian SID system, recently updated (also a couple of days ago).

    I do not have this problem if I use -stdlib=libstdc++ (the GNU GCC standard library) for both the library and my application, even when building with Clang. It's only in combination with libc++ this crash happens.

    opened by pileon 8
  • Insert, Update & Delete

    Insert, Update & Delete

    Is it possible to perform Insert, Update & Delete operations on the tables. I have tried querying the tables and it works fine, but Insert never worked. Could you please help.

    question 
    opened by kamlesh-nb 7
  • Invalid JSON number '1434014861.388999939'

    Invalid JSON number '1434014861.388999939'

    I've been trying to test librethinkdbxx on a bit larger scale (on a customer's data set).

    I started simpe with a nonsense query, but got the above exception thrown (R::Error):

    table.run(*conn);
    

    I have narrowed it down to a single field in one document (the first one, so there might be more). Dumped by rethinkdb-export it looks like this: "_modified": {"timezone": "+00:00", "$reql_type$": "TIME", "epoch_time": 1434014861.389}}

    So I guess that's where the number in the exception comes from, but why is it invalid?

    This also lead me to the question: is librethinkdbxx using the JSON protocol towards the server? I saw in the code there are constants for both the binary, V0_4 and JSON, but have not discovered any way to select which protocol to use, so I'm guessing it's negotiated or some such?

    opened by neonrust 7
  • Adding a Geo Reference

    Adding a Geo Reference

    Is there anyway to add a point to an object without calling run i.e.

    RethinkDB::Object({{"TS", RethinkDB::Time(newdata->fix.time)},{"POS", RethinkDB::point(newdata->fix.latitude, newdata->fix.longitude))}})

    Instead of

    RethinkDB::Object({{"TS", RethinkDB::Time(newdata->fix.time)},{"POS", RethinkDB::point(newdata->fix.latitude, newdata->fix.longitude).run(*Conn())}})

    opened by CCJH 3
  • OS X 10.10.5 & clang; 16 of 2054 tests failing.

    OS X 10.10.5 & clang; 16 of 2054 tests failing.

    Hi!

    I started porting the RethinkDB C++ driver before I spotted that there is already an "osx" branch. This is my take on it. Most tests pass, but it reports 16 tests that are failing.

    From the reports it looks like results are encapsulated too much. For example:

    Section test_upstream_aggregation: Tests that manipulation data in tables
      FAILURE in ‘R::expr(R::array(R::object("a", 1))).filter(true).limit(1).group("a").run(*conn, R::optargs("group_format", "raw"))’:
        Expected: ‘{"$reql_type$":"GROUPED_DATA","data":[1,[{"a":1}]]}’
         but got: ‘{"$reql_type$":"GROUPED_DATA","data":[[1,[{"a":1}]]]}’
    

    Other times, expressions report null:

    Section test_upstream_control: Tests RQL control flow structures
      FAILURE in ‘R::expr(5).do_(R::row).run(*conn)’:
        Expected: ‘5’
         but got: ‘null’
    

    I am unable to fix these problems myself, but perhaps it helps with the OS X port.

    Thanks,

    Kim

    opened by indiedotkim 3
  • #define MICROSECOND misnomer in librethinkdbxx/src/net.h

    #define MICROSECOND misnomer in librethinkdbxx/src/net.h

    librethinkdbxx/src/net.h defines MICROSECOND as 100 nanoseconds. Unless I misunderstand the context, this is not intentional.

    #define MICROSECOND 0.0000001 0.0000001 should be 0.000001.

    bug 
    opened by iamorphen 2
  • OptArgs

    OptArgs

    Hi,

    Not really a problem with the code but for the life of me I cannot work out the syntax for using OptArgs.

    I'm trying to do a "between(to,from)" in a query but it needs to use a specific index and not the primary key. E.g I need to say between(to,from,"index='t').

    I have gathered so far that OptArgs takes a string followed by a Term (it's std::map I think) but can't figure out the syntax for the Term part.

    Have been through all of the code that I can fathom!

    Amy help much appreciated.

    Thanks.

    opened by ldrcsl1970 1
  • refactor the module

    refactor the module

    Last attempt at cherry-picking in the refactorings after the most recent segfault fixes. This time I'm not including the Query=>Term renaming as that made the previous PR unreadable. Instead that change has already made it in, and we can focus on actual code changes

    opened by mbroadst 1
  • Fix compile errors on OS X

    Fix compile errors on OS X

    Hi

    I fix compile errors on OS X with message below.

    $ make -k
    mkdir -p build/gen
    python3 reql/gen.py reql/ql2.proto > build/gen/protocol_defs.h
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/net.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/net.cc -MP -MQ build/obj/net.o -MD -MF build/dep/net.d
    In file included from src/net.cc:9:
    src/error.h:26:46: error: use of undeclared identifier 'errno'
            return Error("%s: %s", str, strerror(errno));
                                                 ^
    src/net.cc:273:61: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'uint64_t'
          (aka 'unsigned long long') [-Wformat]
            if (debug_net > 0) fprintf(stderr, "[%zu] << %s\n", token_got, write_datum(datum).c_str());
                                                 ~~~            ^~~~~~~~~
                                                 %llu
    src/net.cc:319:57: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'uint64_t'
          (aka 'unsigned long long') [-Wformat]
        if (debug_net > 0) fprintf(stderr, "[%zu] >> %s\n", token, query.c_str());
                                             ~~~            ^~~~~
                                             %llu
    2 warnings and 1 error generated.
    make: *** [build/obj/net.o] Error 1
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/datum.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/datum.cc -MP -MQ build/obj/datum.o -MD -MF build/dep/datum.d
    In file included from src/datum.cc:1:
    In file included from src/datum.h:9:
    src/error.h:26:46: error: use of undeclared identifier 'errno'
            return Error("%s: %s", str, strerror(errno));
                                                 ^
    1 error generated.
    make: *** [build/obj/datum.o] Error 1
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/json.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/json.cc -MP -MQ build/obj/json.o -MD -MF build/dep/json.d
    In file included from src/json.cc:5:
    In file included from src/json.h:3:
    In file included from src/datum.h:9:
    src/error.h:26:46: error: use of undeclared identifier 'errno'
            return Error("%s: %s", str, strerror(errno));
                                                 ^
    src/json.cc:166:1: error: unknown type name 'locale_t'
    locale_t locale_c() {
    ^
    src/json.cc:167:12: error: unknown type name 'locale_t'
        static locale_t ret = nullptr;
               ^
    src/json.cc:170:25: error: use of undeclared identifier 'LC_ALL_MASK'
            ret = newlocale(LC_ALL_MASK, "C", nullptr);
                            ^
    src/json.cc:195:21: error: use of undeclared identifier 'strtod_l'; did you mean 'strtok_r'?
        double number = strtod_l(buf, &end, locale_c());
                        ^~~~~~~~
                        strtok_r
    /usr/include/string.h:104:7: note: 'strtok_r' declared here
    char    *strtok_r(char *, const char *, char **);
             ^
    src/json.cc:195:35: error: cannot initialize a parameter of type 'const char *' with an rvalue of type 'char **'
        double number = strtod_l(buf, &end, locale_c());
                                      ^~~~
    /usr/include/string.h:104:36: note: passing argument to parameter here
    char    *strtok_r(char *, const char *, char **);
                                          ^
    6 errors generated.
    make: *** [build/obj/json.o] Error 1
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/query.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/query.cc -MP -MQ build/obj/query.o -MD -MF build/dep/query.d
    In file included from src/query.cc:4:
    In file included from src/query.h:3:
    In file included from src/datum.h:9:
    src/error.h:26:46: error: use of undeclared identifier 'errno'
            return Error("%s: %s", str, strerror(errno));
                                                 ^
    1 error generated.
    make: *** [build/obj/query.o] Error 1
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/cursor.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/cursor.cc -MP -MQ build/obj/cursor.o -MD -MF build/dep/cursor.d
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/types.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/types.cc -MP -MQ build/obj/types.o -MD -MF build/dep/types.d
    In file included from src/types.cc:1:
    src/types.h:25:17: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>,
          std::__1::allocator<char> >'
        std::string data;
                    ^
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/../include/c++/v1/iosfwd:193:33: note: template is declared here
        class _LIBCPP_TYPE_VIS_ONLY basic_string;
                                    ^
    In file included from src/types.cc:2:
    src/error.h:26:46: error: use of undeclared identifier 'errno'
            return Error("%s: %s", str, strerror(errno));
                                                 ^
    src/types.cc:39:24: error: no member named 'abs' in namespace 'std'
        int minutes = std::abs(static_cast<int>(offset / 60)) % 60;
                      ~~~~~^
    3 errors generated.
    make: *** [build/obj/types.o] Error 1
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/utils.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/utils.cc -MP -MQ build/obj/utils.o -MD -MF build/dep/utils.d
    In file included from src/utils.cc:2:
    src/error.h:26:46: error: use of undeclared identifier 'errno'
            return Error("%s: %s", str, strerror(errno));
                                                 ^
    1 error generated.
    make: *** [build/obj/utils.o] Error 1
    ( echo "// Auto-generated file, built from build/gen/protocol_defs.h src/utils.h src/error.h src/stream.h src/types.h src/datum.h src/json.h src/net.h src/cursor.h src/query.h"; \
          echo '#pragma once'; \
          cat build/gen/protocol_defs.h src/utils.h src/error.h src/stream.h src/types.h src/datum.h src/json.h src/net.h src/cursor.h src/query.h | \
            grep -v '^#pragma once' | \
            grep -v '^#include "'; \
        ) > build/rethinkdb.nodocs.h
    mkdir -p build/include
    cp build/rethinkdb.nodocs.h build/include/rethinkdb.h
    make: Target `default' not remade because of errors.
    
    opened by wingyplus 1
  • Error while executing Insert

    Error while executing Insert

    I am getting below error

    terminate called after throwing an instance of 'RethinkDB::Error'
    

    while executing insert as per below code. Any help would be appreciated.

    #include <memory>
    #include <cstdio>
    #include <rethinkdb.h>
    #include <iostream>
    using namespace std;
    
    namespace R = RethinkDB;
    
    int main() {
            std::unique_ptr<R::Connection> conn = R::connect("127.0.0.1", 28015);
            string sss("{ \"message\": \"Successfully Saved!!\" }");
    
            R::db("mydb").table("messages").insert(R::json(sss)).run(*conn);
    
    }
    
    question 
    opened by kamlesh-nb 1
  • Replacing documents

    Replacing documents

    Is the replace() command already implemented? And what is the type of the JSON object that needs to be used as input? I tried a normal string but that didn't work. It would be nice if you could put up an example where you add something to the database.

    opened by Maarten-p 1
  • failing tests on debian 10

    failing tests on debian 10

    on debian 10 buster 64 bit I did : git clone https://github.com/AtnNn/librethinkdbxx make works with gcc v 8 make test gives : DONE: 17 of 2295 tests failed is this expected ?

    how could I benchmark roughly query and update speed of a single field in a record ? could you update the documentation how

    opened by gfanini 1
  • failing to link library in main app

    failing to link library in main app

    I built the latest rethinkdb driver with gcc, and I am failing the linking stage in my main application with the same gcc 5.3.0 (my app is failing to find references)

    undefined reference to `RethinkDB::connect(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, int, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >)'

    more undefined references to `RethinkDB::Term::run(RethinkDB::Connection&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, RethinkDB::Term, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, RethinkDB::Term> > >&&)' follow clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)

    would appreciate any pointers!

    opened by SpY0o2 0
  • Cross-compilation issue on ARM

    Cross-compilation issue on ARM

    There is a cross-compilation issue on arm due to the macro PRIu64:

    [...]
    In file included from src/cursor_p.h:4:0,
                     from src/cursor.cc:2:
    src/connection_p.h: In member function 'std::string RethinkDB::Query::serialize()':
    src/connection_p.h:28:34: error: expected ')' before 'PRIu64'
                 fprintf(stderr, "[%" PRIu64 "] >> %s\n", token, query_str.c_str());
                                      ^
    src/connection_p.h:28:78: warning: spurious trailing '%' in format [-Wformat=]
                 fprintf(stderr, "[%" PRIu64 "] >> %s\n", token, query_str.c_str());
                                                                                  ^
    [...]
    

    This is due to the fact that the macro PRIu64 is defined only if the __STDC_FORMAT_MACROS. See inttypes.h of the raspberry arm toolchain (https://github.com/raspberrypi/tools):

    /* The ISO C99 standard specifies that these macros must only be
       defined if explicitly requested.  */
    #if !defined __cplusplus || defined __STDC_FORMAT_MACROS
    [...]
    # define PRIu64         __PRI64_PREFIX "u"
    [...]
    #endif
    

    Could you patch connection_p.h to fix that? I also can create a PR if needed:

    diff --git a/src/connection_p.h b/src/connection_p.h
    index d8a95e3..ac7c725 100644
    --- a/src/connection_p.h
    +++ b/src/connection_p.h
    @@ -1,6 +1,7 @@
     #ifndef CONNECTION_P_H
     #define CONNECTION_P_H
     
    +#define __STDC_FORMAT_MACROS 1
     #include <inttypes.h>
     
     #include "connection.h"
    
    opened by jdmichaud 0
  • -pthread unused during compilation on branch osx

    -pthread unused during compilation on branch osx

    I found on branch osx with commit 102323ed212b131ac8ec5d50a1d3535ed8a1e5c1

    $ make
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -Wnone -o /dev/null -x c++ <(echo $' #include <locale.h>\nint main(){  char *c; locale_t l; strtod_l(c, &c, l); }') 2>/dev/null >/dev/null && echo '#define  USE_LOCALE_H' || \
          /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -Wnone -o /dev/null -x c++ <(echo $' #include <xlocale.h>\n#include<stdlib.h>\nint main(){  char *c; locale_t l; strtod_l(c, &c, l); }') 2>/dev/null >/dev/null && echo '#define  USE_XLOCALE_H' \
          > build/gen/config.h
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/net.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/net.cc -MP -MQ build/obj/net.o -MD -MF build/dep/net.d
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/datum.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/datum.cc -MP -MQ build/obj/datum.o -MD -MF build/dep/datum.d
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/json.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/json.cc -MP -MQ build/obj/json.o -MD -MF build/dep/json.d
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/query.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/query.cc -MP -MQ build/obj/query.o -MD -MF build/dep/query.d
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/cursor.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/cursor.cc -MP -MQ build/obj/cursor.o -MD -MF build/dep/cursor.d
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/types.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/types.cc -MP -MQ build/obj/types.o -MD -MF build/dep/types.d
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/obj/utils.o  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -c src/utils.cc -MP -MQ build/obj/utils.o -MD -MF build/dep/utils.d
    ar rcs build/librethinkdb++.a build/obj/net.o build/obj/datum.o build/obj/json.o build/obj/query.o build/obj/cursor.o build/obj/types.o build/obj/utils.o
    /Users/wingyplus/clang+llvm-3.8.0-x86_64-apple-darwin/bin/clang++ -o build/librethinkdb++.so  -std=c++11 -I'build/gen' -Wall -pthread -fPIC -shared build/obj/net.o build/obj/datum.o build/obj/json.o build/obj/query.o build/obj/cursor.o build/obj/types.o build/obj/utils.o
    clang-3.8: warning: argument unused during compilation: '-pthread'
    
    enhancement 
    opened by wingyplus 1
Owner
Etienne Laurin
C++ Engineer at @Nitro
Etienne Laurin
Loads a signed kernel driver which allows you to map any driver to kernel mode without any traces of the signed / mapped driver.

CosMapper Loads a signed kernel driver (signed with leaked cert) which allows you to map any driver to kernel mode without any traces of the signed /

null 157 Jan 2, 2023
libsinsp, libscap, the kernel module driver, and the eBPF driver sources

falcosecurity/libs As per the OSS Libraries Contribution Plan, this repository has been chosen to be the new home for libsinsp, libscap, the kernel mo

Falco 133 Dec 29, 2022
manually map driver for a signed driver memory space

smap manually map driver for a signed driver memory space credits https://github.com/btbd/umap tested system Windows 10 Education 20H2 UEFI installati

ekknod 89 Dec 17, 2022
x64 Windows kernel driver mapper, inject unsigned driver using anycall

anymapper x64 Windows kernel driver mapper, inject unsigned driver using anycall This project is WIP. Todo Fix: Can't make API calls from IAT nor func

Kento Oki 72 Dec 26, 2022
Driver leap - Self-sustainable fork of SteamVR driver for Leap Motion controller with updated vendor libraries

Driver Leap Self-sustainable fork of SteamVR driver for Leap Motion controller with updated vendor libraries Installation (for users) Install Ultralea

null 68 Jan 5, 2023
Hygieia, a vulnerable driver traces scanner written in C++ as an x64 Windows kernel driver.

Hygieia The Greek goddess of health, her name is the source for the word "hygiene". Hygieia is a windows driver that works similarly to how pagewalkr

Deputation 103 Dec 4, 2022
SinMapper - usermode driver mapper that forcefully loads any signed kernel driver

usermode driver mapper that forcefully loads any signed kernel driver (legit cert) with a big enough section (example: .data, .rdata) to map your driver over. the main focus of this project is to prevent modern anti-cheats (BattlEye, EAC) from finding your driver and having the power to hook anything due to being inside of legit memory (signed legit driver).

null 170 Dec 29, 2022
ARCHIVED - libbson has moved to https://github.com/mongodb/mongo-c-driver/tree/master/src/libbson

libbson ARCHIVED - libbson is now maintained in a subdirectory of the libmongoc project: https://github.com/mongodb/mongo-c-driver/tree/master/src/lib

mongodb 344 Nov 29, 2022
This project aims to facilitate debugging a kernel driver in windows by adding support for a code change on the fly without reboot/unload, and more!

BSOD Survivor Tired of always telling yourself when you got a BSOD that what if I could just return to the caller function which caused the BSOD, and

Ido Westler 159 Dec 21, 2022
Lotus 1-2-3 R4D Display Driver for DOSEMU

Lotus 1-2-3 R4D Display Driver for DOSEMU2 This is a WIP display driver for Lotus 1-2-3 R4D to enable support for arbitrary text resolutions in DOSEMU

Tavis Ormandy 112 Dec 2, 2022
C++ Driver for MongoDB

MongoDB C++ Driver Welcome to the MongoDB C++ Driver! Branches - releases/stable versus master The default checkout branch of this repository is relea

mongodb 931 Dec 28, 2022
Simple Player-Glow & Driver Source Included

External-Apex-Cheat Install WDK Build in Release x64 Map driver using KDMapper Launch Game Run User-mode when in main menu Have Fun driver is indeed p

null 103 Dec 21, 2022
MPU-9250 sensor driver.

mpu9250 This library communicates with InvenSense MPU-9250 and MPU-9255 Inertial Measurement Units (IMUs). License Changelog Contributing guide Descri

Bolder Flight Systems 413 Dec 30, 2022
An SQLite3 driver for Elixir

Exqlite An Elixir SQLite3 library. If you are looking for the Ecto adapater, take a look at the Ecto SQLite3 library. Documentation: https://hexdocs.p

elixir-sqlite 147 Dec 30, 2022
An OpenVR Driver for VR Gloves

lucidgloves - LucidVR X Fngrs Developed by: Danwillm Lucas_VRTech What is this? This repository contains the OpenVR(SteamVR) driver for a DIY VR Hapti

null 396 Jan 6, 2023
Corsair LL Access driver abuse

CorsairLLeak Map physical addresses into userspace (RW), read/write MSRs, send/recieve data on I/O ports, and query/set bus configuration data with th

Arush Agarampur 21 Jun 27, 2022
Valorant cheat that abuses Logitech GHUB driver input management.

valorant-cheat Valorant cheat that uses Logitech GHUB driver input management and color detection. features Triggerbot with customizable delay (VK_SHI

null 30 Jan 7, 2023
ASUSTeK AsIO3 I/O driver unlock

AsIo3Unlock ASUSTeK AsIO3 I/O driver unlock Purpose This is proof-of-concept bypass of pseudo-security caller check implemented in AsIO3, "unlocking"

null 20 Nov 8, 2022
A FAT filesystem with SPI driver for SD card on Raspberry Pi Pico

no-OS-FatFS-SD-SPI-RPi-Pico Simple library for SD Cards on the Pico At the heart of this library is ChaN's FatFs - Generic FAT Filesystem Module. It a

Carl J Kugler III 130 Dec 27, 2022
OffensivePH - use old Process Hacker driver to bypass several user-mode access controls

offensiveph OffensivePH is a post-exploitation tool that utilizes an old Process Hacker driver to bypass several user-mode access controls. Usage Comp

Red Section 291 Dec 29, 2022