Giter VIP home page Giter VIP logo

aqlc's Introduction

aqlc

CI Hex.pm

Erlang client for AntidoteDB's SQL interface (AQL). You will need at least Erlang/OTP 22.0, this library won't compile in previous versions.

Quick Start

Connecting to the server

Assuming you have at least one AQL node running, you can connect to it with aqlc:connect/2:

Conn = aqlc:connect("127.0.0.1", 8321).

Once done, you should close the connection with aqlc:close/1:

aqlc:close(Conn).

For instructions on how to launch AQL and AntidoteDB instances, check the documentation here and here.

Queries

To issue queries, use the aqlc:query/2 function:

CreateTable = "CREATE UPDATE-WINS TABLE Artist (ArtistID INT PRIMARY KEY, Name VARCHAR);".
aqlc:query(Conn, CreateTable).

aqlc:query(Conn, "INSERT INTO Artist (ArtistID, Name) VALUES (42, 'Joee');").

aqlc:query(Conn, "SELECT * FROM Artist WHERE ArtistID = 42;").

Transactions

aqlc:query/2 runs the given query in a single transaction. To run multiple queries in a single transaction use aqlc:start_transaction/1 and aqlc:query/3:

Tx = aqlc:start_transaction(Conn).
aqlc:query(Conn, "UPDATE Artist SET Name = 'Joe' WHERE ArtistID = 42;", Tx).
aqlc:query(Conn, "SELECT * FROM Artist WHERE ArtistID = 42;", Tx).

You may commit a transaction with aqlc:commit_transaction/2:

aqlc:commit_transaction(Conn, Tx).

Or abort it with aqlc:abort_transaction/2:

aqlc:abort_transaction(Conn, Tx).

aqlc's People

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.