<commit_before>libneo4j-client
===============


About
-----

libneo4j-client is a client library written in C for Neo4j. It is not intended
as a complete driver, but rather as a foundation on which basic tools and
drivers for various languages may be built. libneo4j-client takes care of all
the detail of establishing a session with a Neo4j server, sending statements
for evaluation, and retrieving results.

Included with libneo4j-client is neo4j-client, a small command shell for
Neo4j that uses libneo4j-client for all interaction with Neo4j server.


Requirements
------------

libneo4j-client is known to work on GNU/Linux, Mac OS X and FreeBSD. It
requires neo4j 3.0.0-M02 or later.

Note that libneo4j-client is still an alpha release, and may change in
incompatible ways before a stable release is made.


neo4j-client Usage
------------------

neo4j-client is a command shell for Neo4j. It supports secure connections
to Neo4j server, sending of statements (including multiline statements),
persistent command history, and rendering of results to tables or CSV.

Basic usage:

```console
$ neo4j-client -v neo4j://localhost:7687
The authenticity of host 'localhost:7687' could not be established.
TLS certificate fingerprint is BD:3D:65:E2:7C:94:C6:79:45:92:F9:47:91:DA:8E:07:93:45:69:78.
Would you like to trust this certificate (NO/yes/once)? yes
neo4j> :help
:quit                Exit the shell
:connect <url>       Connect to the specified URL
:disconnect          Disconnect the client from the server
:help                Show usage information
:output (table|csv)  Set the output format
:width <n>           Set the number of columns in the table output
neo4j> MATCH (n:Person) RETURN n LIMIT 3;
+----------------------------------------------------------------------------+
| n                                                                          |
+----------------------------------------------------------------------------+
| (:Person{born:1964,name:"<NAME>"})                                   |
| (:Person{born:1967,name:"<NAME>"})                               |
| (:Person{born:1961,name:"<NAME>"})                             |
+----------------------------------------------------------------------------+
neo4j> :exit
$
```


libneo4j-client Usage
---------------------

libneo4j-client provides a single C header file, `neo4j-client.h`, for
inclusion in source code using the libneo4j-client API. The API is described in
the [API Documentation](#api_documentation).

libneo4j-client can be included in your project by linking the library at
compile time, typically using the linking flags `-lneo4j-client -lssl -lcrypto`.
Alternatively, libneo4j-client ships with a [pkg-config](
https://wiki.freedesktop.org/www/Software/pkg-config/) description file,
enabling you to obtain the required flags using
`pkg-config --libs libneo4j-client`.


API Documentation
-----------------

API documentation for the latest release is available at
[https://cleishm.github.io/libneo4j-client/doc/latest/neo4j-client\_8h.html](
[https://cleishm.github.io/libneo4j-client/doc/latest/neo4j-client_8h.html).

Documentation can be built using `make doc`, which will use doxygen to generate
documentation and output it into the `doc/` directory of the libneo4j-client
source tree. See [Building](#Building) below.


Example
-------

```C
#include <neo4j-client.h>
#include <errno.h>
#include <stdio.h>

static void error(const char *msg);

int main(int argc, char *argv[])
{
    neo4j_client_init();

    neo4j_connection_t *connection = neo4j_connect("neo4j://localhost:7687", NULL, 0);
    if (connection == NULL)
    {
        error("Connection failed");
    }

    neo4j_session_t *session = neo4j_new_session(connection);
    if (session == NULL)
    {
        error("Failed to start session");
    }

    neo4j_result_stream_t *results = neo4j_run(session, "RETURN 'hello world'", NULL, 0);
    if (results == NULL)
    {
        error("Failed to run statement");
    }

    neo4j_result_t *result = neo4j_fetch_next(results);
    if (results == NULL)
    {
        error("Failed to fetch result");
    }

    neo4j_value_t value = neo4j_result_field(result, 0);
    char buf[128];
    printf("%s\n", neo4j_tostring(value, buf, sizeof(buf)));

    neo4j_close_results(results);
    neo4j_end_session(session);
    neo4j_close(connection);
    neo4j_client_cleanup();
}

void error(const char *msg)
{
    char ebuf[256];
    fprintf(stderr, "%s: %s\n", msg, neo4j_strerror(errno, ebuf, sizeof(ebuf)));
    exit(1);
}
```


Building
--------

To build software using libneo4j-client, consider installing libneo4j-client
using the package management system for your operating system.

If libneo4j-client is not available via your package management system,
please [download the latest release](
https://github.com/cleishm/libneo4j-client/releases) and then:

```
$ ./configure
$ make clean check
$ sudo make install
```

libneo4j-client requires some dependencies to build, including OpenSSL and
[libedit](http://thrysoee.dk/editline/). The need for these can be disabled
by invoking configure with `--without-tls` or `--disable-tools` respectively.

To checkout from GitHub and build:

```
$ git clone https://github.com/cleishm/libneo4j-client.git<commit_msg>Add note on missing openssl headers in Mac OS X<commit_after>libneo4j-client
===============


About
-----

libneo4j-client is a client library written in C for Neo4j. It is not intended
as a complete driver, but rather as a foundation on which basic tools and
drivers for various languages may be built. libneo4j-client takes care of all
the detail of establishing a session with a Neo4j server, sending statements
for evaluation, and retrieving results.

Included with libneo4j-client is neo4j-client, a small command shell for
Neo4j that uses libneo4j-client for all interaction with Neo4j server.


Requirements
------------

libneo4j-client is known to work on GNU/Linux, Mac OS X and FreeBSD. It
requires neo4j 3.0.0-M02 or later.

Note that libneo4j-client is still an alpha release, and may change in
incompatible ways before a stable release is made.


neo4j-client Usage
------------------

neo4j-client is a command shell for Neo4j. It supports secure connections
to Neo4j server, sending of statements (including multiline statements),
persistent command history, and rendering of results to tables or CSV.

Basic usage:

```console
$ neo4j-client -v neo4j://localhost:7687
The authenticity of host 'localhost:7687' could not be established.
TLS certificate fingerprint is BD:3D:65:E2:7C:94:C6:79:45:92:F9:47:91:DA:8E:07:93:45:69:78.
Would you like to trust this certificate (NO/yes/once)? yes
neo4j> :help
:quit                Exit the shell
:connect <url>       Connect to the specified URL
:disconnect          Disconnect the client from the server
:help                Show usage information
:output (table|csv)  Set the output format
:width <n>           Set the number of columns in the table output
neo4j> MATCH (n:Person) RETURN n LIMIT 3;
+----------------------------------------------------------------------------+
| n                                                                          |
+----------------------------------------------------------------------------+
| (:Person{born:1964,name:"<NAME>"})                                   |
| (:Person{born:1967,name:"<NAME>"})                               |
| (:Person{born:1961,name:"<NAME>"})                             |
+----------------------------------------------------------------------------+
neo4j> :exit
$
```


libneo4j-client Usage
---------------------

libneo4j-client provides a single C header file, `neo4j-client.h`, for
inclusion in source code using the libneo4j-client API. The API is described in
the [API Documentation](#api_documentation).

libneo4j-client can be included in your project by linking the library at
compile time, typically using the linking flags `-lneo4j-client -lssl -lcrypto`.
Alternatively, libneo4j-client ships with a [pkg-config](
https://wiki.freedesktop.org/www/Software/pkg-config/) description file,
enabling you to obtain the required flags using
`pkg-config --libs libneo4j-client`.


API Documentation
-----------------

API documentation for the latest release is available at
[https://cleishm.github.io/libneo4j-client/doc/latest/neo4j-client\_8h.html](
[https://cleishm.github.io/libneo4j-client/doc/latest/neo4j-client_8h.html).

Documentation can be built using `make doc`, which will use doxygen to generate
documentation and output it into the `doc/` directory of the libneo4j-client
source tree. See [Building](#Building) below.


Example
-------

```C
#include <neo4j-client.h>
#include <errno.h>
#include <stdio.h>

static void error(const char *msg);

int main(int argc, char *argv[])
{
    neo4j_client_init();

    neo4j_connection_t *connection = neo4j_connect("neo4j://localhost:7687", NULL, 0);
    if (connection == NULL)
    {
        error("Connection failed");
    }

    neo4j_session_t *session = neo4j_new_session(connection);
    if (session == NULL)
    {
        error("Failed to start session");
    }

    neo4j_result_stream_t *results = neo4j_run(session, "RETURN 'hello world'", NULL, 0);
    if (results == NULL)
    {
        error("Failed to run statement");
    }

    neo4j_result_t *result = neo4j_fetch_next(results);
    if (results == NULL)
    {
        error("Failed to fetch result");
    }

    neo4j_value_t value = neo4j_result_field(result, 0);
    char buf[128];
    printf("%s\n", neo4j_tostring(value, buf, sizeof(buf)));

    neo4j_close_results(results);
    neo4j_end_session(session);
    neo4j_close(connection);
    neo4j_client_cleanup();
}

void error(const char *msg)
{
    char ebuf[256];
    fprintf(stderr, "%s: %s\n", msg, neo4j_strerror(errno, ebuf, sizeof(ebuf)));
    exit(1);
}
```


Building
--------

To build software using libneo4j-client, consider installing libneo4j-client
using the package management system for your operating system.

If libneo4j-client is not available via your package management system,
please [download the latest release](
https://github.com/cleishm/libneo4j-client/releases) and then:

```
$ ./configure
$ make clean check
$ sudo make install
```

libneo4j-client requires some dependencies to build, including OpenSSL and
[libedit](http://thrysoee.dk/editline/). The need for these can be disabled
by invoking configure with `--without-tls` or `--disable-tools` respectively.

NOTE: Recent versions of Mac OS X ship without the OpenSSL header files, and
autoconf doesn't pick this up (yet). If you get a build failure related to
missing openssl headers, use homebrew to add the headers with
`brew link openssl --force`.

To checkout from GitHub and build:

```
$ git clone https://github.com/cleishm/libneo4j-client.git
{'fraction_non_alphanumeric': 0.15285213217648144, 'fraction_numerical': 0.024367731216540522, 'mean_word_length': 2.760846928149948, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '548405', 'n_tokens_mistral': 3356, 'n_tokens_neox': 3104, 'n_words': 1078}