Skip to content
This repository was archived by the owner on Jul 11, 2021. It is now read-only.
This repository was archived by the owner on Jul 11, 2021. It is now read-only.

C++ example #107

Open
Open

Description

@sunnyb75

Can you provide a C++ example/demo to use with RedisSQL module?

Activity

  1. siscia commented on Sep 16, 2020

    @siscia
    Member

    Hello,

    Do you have a specific library in mind?

    The API for hiredis that is the official C library is quite small and terse, at least for synchronous API.

    It is not tested, but I would do something like:

    redisContext *c = redisConnect("127.0.0.1", 6379);
    redisCommand(redisContext, "REDISQL.CREATE_DB DB");
    
    redisCommand(redisContext, "REDISQL.EXEC DB 'create table foo (a, b, c);' ");
    redisCommand(redisContext, "REDISQL.EXEC DB 'insert into foo values(1,2,3),(4,5,6);' ");
    reply = redisCommand(redisContext, "REDISQL.EXEC DB 'select * from foo' ");
    
    // somehow use this reply object
    freeReplyObject(reply); // not sure it is needed
    

    It is just a sketch that I didn't test.

    Does it helps?

  2. siscia commented on Sep 16, 2020

    @siscia
    Member

    (And congrats on opening our first issue!)

  3. nqf commented on Sep 18, 2020

    @nqf

    you can use redis-plus-plus lib

    auto pipe = redis-plus-plus->pipeline(false);
    pipe.command("REDISQL.CREATE_DB", "TT")
        .command("REDISQL.EXEC", "TT", "COMMAND", "CREATE TABLE foo(name TEXT);")
        .command("REDISQL.EXEC", "TT", "COMMAND", "CREATE INDEX foo_index ON foo(name);")
        .command("REDISQL.EXEC", "TT", "COMMAND", "INSERT INTO foo VALUES("hello")
        .exec();
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions