libneo4j-client-2.1.3
Data Structures | Typedefs | Functions | Variables
neo4j-client.h File Reference
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/uio.h>

Data Structures

struct  neo4j_logger
 A logger for neo4j client. More...
 
struct  neo4j_logger_provider
 A provider for a neo4j logger. More...
 
struct  neo4j_iostream
 An I/O stream for neo4j client. More...
 
struct  neo4j_connection_factory
 A factory for establishing communications with neo4j. More...
 
struct  neo4j_memory_allocator
 A memory allocator for neo4j client. More...
 
struct  neo4j_value_t
 A neo4j value. More...
 
struct  neo4j_map_entry_t
 An entry in a neo4j map. More...
 
struct  neo4j_failure_details
 Failure details. More...
 
struct  neo4j_update_counts
 Update counts. More...
 
struct  neo4j_statement_plan
 The plan (or profile) for an evaluated statement. More...
 
struct  neo4j_statement_execution_step
 An execution step in a plan (or profile) for an evaluated statement. More...
 

Typedefs

typedef struct neo4j_config neo4j_config_t
 Configuration for neo4j client.
 
typedef struct neo4j_connection neo4j_connection_t
 A connection to a neo4j server.
 
typedef struct neo4j_result_stream neo4j_result_stream_t
 A stream of results from a job.
 
typedef struct neo4j_result neo4j_result_t
 A result from a job.
 
typedef uint8_t neo4j_type_t
 A neo4j value type.
 
typedef ssize_t(* neo4j_password_callback_t) (void *userdata, char *buf, size_t len)
 Function type for callback when a passwords is required. More...
 
typedef int(* neo4j_basic_auth_callback_t) (void *userdata, const char *host, char *username, size_t usize, char *password, size_t psize)
 Function type for callback when username and/or password is required. More...
 
typedef int(* neo4j_unverified_host_callback_t) (void *userdata, const char *host, const char *fingerprint, neo4j_unverified_host_reason_t reason)
 Function type for callback when host verification has failed. More...
 

Functions

const char * libneo4j_client_version (void)
 The version string for libneo4j-client.
 
const char * libneo4j_client_id (void)
 The default client ID string for libneo4j-client.
 
int neo4j_client_init (void)
 Initialize the neo4j client library. More...
 
int neo4j_client_cleanup (void)
 Cleanup after use of the neo4j client library. More...
 
struct neo4j_logger_providerneo4j_std_logger_provider (FILE *stream, uint_fast8_t level, uint_fast32_t flags)
 Obtain a standard logger provider. More...
 
void neo4j_std_logger_provider_free (struct neo4j_logger_provider *provider)
 Free a standard logger provider. More...
 
const char * neo4j_log_level_str (uint_fast8_t level)
 The name for the logging level. More...
 
void neo4j_perror (FILE *stream, int errnum, const char *message)
 Print the error message corresponding to an error number. More...
 
const char * neo4j_strerror (int errnum, char *buf, size_t buflen)
 Look up the error message corresponding to an error number. More...
 
bool neo4j_instanceof (neo4j_value_t value, neo4j_type_t type)
 Check the type of a neo4j value. More...
 
const char * neo4j_typestr (neo4j_type_t t)
 Get a string description of the neo4j type. More...
 
char * neo4j_tostring (neo4j_value_t value, char *strbuf, size_t n)
 Get a string representation of a neo4j value. More...
 
size_t neo4j_ntostring (neo4j_value_t value, char *strbuf, size_t n)
 Get a UTF-8 string representation of a neo4j value. More...
 
ssize_t neo4j_fprint (neo4j_value_t value, FILE *stream)
 Print a UTF-8 string representation of a neo4j value to a stream. More...
 
bool neo4j_eq (neo4j_value_t value1, neo4j_value_t value2)
 Compare two neo4j values for equality. More...
 
neo4j_value_t neo4j_bool (bool value)
 Construct a neo4j value encoding a boolean. More...
 
bool neo4j_bool_value (neo4j_value_t value)
 Return the native boolean value from a neo4j boolean. More...
 
neo4j_value_t neo4j_int (long long value)
 Construct a neo4j value encoding an integer. More...
 
long long neo4j_int_value (neo4j_value_t value)
 Return the native integer value from a neo4j int. More...
 
neo4j_value_t neo4j_float (double value)
 Construct a neo4j value encoding a double. More...
 
double neo4j_float_value (neo4j_value_t value)
 Return the native double value from a neo4j float. More...
 
neo4j_value_t neo4j_ustring (const char *u, unsigned int n)
 Construct a neo4j value encoding a string. More...
 
unsigned int neo4j_string_length (neo4j_value_t value)
 Return the length of a neo4j UTF-8 string. More...
 
const char * neo4j_ustring_value (neo4j_value_t value)
 Return a pointer to a UTF-8 string. More...
 
char * neo4j_string_value (neo4j_value_t value, char *buffer, size_t length)
 Copy a neo4j string to a NULL terminated buffer. More...
 
neo4j_value_t neo4j_list (const neo4j_value_t *items, unsigned int n)
 Construct a neo4j value encoding a list. More...
 
unsigned int neo4j_list_length (neo4j_value_t value)
 Return the length of a neo4j list (number of entries). More...
 
neo4j_value_t neo4j_list_get (neo4j_value_t value, unsigned int index)
 Return an element from a neo4j list. More...
 
neo4j_value_t neo4j_map (const neo4j_map_entry_t *entries, unsigned int n)
 Construct a neo4j value encoding a map. More...
 
unsigned int neo4j_map_size (neo4j_value_t value)
 Return the size of a neo4j map (number of entries). More...
 
const neo4j_map_entry_t * neo4j_map_getentry (neo4j_value_t value, unsigned int index)
 Return an entry from a neo4j map. More...
 
neo4j_value_t neo4j_map_kget (neo4j_value_t value, neo4j_value_t key)
 Return a value from a neo4j map. More...
 
neo4j_map_entry_t neo4j_map_kentry (neo4j_value_t key, neo4j_value_t value)
 Constrct a neo4j map entry using a value key. More...
 
neo4j_value_t neo4j_node_labels (neo4j_value_t value)
 Return the label list of a neo4j node. More...
 
neo4j_value_t neo4j_node_properties (neo4j_value_t value)
 Return the property map of a neo4j node. More...
 
neo4j_value_t neo4j_node_identity (neo4j_value_t value)
 Return the identity of a neo4j node. More...
 
neo4j_value_t neo4j_relationship_type (neo4j_value_t value)
 Return the type of a neo4j relationship. More...
 
neo4j_value_t neo4j_relationship_properties (neo4j_value_t value)
 Return the property map of a neo4j relationship. More...
 
neo4j_value_t neo4j_relationship_identity (neo4j_value_t value)
 Return the identity of a neo4j relationship. More...
 
neo4j_value_t neo4j_relationship_start_node_identity (neo4j_value_t value)
 Return the start node identity for a neo4j relationship. More...
 
neo4j_value_t neo4j_relationship_end_node_identity (neo4j_value_t value)
 Return the end node identity for a neo4j relationship. More...
 
unsigned int neo4j_path_length (neo4j_value_t value)
 Return the length of a neo4j path. More...
 
neo4j_value_t neo4j_path_get_node (neo4j_value_t value, unsigned int hops)
 Return the node at a given distance into the path. More...
 
neo4j_value_t neo4j_path_get_relationship (neo4j_value_t value, unsigned int hops, bool *forward)
 Return the relationship for the given hop in the path. More...
 
neo4j_config_tneo4j_new_config (void)
 Generate a new neo4j client configuration. More...
 
void neo4j_config_free (neo4j_config_t *config)
 Release a neo4j client configuration. More...
 
neo4j_config_tneo4j_config_dup (const neo4j_config_t *config)
 Duplicate a neo4j client configuration. More...
 
void neo4j_config_set_client_id (neo4j_config_t *config, const char *client_id)
 Set the client ID. More...
 
const char * neo4j_config_get_client_id (const neo4j_config_t *config)
 Get the client ID in the neo4j client configuration. More...
 
int neo4j_config_set_username (neo4j_config_t *config, const char *username)
 Set the username in the neo4j client configuration. More...
 
const char * neo4j_config_get_username (const neo4j_config_t *config)
 Get the username in the neo4j client configuration. More...
 
int neo4j_config_set_password (neo4j_config_t *config, const char *password)
 Set the password in the neo4j client configuration. More...
 
int neo4j_config_set_basic_auth_callback (neo4j_config_t *config, neo4j_basic_auth_callback_t callback, void *userdata)
 Set the basic authentication callback. More...
 
int neo4j_config_set_TLS_private_key (neo4j_config_t *config, const char *path)
 Set the location of a TLS private key and certificate chain. More...
 
const char * neo4j_config_get_TLS_private_key (const neo4j_config_t *config)
 Obtain the path to the TLS private key and certificate chain. More...
 
int neo4j_config_set_TLS_private_key_password_callback (neo4j_config_t *config, neo4j_password_callback_t callback, void *userdata)
 Set the password callback for the TLS private key file. More...
 
int neo4j_config_set_TLS_private_key_password (neo4j_config_t *config, const char *password)
 Set the password for the TLS private key file. More...
 
int neo4j_config_set_TLS_ca_file (neo4j_config_t *config, const char *path)
 Set the location of a file containing TLS certificate authorities (and CRLs). More...
 
const char * neo4j_config_get_TLS_ca_file (const neo4j_config_t *config)
 Obtain the path to the TLS certificate authority file. More...
 
int neo4j_config_set_TLS_ca_dir (neo4j_config_t *config, const char *path)
 Set the location of a directory of TLS certificate authorities (and CRLs). More...
 
const char * neo4j_config_get_TLS_ca_dir (const neo4j_config_t *config)
 Obtain the path to the TLS certificate authority directory. More...
 
int neo4j_config_set_trust_known_hosts (neo4j_config_t *config, bool enable)
 Enable or disable trusting of known hosts. More...
 
bool neo4j_config_get_trust_known_hosts (const neo4j_config_t *config)
 Check if trusting of known hosts is enabled. More...
 
int neo4j_config_set_known_hosts_file (neo4j_config_t *config, const char *path)
 Set the location of the known hosts file for TLS certificates. More...
 
const char * neo4j_config_get_known_hosts_file (const neo4j_config_t *config)
 Obtain the path to the known hosts file. More...
 
int neo4j_config_set_unverified_host_callback (neo4j_config_t *config, neo4j_unverified_host_callback_t callback, void *userdata)
 Set the unverified host callback. More...
 
int neo4j_config_set_sndbuf_size (neo4j_config_t *config, size_t size)
 Set the I/O output buffer size. More...
 
size_t neo4j_config_get_sndbuf_size (const neo4j_config_t *config)
 Get the size for the I/O output buffer. More...
 
int neo4j_config_set_rcvbuf_size (neo4j_config_t *config, size_t size)
 Set the I/O input buffer size. More...
 
size_t neo4j_config_get_rcvbuf_size (const neo4j_config_t *config)
 Get the size for the I/O input buffer. More...
 
void neo4j_config_set_logger_provider (neo4j_config_t *config, struct neo4j_logger_provider *logger_provider)
 Set a logger provider in the neo4j client configuration. More...
 
int neo4j_config_set_so_sndbuf_size (neo4j_config_t *config, unsigned int size)
 Set the socket send buffer size. More...
 
unsigned int neo4j_config_get_so_sndbuf_size (const neo4j_config_t *config)
 Get the size for the socket send buffer. More...
 
int neo4j_config_set_so_rcvbuf_size (neo4j_config_t *config, unsigned int size)
 Set the socket receive buffer size. More...
 
unsigned int neo4j_config_get_so_rcvbuf_size (const neo4j_config_t *config)
 Get the size for the socket receive buffer. More...
 
void neo4j_config_set_connection_factory (neo4j_config_t *config, struct neo4j_connection_factory *factory)
 Set a connection factory. More...
 
void neo4j_config_set_memory_allocator (neo4j_config_t *config, struct neo4j_memory_allocator *allocator)
 Set a memory allocator. More...
 
struct neo4j_memory_allocatorneo4j_config_get_memory_allocator (const neo4j_config_t *config)
 Get the memory allocator. More...
 
void neo4j_config_set_max_pipelined_requests (neo4j_config_t *config, unsigned int n)
 Set the maximum number of requests that can be pipelined to the server. More...
 
unsigned int neo4j_config_get_max_pipelined_requests (const neo4j_config_t *config)
 Get the maximum number of requests that can be pipelined to the server. More...
 
ssize_t neo4j_dot_dir (char *buffer, size_t n, const char *append)
 Return a path within the neo4j dot directory. More...
 
neo4j_connection_tneo4j_connect (const char *uri, neo4j_config_t *config, uint_fast32_t flags)
 Establish a connection to a neo4j server. More...
 
neo4j_connection_tneo4j_tcp_connect (const char *hostname, unsigned int port, neo4j_config_t *config, uint_fast32_t flags)
 Establish a connection to a neo4j server. More...
 
int neo4j_close (neo4j_connection_t *connection)
 Close a connection to a neo4j server. More...
 
const char * neo4j_connection_hostname (const neo4j_connection_t *connection)
 Get the hostname for a connection. More...
 
unsigned int neo4j_connection_port (const neo4j_connection_t *connection)
 Get the port for a connection. More...
 
const char * neo4j_connection_username (const neo4j_connection_t *connection)
 Get the username for a connection. More...
 
bool neo4j_connection_is_secure (const neo4j_connection_t *connection)
 Check if a given connection uses TLS. More...
 
int neo4j_reset (neo4j_connection_t *connection)
 Reset a session. More...
 
bool neo4j_credentials_expired (const neo4j_connection_t *connection)
 Check if the server indicated that credentials have expired. More...
 
const char * neo4j_server_id (const neo4j_connection_t *connection)
 Get the server ID string. More...
 
neo4j_result_stream_tneo4j_run (neo4j_connection_t *connection, const char *statement, neo4j_value_t params)
 Evaluate a statement. More...
 
neo4j_result_stream_tneo4j_send (neo4j_connection_t *connection, const char *statement, neo4j_value_t params)
 Evaluate a statement, ignoring any results. More...
 
int neo4j_check_failure (neo4j_result_stream_t *results)
 Check if a results stream has failed. More...
 
unsigned int neo4j_nfields (neo4j_result_stream_t *results)
 Get the number of fields in a result stream. More...
 
const char * neo4j_fieldname (neo4j_result_stream_t *results, unsigned int index)
 Get the name of a field in a result stream. More...
 
neo4j_result_tneo4j_fetch_next (neo4j_result_stream_t *results)
 Fetch the next record from the result stream. More...
 
neo4j_result_tneo4j_peek (neo4j_result_stream_t *results, unsigned int depth)
 Peek at a record in the result stream. More...
 
int neo4j_close_results (neo4j_result_stream_t *results)
 Close a result stream. More...
 
const char * neo4j_error_code (neo4j_result_stream_t *results)
 Return the error code sent from neo4j. More...
 
const char * neo4j_error_message (neo4j_result_stream_t *results)
 Return the error message sent from neo4j. More...
 
const struct neo4j_failure_detailsneo4j_failure_details (neo4j_result_stream_t *results)
 Return the details of a statement evaluation failure. More...
 
int neo4j_statement_type (neo4j_result_stream_t *results)
 Return the statement type for the result stream. More...
 
struct neo4j_update_counts neo4j_update_counts (neo4j_result_stream_t *results)
 Return the update counts for the result stream. More...
 
struct neo4j_statement_planneo4j_statement_plan (neo4j_result_stream_t *results)
 Return the statement plan for the result stream. More...
 
void neo4j_statement_plan_release (struct neo4j_statement_plan *plan)
 Release a statement plan. More...
 
neo4j_value_t neo4j_result_field (const neo4j_result_t *result, unsigned int index)
 Get a field from a result. More...
 
neo4j_result_tneo4j_retain (neo4j_result_t *result)
 Retain a result. More...
 
void neo4j_release (neo4j_result_t *result)
 Release a result. More...
 
void neo4j_config_set_render_nulls (neo4j_config_t *config, bool enable)
 Enable or disable rendering NEO4J_NULL values. More...
 
bool neo4j_config_get_render_nulls (const neo4j_config_t *config)
 Check if rendering of NEO4J_NULL values is enabled. More...
 
void neo4j_config_set_render_quoted_strings (neo4j_config_t *config, bool enable)
 Enable or disable quoting of NEO4J_STRING values. More...
 
bool neo4j_config_get_render_quoted_strings (const neo4j_config_t *config)
 Check if quoting of NEO4J_STRING values is enabled. More...
 
void neo4j_config_set_render_ascii (neo4j_config_t *config, bool enable)
 Enable or disable rendering in ASCII-only. More...
 
bool neo4j_config_get_render_ascii (const neo4j_config_t *config)
 Check if ASCII-only rendering is enabled. More...
 
void neo4j_config_set_render_rowlines (neo4j_config_t *config, bool enable)
 Enable or disable rendering of rowlines in result tables. More...
 
bool neo4j_config_get_render_rowlines (const neo4j_config_t *config)
 Check if rendering of rowlines is enabled. More...
 
void neo4j_config_set_render_wrapped_values (neo4j_config_t *config, bool enable)
 Enable or disable wrapping of values in result tables. More...
 
bool neo4j_config_get_render_wrapped_values (const neo4j_config_t *config)
 Check if wrapping of values in result tables is enabled. More...
 
void neo4j_config_set_render_wrap_markers (neo4j_config_t *config, bool enable)
 Enable or disable the rendering of wrap markers when wrapping or truncating. More...
 
bool neo4j_config_get_render_wrap_markers (const neo4j_config_t *config)
 Check if wrap markers will be rendered when wrapping or truncating. More...
 
void neo4j_config_set_render_inspect_rows (neo4j_config_t *config, unsigned int rows)
 Set the number of results to inspect when determining column widths. More...
 
unsigned int neo4j_config_get_render_inspect_rows (const neo4j_config_t *config)
 Set the number of results to inspect when determining column widths. More...
 
void neo4j_config_set_results_table_colors (neo4j_config_t *config, const struct neo4j_results_table_colors *colors)
 Set the colorization rules for rendering of results tables. More...
 
const struct neo4j_results_table_colors * neo4j_config_get_results_table_colors (const neo4j_config_t *config)
 Get the colorization rules for rendering of results tables. More...
 
void neo4j_config_set_plan_table_colors (neo4j_config_t *config, const struct neo4j_plan_table_colors *colors)
 Set the colorization rules for rendering of plan tables. More...
 
const struct neo4j_plan_table_colors * neo4j_config_get_plan_table_colorization (const neo4j_config_t *config)
 Get the colorization rules for rendering of plan tables. More...
 
int neo4j_render_table (FILE *stream, neo4j_result_stream_t *results, unsigned int width, uint_fast32_t flags)
 Render a result stream as a table. More...
 
int neo4j_render_results_table (const neo4j_config_t *config, FILE *stream, neo4j_result_stream_t *results, unsigned int width)
 Render a result stream as a table. More...
 
int neo4j_render_csv (FILE *stream, neo4j_result_stream_t *results, uint_fast32_t flags)
 Render a result stream as comma separated value. More...
 
int neo4j_render_ccsv (const neo4j_config_t *config, FILE *stream, neo4j_result_stream_t *results)
 Render a result stream as comma separated value. More...
 
int neo4j_render_plan_table (FILE *stream, struct neo4j_statement_plan *plan, unsigned int width, uint_fast32_t flags)
 Render a statement plan as a table. More...
 
int neo4j_render_plan_ctable (const neo4j_config_t *config, FILE *stream, struct neo4j_statement_plan *plan, unsigned int width)
 Render a statement plan as a table. More...
 
ssize_t neo4j_dirname (const char *path, char *buffer, size_t n)
 Obtain the parent directory of a specified path. More...
 
ssize_t neo4j_basename (const char *path, char *buffer, size_t n)
 Obtain the basename of a specified path. More...
 
int neo4j_mkdir_p (const char *path)
 Create a directory and any required parent directories. More...
 
int neo4j_u8clen (const char *s, size_t n)
 Return the number of bytes in a UTF-8 character. More...
 
int neo4j_u8cwidth (const char *s, size_t n)
 Return the column width of a UTF-8 character. More...
 
int neo4j_u8codepoint (const char *s, size_t *n)
 Return the Unicode codepoint of a UTF-8 character. More...
 
int neo4j_u8cpwidth (int cp)
 Return the column width of a Unicode codepoint. More...
 
int neo4j_u8cswidth (const char *s, size_t n)
 Return the column width of a UTF-8 string. More...
 
neo4j_type_t neo4j_type (neo4j_value_t value)
 Get the type of a neo4j value. More...
 
bool neo4j_is_null (neo4j_value_t value)
 Check if a neo4j value is the null value. More...
 
neo4j_value_t neo4j_string (const char *s)
 Construct a neo4j value encoding a string. More...
 
neo4j_value_t neo4j_map_get (neo4j_value_t value, const char *key)
 Return a value from a neo4j map. More...
 
neo4j_map_entry_t neo4j_map_entry (const char *key, neo4j_value_t value)
 Constrct a neo4j map entry. More...
 

Variables

const neo4j_type_t NEO4J_NULL
 The neo4j null value type. More...
 
const neo4j_type_t NEO4J_BOOL
 The neo4j boolean value type. More...
 
const neo4j_type_t NEO4J_INT
 The neo4j integer value type. More...
 
const neo4j_type_t NEO4J_FLOAT
 The neo4j float value type. More...
 
const neo4j_type_t NEO4J_STRING
 The neo4j string value type. More...
 
const neo4j_type_t NEO4J_LIST
 The neo4j list value type. More...
 
const neo4j_type_t NEO4J_MAP
 The neo4j map value type. More...
 
const neo4j_type_t NEO4J_NODE
 The neo4j node value type. More...
 
const neo4j_type_t NEO4J_RELATIONSHIP
 The neo4j relationship value type. More...
 
const neo4j_type_t NEO4J_PATH
 The neo4j path value type. More...
 
const neo4j_type_t NEO4J_IDENTITY
 The neo4j identity value type. More...
 
const neo4j_value_t neo4j_null
 The neo4j null value.
 
struct neo4j_connection_factory neo4j_std_connection_factory
 The standard connection factory.
 
const struct neo4j_results_table_colors * neo4j_results_table_no_colors
 Results table colorization rules for uncolorized table output. More...
 
const struct neo4j_results_table_colors * neo4j_results_table_ansi_colors
 Results table colorization rules for ANSI terminal output. More...
 
const struct neo4j_plan_table_colors * neo4j_plan_table_no_colors
 Plan table colorization rules for uncolorized plan table output. More...
 
const struct neo4j_plan_table_colors * neo4j_plan_table_ansi_colors
 Plan table colorization rules for ANSI terminal output. More...
 

Typedef Documentation

◆ neo4j_basic_auth_callback_t

typedef int(* neo4j_basic_auth_callback_t) (void *userdata, const char *host, char *username, size_t usize, char *password, size_t psize)

Function type for callback when username and/or password is required.

Should update the NULL terminated strings in the username and/or password buffers.

Parameters
[userdata]The user data for the callback.
[host]The host description (typically "<hostname>:<port>").
[username]A buffer of size usize, possibly containing a NULL terminated default username.
[usize]The size of the username buffer.
[password]A buffer of size psize, possibly containing a NULL terminated default password.
[psize]The size of the password buffer.
Returns
0 on success, -1 on error (errno should be set).

◆ neo4j_password_callback_t

typedef ssize_t(* neo4j_password_callback_t) (void *userdata, char *buf, size_t len)

Function type for callback when a passwords is required.

Should copy the password into the supplied buffer, and return the actual length of the password.

Parameters
[userdata]The user data for the callback.
[buf]The buffer to copy the password into.
[len]The length of the buffer.
Returns
The length of the password as copied into the buffer.

◆ neo4j_unverified_host_callback_t

typedef int(* neo4j_unverified_host_callback_t) (void *userdata, const char *host, const char *fingerprint, neo4j_unverified_host_reason_t reason)

Function type for callback when host verification has failed.

Parameters
[userdata]The user data for the callback.
[host]The host description (typically "<hostname>:<port>").
[fingerprint]The fingerprint for the host.
[reason]The reason for the verification failure, which will be either NEO4J_HOST_VERIFICATION_UNRECOGNIZED or NEO4J_HOST_VERIFICATION_MISMATCH.
Returns
NEO4J_HOST_VERIFICATION_REJECT if the host should be rejected, NEO4J_HOST_VERIFICATION_ACCEPT_ONCE if the host should be accepted for just the one connection, NEO4J_HOST_VERIFICATION_TRUST if the fingerprint should be stored in the "known hosts" file and thus trusted for future connections, or -1 on error (errno should be set).

Function Documentation

◆ neo4j_basename()

ssize_t neo4j_basename ( const char *  path,
char *  buffer,
size_t  n 
)

Obtain the basename of a specified path.

Parameters
[path]The path.
[buffer]A buffer to place the base name into, or NULL.
[n]The length of the buffer.
Returns
The length of the base name, or -1 on error (errno will be set).

◆ neo4j_bool()

neo4j_value_t neo4j_bool ( bool  value)

Construct a neo4j value encoding a boolean.

Parameters
[value]A boolean value.
Returns
A neo4j value encoding the Bool.

◆ neo4j_bool_value()

bool neo4j_bool_value ( neo4j_value_t  value)

Return the native boolean value from a neo4j boolean.

Note that the result is undefined if the value is not of type NEO4J_BOOL.

Parameters
[value]The neo4j value
Returns
The native boolean true or false

◆ neo4j_check_failure()

int neo4j_check_failure ( neo4j_result_stream_t results)

Check if a results stream has failed.

Note: if the error is NEO4J_STATEMENT_EVALUATION_FAILED, then additional error information will be available via neo4j_error_message().

Parameters
[results]The result stream.
Returns
0 if no failure has occurred, and an error number otherwise.

◆ neo4j_client_cleanup()

int neo4j_client_cleanup ( void  )

Cleanup after use of the neo4j client library.

Whilst it is not necessary to call this function, it can be useful for clearing any allocated memory when testing with tools such as valgrind.

Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_client_init()

int neo4j_client_init ( void  )

Initialize the neo4j client library.

This function should be invoked once per application including the neo4j client library.

Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_close()

int neo4j_close ( neo4j_connection_t connection)

Close a connection to a neo4j server.

Parameters
[connection]The connection to close. This pointer will be invalid after the function returns.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_close_results()

int neo4j_close_results ( neo4j_result_stream_t results)

Close a result stream.

Closes the result stream and releases all memory held by it, including results and values obtained from it.

Attention
After this function is invoked, all neo4j_result_t objects fetched from this stream, and any values obtained from them, will be invalid and must not be accessed. Doing so will result in undetermined and unstable behaviour. This is true even if this function returns an error.
Parameters
[results]The result stream. The pointer will be invalid after the function returns.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_dup()

neo4j_config_t* neo4j_config_dup ( const neo4j_config_t config)

Duplicate a neo4j client configuration.

The returned configuration must be later released using neo4j_config_free().

Parameters
[config]A pointer to a neo4j client configuration.
Returns
A duplicate configuration.

◆ neo4j_config_free()

void neo4j_config_free ( neo4j_config_t config)

Release a neo4j client configuration.

Parameters
[config]A pointer to a neo4j client configuration. This pointer will be invalid after the function returns.

◆ neo4j_config_get_client_id()

const char* neo4j_config_get_client_id ( const neo4j_config_t config)

Get the client ID in the neo4j client configuration.

Parameters
[config]The neo4j client configuration.
Returns
A pointer to the client ID, or NULL if one is not set.

◆ neo4j_config_get_known_hosts_file()

const char* neo4j_config_get_known_hosts_file ( const neo4j_config_t config)

Obtain the path to the known hosts file.

Parameters
[config]The neo4j client configuration.
Returns
The path set in the config, or NULL if none.

◆ neo4j_config_get_max_pipelined_requests()

unsigned int neo4j_config_get_max_pipelined_requests ( const neo4j_config_t config)

Get the maximum number of requests that can be pipelined to the server.

Parameters
[config]The neo4j client configuration.
Returns
The number of requests that can be pipelined.

◆ neo4j_config_get_memory_allocator()

struct neo4j_memory_allocator* neo4j_config_get_memory_allocator ( const neo4j_config_t config)

Get the memory allocator.

Parameters
[config]The neo4j client configuration.
Returns
The memory allocator.

◆ neo4j_config_get_plan_table_colorization()

const struct neo4j_plan_table_colors* neo4j_config_get_plan_table_colorization ( const neo4j_config_t config)

Get the colorization rules for rendering of plan tables.

Parameters
[config]The neo4j client configuration to update.
Returns
The colorization rules for plan table rendering.

◆ neo4j_config_get_rcvbuf_size()

size_t neo4j_config_get_rcvbuf_size ( const neo4j_config_t config)

Get the size for the I/O input buffer.

Parameters
[config]The neo4j client configuration.
Returns
The rcvbuf size.

◆ neo4j_config_get_render_ascii()

bool neo4j_config_get_render_ascii ( const neo4j_config_t config)

Check if ASCII-only rendering is enabled.

Note
This does not effect CSV output.
Parameters
[config]The neo4j client configuration.
Returns
true if ASCII-only rendering is enabled, and false otherwise.

◆ neo4j_config_get_render_inspect_rows()

unsigned int neo4j_config_get_render_inspect_rows ( const neo4j_config_t config)

Set the number of results to inspect when determining column widths.

Note
This only applies when rendering results to a table.
Parameters
[config]The neo4j client configuration.
Returns
The number of results that will be inspected to determine column widths.

◆ neo4j_config_get_render_nulls()

bool neo4j_config_get_render_nulls ( const neo4j_config_t config)

Check if rendering of NEO4J_NULL values is enabled.

Parameters
[config]The neo4j client configuration.
Returns
true if rendering of NEO4J_NULL values is enabled, and false otherwise.

◆ neo4j_config_get_render_quoted_strings()

bool neo4j_config_get_render_quoted_strings ( const neo4j_config_t config)

Check if quoting of NEO4J_STRING values is enabled.

Note
This only applies when rendering to a table. In CSV output, strings are always quoted.
Parameters
[config]The neo4j client configuration.
Returns
true if quoting of NEO4J_STRING values is enabled, and false otherwise.

◆ neo4j_config_get_render_rowlines()

bool neo4j_config_get_render_rowlines ( const neo4j_config_t config)

Check if rendering of rowlines is enabled.

Note
This only applies when rendering results to a table.
Parameters
[config]The neo4j client configuration.
Returns
true if rowline rendering is enabled, and false otherwise.

◆ neo4j_config_get_render_wrap_markers()

bool neo4j_config_get_render_wrap_markers ( const neo4j_config_t config)

Check if wrap markers will be rendered when wrapping or truncating.

Note
This only applies when rendering results to a table.
Parameters
[config]The neo4j client configuration.
Returns
true if wrap markers are enabled, and false otherwise.

◆ neo4j_config_get_render_wrapped_values()

bool neo4j_config_get_render_wrapped_values ( const neo4j_config_t config)

Check if wrapping of values in result tables is enabled.

Note
This only applies when rendering results to a table.
Parameters
[config]The neo4j client configuration.
Returns
true if wrapping of values is enabled, and false otherwise.

◆ neo4j_config_get_results_table_colors()

const struct neo4j_results_table_colors* neo4j_config_get_results_table_colors ( const neo4j_config_t config)

Get the colorization rules for rendering of results tables.

Parameters
[config]The neo4j client configuration to update.
Returns
The colorization rules for result table rendering.

◆ neo4j_config_get_sndbuf_size()

size_t neo4j_config_get_sndbuf_size ( const neo4j_config_t config)

Get the size for the I/O output buffer.

Parameters
[config]The neo4j client configuration.
Returns
The sndbuf size.

◆ neo4j_config_get_so_rcvbuf_size()

unsigned int neo4j_config_get_so_rcvbuf_size ( const neo4j_config_t config)

Get the size for the socket receive buffer.

Parameters
[config]The neo4j client configuration.
Returns
The so_rcvbuf size.

◆ neo4j_config_get_so_sndbuf_size()

unsigned int neo4j_config_get_so_sndbuf_size ( const neo4j_config_t config)

Get the size for the socket send buffer.

Parameters
[config]The neo4j client configuration.
Returns
The so_sndbuf size.

◆ neo4j_config_get_TLS_ca_dir()

const char* neo4j_config_get_TLS_ca_dir ( const neo4j_config_t config)

Obtain the path to the TLS certificate authority directory.

Parameters
[config]The neo4j client configuration.
Returns
The path set in the config, or NULL if none.

◆ neo4j_config_get_TLS_ca_file()

const char* neo4j_config_get_TLS_ca_file ( const neo4j_config_t config)

Obtain the path to the TLS certificate authority file.

Parameters
[config]The neo4j client configuration.
Returns
The path set in the config, or NULL if none.

◆ neo4j_config_get_TLS_private_key()

const char* neo4j_config_get_TLS_private_key ( const neo4j_config_t config)

Obtain the path to the TLS private key and certificate chain.

Parameters
[config]The neo4j client configuration.
Returns
The path set in the config, or NULL if none.

◆ neo4j_config_get_trust_known_hosts()

bool neo4j_config_get_trust_known_hosts ( const neo4j_config_t config)

Check if trusting of known hosts is enabled.

Parameters
[config]The neo4j client configuration.
Returns
true if enabled and false otherwise.

◆ neo4j_config_get_username()

const char* neo4j_config_get_username ( const neo4j_config_t config)

Get the username in the neo4j client configuration.

The returned username will only be valid whilst the configuration is unchanged.

Parameters
[config]The neo4j client configuration.
Returns
A pointer to the username, or NULL if one is not set.

◆ neo4j_config_set_basic_auth_callback()

int neo4j_config_set_basic_auth_callback ( neo4j_config_t config,
neo4j_basic_auth_callback_t  callback,
void *  userdata 
)

Set the basic authentication callback.

If a username and/or password is required for basic authentication and isn't available in the configuration or connection URI, then this callback will be invoked to obtain the username and/or password.

Parameters
[config]The neo4j client configuration to update.
[callback]The callback to be invoked.
[userdata]User data that will be supplied to the callback.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_client_id()

void neo4j_config_set_client_id ( neo4j_config_t config,
const char *  client_id 
)

Set the client ID.

The client ID will be used when identifying the client to neo4j.

Parameters
[config]The neo4j client configuration to update.
[client_id]The client ID string. This string should remain allocated whilst the config is allocated or if any connections opened with the config remain active.

◆ neo4j_config_set_connection_factory()

void neo4j_config_set_connection_factory ( neo4j_config_t config,
struct neo4j_connection_factory factory 
)

Set a connection factory.

Parameters
[config]The neo4j client configuration to update.
[factory]The connection factory.

◆ neo4j_config_set_known_hosts_file()

int neo4j_config_set_known_hosts_file ( neo4j_config_t config,
const char *  path 
)

Set the location of the known hosts file for TLS certificates.

The file, which will be created and maintained by neo4j client, will be used for storing trust information when using "Trust On First Use".

Parameters
[config]The neo4j client configuration to update.
[path]The path to known hosts file. This string should remain allocated whilst the config is allocated or if any connections opened with the config remain active.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_logger_provider()

void neo4j_config_set_logger_provider ( neo4j_config_t config,
struct neo4j_logger_provider logger_provider 
)

Set a logger provider in the neo4j client configuration.

Parameters
[config]The neo4j client configuration to update.
[logger_provider]The logger provider function.

◆ neo4j_config_set_max_pipelined_requests()

void neo4j_config_set_max_pipelined_requests ( neo4j_config_t config,
unsigned int  n 
)

Set the maximum number of requests that can be pipelined to the server.

Attention
Setting this value too high could result in deadlocking within the client, as the client will block when trying to send statements to a server with a full queue, instead of reading results that would drain the queue.
Parameters
[config]The neo4j client configuration to update.
[n]The new maximum.

◆ neo4j_config_set_memory_allocator()

void neo4j_config_set_memory_allocator ( neo4j_config_t config,
struct neo4j_memory_allocator allocator 
)

Set a memory allocator.

Parameters
[config]The neo4j client configuration to update.
[allocator]The memory allocator.

◆ neo4j_config_set_password()

int neo4j_config_set_password ( neo4j_config_t config,
const char *  password 
)

Set the password in the neo4j client configuration.

Parameters
[config]The neo4j client configuration to update.
[password]The password to authenticate with. The string will be duplicated, and thus may point to temporary memory.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_plan_table_colors()

void neo4j_config_set_plan_table_colors ( neo4j_config_t config,
const struct neo4j_plan_table_colors *  colors 
)

Set the colorization rules for rendering of plan tables.

Parameters
[config]The neo4j client configuration to update.
[colors]Colorization rules for plan tables. The pointer must remain valid until the config (and any duplicates) have been released.

◆ neo4j_config_set_rcvbuf_size()

int neo4j_config_set_rcvbuf_size ( neo4j_config_t config,
size_t  size 
)

Set the I/O input buffer size.

Parameters
[config]The neo4j client configuration to update.
[size]The I/O input buffer size.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_render_ascii()

void neo4j_config_set_render_ascii ( neo4j_config_t config,
bool  enable 
)

Enable or disable rendering in ASCII-only.

If set to true, then render output will only use ASCII characters and any non-ASCII characters in values will be escaped. Otherwise, UTF-8 characters will be used, including unicode border drawing characters.

Note
This does not effect CSV output.
Parameters
[config]The neo4j client configuration to update.
[enable]true to enable rendering in only ASCII characters, and false to disable this behaviour.

◆ neo4j_config_set_render_inspect_rows()

void neo4j_config_set_render_inspect_rows ( neo4j_config_t config,
unsigned int  rows 
)

Set the number of results to inspect when determining column widths.

If set to 0, no inspection will occur.

Note
This only applies when rendering results to a table.
Parameters
[config]The neo4j client configuration to update.
[rows]The number of results to inspect.

◆ neo4j_config_set_render_nulls()

void neo4j_config_set_render_nulls ( neo4j_config_t config,
bool  enable 
)

Enable or disable rendering NEO4J_NULL values.

If set to true, then NEO4J_NULL values will be rendered using the string 'null'. Otherwise, they will be blank.

Parameters
[config]The neo4j client configuration to update.
[enable]true to enable rendering of NEO4J_NULL values, and false to disable this behaviour.

◆ neo4j_config_set_render_quoted_strings()

void neo4j_config_set_render_quoted_strings ( neo4j_config_t config,
bool  enable 
)

Enable or disable quoting of NEO4J_STRING values.

If set to true, then NEO4J_STRING values will be rendered with surrounding quotes.

Note
This only applies when rendering to a table. In CSV output, strings are always quoted.
Parameters
[config]The neo4j client configuration to update.
[enable]true to enable rendering of NEO4J_STRING values with quotes, and false to disable this behaviour.

◆ neo4j_config_set_render_rowlines()

void neo4j_config_set_render_rowlines ( neo4j_config_t config,
bool  enable 
)

Enable or disable rendering of rowlines in result tables.

If set to true, then render output will separate each table row with a rowline.

Note
This only applies when rendering results to a table.
Parameters
[config]The neo4j client configuration to update.
[enable]true to enable rowline rendering, and false to disable this behaviour.

◆ neo4j_config_set_render_wrap_markers()

void neo4j_config_set_render_wrap_markers ( neo4j_config_t config,
bool  enable 
)

Enable or disable the rendering of wrap markers when wrapping or truncating.

If set to true, then values that are wrapped or truncated will be rendered with a wrap marker. The default value for this is true.

Note
This only applies when rendering results to a table.
Parameters
[config]The neo4j client configuration to update.
[enable]true to display wrap markers, and false to disable this behaviour.

◆ neo4j_config_set_render_wrapped_values()

void neo4j_config_set_render_wrapped_values ( neo4j_config_t config,
bool  enable 
)

Enable or disable wrapping of values in result tables.

If set to true, then values will be wrapped when rendering tables. Otherwise, they will be truncated.

Note
This only applies when rendering results to a table.
Parameters
[config]The neo4j client configuration to update.
[enable]true to enable value wrapping, and false to disable this behaviour.

◆ neo4j_config_set_results_table_colors()

void neo4j_config_set_results_table_colors ( neo4j_config_t config,
const struct neo4j_results_table_colors *  colors 
)

Set the colorization rules for rendering of results tables.

Parameters
[config]The neo4j client configuration to update.
[colors]Colorization rules for result tables. The pointer must remain valid until the config (and any duplicates) have been released.

◆ neo4j_config_set_sndbuf_size()

int neo4j_config_set_sndbuf_size ( neo4j_config_t config,
size_t  size 
)

Set the I/O output buffer size.

Parameters
[config]The neo4j client configuration to update.
[size]The I/O output buffer size.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_so_rcvbuf_size()

int neo4j_config_set_so_rcvbuf_size ( neo4j_config_t config,
unsigned int  size 
)

Set the socket receive buffer size.

This is only applicable to the standard connection factory.

Parameters
[config]The neo4j client configuration to update.
[size]The socket receive buffer size, or 0 to use the system default.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_so_sndbuf_size()

int neo4j_config_set_so_sndbuf_size ( neo4j_config_t config,
unsigned int  size 
)

Set the socket send buffer size.

This is only applicable to the standard connection factory.

Parameters
[config]The neo4j client configuration to update.
[size]The socket send buffer size, or 0 to use the system default.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_TLS_ca_dir()

int neo4j_config_set_TLS_ca_dir ( neo4j_config_t config,
const char *  path 
)

Set the location of a directory of TLS certificate authorities (and CRLs).

The specified directory should contain the certificates of the trusted CAs and CRLs, named by hash according to the c_rehash tool.

Parameters
[config]The neo4j client configuration to update.
[path]The path to the directory of CAs and CRLs. This string should remain allocated whilst the config is allocated or if any connections opened with the config remain active.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_TLS_ca_file()

int neo4j_config_set_TLS_ca_file ( neo4j_config_t config,
const char *  path 
)

Set the location of a file containing TLS certificate authorities (and CRLs).

The file should contain the certificates of the trusted CAs and CRLs. The file must be in base64 privacy enhanced mail (PEM) format.

Parameters
[config]The neo4j client configuration to update.
[path]The path to the PEM file containing the trusted CAs and CRLs. This string should remain allocated whilst the config is allocated or if any connections opened with the config remain active.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_TLS_private_key()

int neo4j_config_set_TLS_private_key ( neo4j_config_t config,
const char *  path 
)

Set the location of a TLS private key and certificate chain.

Parameters
[config]The neo4j client configuration to update.
[path]The path to the PEM file containing the private key and certificate chain. This string should remain allocated whilst the config is allocated or if any connections opened with the config remain active.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_TLS_private_key_password()

int neo4j_config_set_TLS_private_key_password ( neo4j_config_t config,
const char *  password 
)

Set the password for the TLS private key file.

This is a simpler alternative to using neo4j_config_set_TLS_private_key_password_callback().

Parameters
[config]The neo4j client configuration to update.
[password]The password for the certificate file. This string should remain allocated whilst the config is allocated or if any connections opened with the config remain active.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_TLS_private_key_password_callback()

int neo4j_config_set_TLS_private_key_password_callback ( neo4j_config_t config,
neo4j_password_callback_t  callback,
void *  userdata 
)

Set the password callback for the TLS private key file.

Parameters
[config]The neo4j client configuration to update.
[callback]The callback to be invoked whenever a password for the certificate file is required.
[userdata]User data that will be supplied to the callback.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_trust_known_hosts()

int neo4j_config_set_trust_known_hosts ( neo4j_config_t config,
bool  enable 
)

Enable or disable trusting of known hosts.

When enabled, the neo4j client will check if a host has been previously trusted and stored into the "known hosts" file, and that the host fingerprint still matches the previously accepted value. This is enabled by default.

If verification fails, the callback set with neo4j_config_set_unverified_host_callback() will be invoked.

Parameters
[config]The neo4j client configuration to update.
[enable]true to enable trusting of known hosts, and false to disable this behaviour.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_unverified_host_callback()

int neo4j_config_set_unverified_host_callback ( neo4j_config_t config,
neo4j_unverified_host_callback_t  callback,
void *  userdata 
)

Set the unverified host callback.

Parameters
[config]The neo4j client configuration to update.
[callback]The callback to be invoked whenever a host verification fails.
[userdata]User data that will be supplied to the callback.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_config_set_username()

int neo4j_config_set_username ( neo4j_config_t config,
const char *  username 
)

Set the username in the neo4j client configuration.

Parameters
[config]The neo4j client configuration to update.
[username]The username to authenticate with. The string will be duplicated, and thus may point to temporary memory.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_connect()

neo4j_connection_t* neo4j_connect ( const char *  uri,
neo4j_config_t config,
uint_fast32_t  flags 
)

Establish a connection to a neo4j server.

A bitmask of flags may be supplied, which may include:

  • NEO4J_INSECURE - do not attempt to establish a secure connection. If a secure connection is required, then connect will fail with errno set to NEO4J_SERVER_REQUIRES_SECURE_CONNECTION.
  • NEO4J_NO_URI_CREDENTIALS - do not use credentials provided in the server URI (use credentials from the configuration instead).
  • NEO4J_NO_URI_PASSWORD - do not use any password provided in the server URI (obtain password from the configuration instead).

If no flags are required, pass 0 or NEO4J_CONNECT_DEFAULT.

Parameters
[uri]A URI describing the server to connect to, which may also include authentication data (which will override any provided in the config).
[config]The neo4j client configuration to use for this connection.
[flags]A bitmask of flags to control connections.
Returns
A pointer to a neo4j_connection_t structure, or NULL on error (errno will be set).

◆ neo4j_connection_hostname()

const char* neo4j_connection_hostname ( const neo4j_connection_t connection)

Get the hostname for a connection.

Parameters
[connection]The neo4j connection.
Returns
A pointer to a hostname string, which will remain valid only whilst the connection remains open.

◆ neo4j_connection_is_secure()

bool neo4j_connection_is_secure ( const neo4j_connection_t connection)

Check if a given connection uses TLS.

Parameters
[connection]The neo4j connection.
Returns
true if the connection was established over TLS, and false otherwise.

◆ neo4j_connection_port()

unsigned int neo4j_connection_port ( const neo4j_connection_t connection)

Get the port for a connection.

Parameters
[connection]The neo4j connection.
Returns
The port of the connection.

◆ neo4j_connection_username()

const char* neo4j_connection_username ( const neo4j_connection_t connection)

Get the username for a connection.

Parameters
[connection]The neo4j connection.
Returns
A pointer to a username string, which will remain valid only whilst the connection remains open, or NULL if no username was associated with the connection.

◆ neo4j_credentials_expired()

bool neo4j_credentials_expired ( const neo4j_connection_t connection)

Check if the server indicated that credentials have expired.

Parameters
[connection]The connection.
Returns
true if the server indicated that credentials have expired, and false otherwise.

◆ neo4j_dirname()

ssize_t neo4j_dirname ( const char *  path,
char *  buffer,
size_t  n 
)

Obtain the parent directory of a specified path.

Any trailing '/' characters are not counted as part of the directory name. If path is NULL, the empty string, or contains no '/' characters, the path "." is placed into the result buffer.

Parameters
[path]The path.
[buffer]A buffer to place the parent directory path into, or NULL.
[n]The length of the buffer.
Returns
The length of the parent directory path, or -1 on error (errno will be set).

◆ neo4j_dot_dir()

ssize_t neo4j_dot_dir ( char *  buffer,
size_t  n,
const char *  append 
)

Return a path within the neo4j dot directory.

The neo4j dot directory is typically ".neo4j" within the users home directory. If append is NULL, then an absoulte path to the home directory is placed into buffer.

Parameters
[buffer]The buffer in which to place the path, which will be null terminated. If the buffer is NULL, then the function will still return the length of the path it would have placed into the buffer.
[n]The size of the buffer. If the path is too large to place into the buffer (including the terminating '\0' character), an ERANGE error will result.
[append]The relative path to append to the dot directory, which may be NULL.
Returns
The length of the resulting path (not including the null terminating character), or -1 on error (errno will be set).

◆ neo4j_eq()

bool neo4j_eq ( neo4j_value_t  value1,
neo4j_value_t  value2 
)

Compare two neo4j values for equality.

Parameters
[value1]The first neo4j value.
[value2]The second neo4j value.
Returns
true if the two values are equivalent, false otherwise.

◆ neo4j_error_code()

const char* neo4j_error_code ( neo4j_result_stream_t results)

Return the error code sent from neo4j.

When neo4j_check_failure() returns NEO4J_STATEMENT_EVALUATION_FAILED, then this function can be used to get the error code sent from neo4j.

Attention
Note that the returned pointer is only valid whilst the result stream has not been closed.
Parameters
[results]The result stream.
Returns
A NULL terminated string reprenting the error code, or NULL if the stream has not failed or the failure was not NEO4J_STATEMENT_EVALUATION_FAILED.

◆ neo4j_error_message()

const char* neo4j_error_message ( neo4j_result_stream_t results)

Return the error message sent from neo4j.

When neo4j_check_failure() returns NEO4J_STATEMENT_EVALUATION_FAILED, then this function can be used to get the detailed error message sent from neo4j.

Attention
Note that the returned pointer is only valid whilst the result stream has not been closed.
Parameters
[results]The result stream.
Returns
The error message, or NULL if the stream has not failed or the failure was not NEO4J_STATEMENT_EVALUATION_FAILED. If returned, the message will be a NULL terminated string and may contain UTF-8 mutli-byte characters.

◆ neo4j_failure_details()

Return the details of a statement evaluation failure.

When neo4j_check_failure() returns NEO4J_STATEMENT_EVALUATION_FAILED, then this function can be used to get the details of the failure.

Attention
Note that the returned pointer is only valid whilst the result stream has not been closed.
Parameters
[results]The result stream.
Returns
A pointer to the failure details, or NULL if no failure details were available.

◆ neo4j_fetch_next()

neo4j_result_t* neo4j_fetch_next ( neo4j_result_stream_t results)

Fetch the next record from the result stream.

Attention
The pointer to the result will only remain valid until the next call to neo4j_fetch_next() or until the result stream is closed. To hold the result longer, use neo4j_retain() and neo4j_release().
Parameters
[results]The result stream.
Returns
The next result, or NULL if the stream is exahusted or an error has occurred (errno will be set).

◆ neo4j_fieldname()

const char* neo4j_fieldname ( neo4j_result_stream_t results,
unsigned int  index 
)

Get the name of a field in a result stream.

Attention
Note that the returned pointer is only valid whilst the result stream has not been closed.
Parameters
[results]The result stream.
[index]The field index to get the name of.
Returns
The name of the field, or NULL on error (errno will be set). If returned, the name will be a NULL terminated string and may contain UTF-8 multi-byte characters.

◆ neo4j_float()

neo4j_value_t neo4j_float ( double  value)

Construct a neo4j value encoding a double.

Parameters
[value]A double precision floating point value.
Returns
A neo4j value encoding the Float.

◆ neo4j_float_value()

double neo4j_float_value ( neo4j_value_t  value)

Return the native double value from a neo4j float.

Note that the result is undefined if the value is not of type NEO4J_FLOAT.

Parameters
[value]The neo4j value
Returns
The native double value

◆ neo4j_fprint()

ssize_t neo4j_fprint ( neo4j_value_t  value,
FILE *  stream 
)

Print a UTF-8 string representation of a neo4j value to a stream.

Parameters
[value]The neo4j value.
[stream]The stream to print to.
Returns
The number of bytes written to the stream, or -1 on error (errno will be set).

◆ neo4j_instanceof()

bool neo4j_instanceof ( neo4j_value_t  value,
neo4j_type_t  type 
)

Check the type of a neo4j value.

Parameters
[value]The neo4j value.
[type]The neo4j type.
Returns
true if the node is of the specified type and false otherwise.

◆ neo4j_int()

neo4j_value_t neo4j_int ( long long  value)

Construct a neo4j value encoding an integer.

Parameters
[value]A signed integer. This must be in the range INT64_MIN to INT64_MAX, or it will be capped to the closest value.
Returns
A neo4j value encoding the Int.

◆ neo4j_int_value()

long long neo4j_int_value ( neo4j_value_t  value)

Return the native integer value from a neo4j int.

Note that the result is undefined if the value is not of type NEO4J_INT.

Parameters
[value]The neo4j value
Returns
The native integer value

◆ neo4j_is_null()

bool neo4j_is_null ( neo4j_value_t  value)

Check if a neo4j value is the null value.

Parameters
[value]The neo4j value.
Returns
true if the value is the null value.

◆ neo4j_list()

neo4j_value_t neo4j_list ( const neo4j_value_t *  items,
unsigned int  n 
)

Construct a neo4j value encoding a list.

Parameters
[items]An array of neo4j values. The pointer to the items must remain valid, and the content unchanged, for the lifetime of the neo4j value.
[n]The length of the array of items. This must be less than UINT32_MAX (or the list will be truncated).
Returns
A neo4j value encoding the List.

◆ neo4j_list_get()

neo4j_value_t neo4j_list_get ( neo4j_value_t  value,
unsigned int  index 
)

Return an element from a neo4j list.

Note that the result is undefined if the value is not of type NEO4J_LIST.

Parameters
[value]The neo4j list.
[index]The index of the element to return.
Returns
A pointer to a neo4j_value_t element, or NULL if the index is beyond the end of the list.

◆ neo4j_list_length()

unsigned int neo4j_list_length ( neo4j_value_t  value)

Return the length of a neo4j list (number of entries).

Note that the result is undefined if the value is not of type NEO4J_LIST.

Parameters
[value]The neo4j list.
Returns
The number of entries.

◆ neo4j_log_level_str()

const char* neo4j_log_level_str ( uint_fast8_t  level)

The name for the logging level.

Parameters
[level]The logging level.
Returns
A NULL terminated ASCII string describing the logging level.

◆ neo4j_map()

neo4j_value_t neo4j_map ( const neo4j_map_entry_t *  entries,
unsigned int  n 
)

Construct a neo4j value encoding a map.

Parameters
[entries]An array of neo4j map entries. This pointer must remain valid, and the content unchanged, for the lifetime of the neo4j value.
[n]The length of the array of entries. This must be less than UINT32_MAX (or the list of entries will be truncated).
Returns
A neo4j value encoding the Map.

◆ neo4j_map_entry()

neo4j_map_entry_t neo4j_map_entry ( const char *  key,
neo4j_value_t  value 
)

Constrct a neo4j map entry.

Parameters
[key]The null terminated string key for the entry.
[value]The value for the entry.
Returns
A neo4j map entry.

◆ neo4j_map_get()

neo4j_value_t neo4j_map_get ( neo4j_value_t  value,
const char *  key 
)

Return a value from a neo4j map.

Note that the result is undefined if the value is not of type NEO4J_MAP.

Parameters
[value]The neo4j map.
[key]The null terminated string key for the entry.
Returns
The value stored under the specified key, or NULL if the key is not known.

◆ neo4j_map_getentry()

const neo4j_map_entry_t* neo4j_map_getentry ( neo4j_value_t  value,
unsigned int  index 
)

Return an entry from a neo4j map.

Note that the result is undefined if the value is not of type NEO4J_MAP.

Parameters
[value]The neo4j map.
[index]The index of the entry to return.
Returns
The entry at the specified index, or NULL if the index is too large.

◆ neo4j_map_kentry()

neo4j_map_entry_t neo4j_map_kentry ( neo4j_value_t  key,
neo4j_value_t  value 
)

Constrct a neo4j map entry using a value key.

The value key must be of type NEO4J_STRING.

Parameters
[key]The key for the entry.
[value]The value for the entry.
Returns
A neo4j map entry.

◆ neo4j_map_kget()

neo4j_value_t neo4j_map_kget ( neo4j_value_t  value,
neo4j_value_t  key 
)

Return a value from a neo4j map.

Note that the result is undefined if the value is not of type NEO4J_MAP.

Parameters
[value]The neo4j map.
[key]The map key.
Returns
The value stored under the specified key, or NULL if the key is not known.

◆ neo4j_map_size()

unsigned int neo4j_map_size ( neo4j_value_t  value)

Return the size of a neo4j map (number of entries).

Note that the result is undefined if the value is not of type NEO4J_MAP.

Parameters
[value]The neo4j map.
Returns
The number of entries.

◆ neo4j_mkdir_p()

int neo4j_mkdir_p ( const char *  path)

Create a directory and any required parent directories.

Directories are created with default permissions as per the users umask.

Parameters
[path]The path of the directory to create.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_new_config()

neo4j_config_t* neo4j_new_config ( void  )

Generate a new neo4j client configuration.

The returned configuration must be later released using neo4j_config_free().

Returns
A pointer to a new neo4j client configuration, or NULL on error (errno will be set).

◆ neo4j_nfields()

unsigned int neo4j_nfields ( neo4j_result_stream_t results)

Get the number of fields in a result stream.

Parameters
[results]The result stream.
Returns
The number of fields in the result, or 0 if no fields were available or on error (errno will be set).

◆ neo4j_node_identity()

neo4j_value_t neo4j_node_identity ( neo4j_value_t  value)

Return the identity of a neo4j node.

Parameters
[value]The neo4j node.
Returns
A neo4j value encoding the Identity of the node.

◆ neo4j_node_labels()

neo4j_value_t neo4j_node_labels ( neo4j_value_t  value)

Return the label list of a neo4j node.

Note that the result is undefined if the value is not of type NEO4J_NODE.

Parameters
[value]The neo4j node.
Returns
A neo4j value encoding the List of labels.

◆ neo4j_node_properties()

neo4j_value_t neo4j_node_properties ( neo4j_value_t  value)

Return the property map of a neo4j node.

Note that the result is undefined if the value is not of type NEO4J_NODE.

Parameters
[value]The neo4j node.
Returns
A neo4j value encoding the Map of properties.

◆ neo4j_ntostring()

size_t neo4j_ntostring ( neo4j_value_t  value,
char *  strbuf,
size_t  n 
)

Get a UTF-8 string representation of a neo4j value.

Writes as much of the representation as possible into the buffer, ensuring it is always NULL terminated.

Parameters
[value]The neo4j value.
[strbuf]A buffer to write the string representation into.
[n]The length of the buffer.
Returns
The number of bytes that would have been written into the buffer had the buffer been large enough.

◆ neo4j_path_get_node()

neo4j_value_t neo4j_path_get_node ( neo4j_value_t  value,
unsigned int  hops 
)

Return the node at a given distance into the path.

Note that the result is undefined if the value is not of type NEO4J_PATH.

Parameters
[value]The neo4j path.
[hops]The number of hops (distance).
Returns
A neo4j value enconding the Node.

◆ neo4j_path_get_relationship()

neo4j_value_t neo4j_path_get_relationship ( neo4j_value_t  value,
unsigned int  hops,
bool *  forward 
)

Return the relationship for the given hop in the path.

Note that the result is undefined if the value is not of type NEO4J_PATH.

Parameters
[value]The neo4j path.
[hops]The number of hops (distance).
[forward]NULL, or a pointer to a boolean which will be set to true if the relationship was traversed in its natural direction and false if it was traversed backward.
Returns
A neo4j value enconding the Relationship.

◆ neo4j_path_length()

unsigned int neo4j_path_length ( neo4j_value_t  value)

Return the length of a neo4j path.

The length of a path is defined by the number of relationships included in it.

Note that the result is undefined if the value is not of type NEO4J_PATH.

Parameters
[value]The neo4j path.
Returns
The length of the path

◆ neo4j_peek()

neo4j_result_t* neo4j_peek ( neo4j_result_stream_t results,
unsigned int  depth 
)

Peek at a record in the result stream.

Attention
The pointer to the result will only remain valid until it is retreived via neo4j_fetch_next() or until the result stream is closed. To hold the result longer, use neo4j_retain() and neo4j_release().
All results up to the specified depth will be retrieved and held in memory. Avoid using this method with large depths.
Parameters
[results]The result stream.
[depth]The depth to peek into the remaining records in the stream.
Returns
The result at the specified depth, or NULL if the stream is exahusted or an error has occurred (errno will be set).

◆ neo4j_perror()

void neo4j_perror ( FILE *  stream,
int  errnum,
const char *  message 
)

Print the error message corresponding to an error number.

Parameters
[stream]The stream to write to.
[errnum]The error number.
[message]NULL, or a pointer to a message string which will be prepend to the error message, separated by a colon and space.

◆ neo4j_relationship_end_node_identity()

neo4j_value_t neo4j_relationship_end_node_identity ( neo4j_value_t  value)

Return the end node identity for a neo4j relationship.

Parameters
[value]The neo4j relationship.
Returns
A neo4j value encoding the Identity of the end node.

◆ neo4j_relationship_identity()

neo4j_value_t neo4j_relationship_identity ( neo4j_value_t  value)

Return the identity of a neo4j relationship.

Parameters
[value]The neo4j relationship.
Returns
A neo4j value encoding the Identity of the relationship.

◆ neo4j_relationship_properties()

neo4j_value_t neo4j_relationship_properties ( neo4j_value_t  value)

Return the property map of a neo4j relationship.

Note that the result is undefined if the value is not of type NEO4J_RELATIONSHIP.

Parameters
[value]The neo4j relationship.
Returns
A neo4j value encoding the Map of properties.

◆ neo4j_relationship_start_node_identity()

neo4j_value_t neo4j_relationship_start_node_identity ( neo4j_value_t  value)

Return the start node identity for a neo4j relationship.

Parameters
[value]The neo4j relationship.
Returns
A neo4j value encoding the Identity of the start node.

◆ neo4j_relationship_type()

neo4j_value_t neo4j_relationship_type ( neo4j_value_t  value)

Return the type of a neo4j relationship.

Note that the result is undefined if the value is not of type NEO4J_RELATIONSHIP.

Parameters
[value]The neo4j node.
Returns
A neo4j value encoding the type as a String.

◆ neo4j_release()

void neo4j_release ( neo4j_result_t result)

Release a result.

Parameters
[result]A previously retained result.

◆ neo4j_render_ccsv()

int neo4j_render_ccsv ( const neo4j_config_t config,
FILE *  stream,
neo4j_result_stream_t results 
)

Render a result stream as comma separated value.

Attention
The output will be written to the stream using UTF-8 encoding.
Parameters
[config]A neo4j client configuration.
[stream]The stream to render to.
[results]The results stream to render.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_render_csv()

int neo4j_render_csv ( FILE *  stream,
neo4j_result_stream_t results,
uint_fast32_t  flags 
)

Render a result stream as comma separated value.

A bitmask of flags may be supplied, which may include:

  • NEO4J_RENDER_SHOW_NULL - output 'null' when rendering NULL values, rather than an empty cell.

If no flags are required, pass 0 or NEO4J_RENDER_DEFAULT.

Attention
The output will be written to the stream using UTF-8 encoding.
Parameters
[stream]The stream to render to.
[results]The results stream to render.
[flags]A bitmask of flags to control rendering.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_render_plan_ctable()

int neo4j_render_plan_ctable ( const neo4j_config_t config,
FILE *  stream,
struct neo4j_statement_plan plan,
unsigned int  width 
)

Render a statement plan as a table.

Attention
The output will be written to the stream using UTF-8 encoding.
Parameters
[config]A neo4j client configuration.
[stream]The stream to render to.
[plan]The statement plan to render.
[width]The width of the table to render.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_render_plan_table()

int neo4j_render_plan_table ( FILE *  stream,
struct neo4j_statement_plan plan,
unsigned int  width,
uint_fast32_t  flags 
)

Render a statement plan as a table.

A bitmask of flags may be supplied, which may include:

  • NEO4J_RENDER_ASCII - use only ASCII characters when rendering.
  • NEO4J_RENDER_ANSI_COLOR - use ANSI escape codes for colorization.

If no flags are required, pass 0 or NEO4J_RENDER_DEFAULT.

Attention
The output will be written to the stream using UTF-8 encoding.
Parameters
[stream]The stream to render to.
[plan]The statement plan to render.
[width]The width of the table to render.
[flags]A bitmask of flags to control rendering.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_render_results_table()

int neo4j_render_results_table ( const neo4j_config_t config,
FILE *  stream,
neo4j_result_stream_t results,
unsigned int  width 
)

Render a result stream as a table.

Attention
The output will be written to the stream using UTF-8 encoding.
Parameters
[config]A neo4j client configuration.
[stream]The stream to render to.
[results]The results stream to render.
[width]The width of the table to render.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_render_table()

int neo4j_render_table ( FILE *  stream,
neo4j_result_stream_t results,
unsigned int  width,
uint_fast32_t  flags 
)

Render a result stream as a table.

A bitmask of flags may be supplied, which may include:

  • NEO4J_RENDER_SHOW_NULLS - output 'null' when rendering NULL values, rather than an empty cell.
  • NEO4J_RENDER_QUOTE_STRINGS - wrap strings in quotes.
  • NEO4J_RENDER_ASCII - use only ASCII characters when rendering.
  • NEO4J_RENDER_ROWLINES - render a line between each output row.
  • NEO4J_RENDER_WRAP_VALUES - wrap oversized values over multiple lines.
  • NEO4J_RENDER_NO_WRAP_MARKERS - don't indicate wrapping of values (should be used with NEO4J_RENDER_ROWLINES).
  • NEO4J_RENDER_ANSI_COLOR - use ANSI escape codes for colorization.

If no flags are required, pass 0 or NEO4J_RENDER_DEFAULT.

Attention
The output will be written to the stream using UTF-8 encoding.
Parameters
[stream]The stream to render to.
[results]The results stream to render.
[width]The width of the table to render.
[flags]A bitmask of flags to control rendering.
Returns
0 on success, or -1 on error (errno will be set).

◆ neo4j_reset()

int neo4j_reset ( neo4j_connection_t connection)

Reset a session.

Invoking this function causes all server-held state for the connection to be cleared, including rolling back any open transactions, and causes any existing result stream to be terminated.

Parameters
[connection]The connection to reset.
Returns
0 on sucess, or -1 on error (errno will be set).

◆ neo4j_result_field()

neo4j_value_t neo4j_result_field ( const neo4j_result_t result,
unsigned int  index 
)

Get a field from a result.

Parameters
[result]A result.
[index]The field index to get.
Returns
The field from the result, or neo4j_null if index is out of bounds.

◆ neo4j_retain()

neo4j_result_t* neo4j_retain ( neo4j_result_t result)

Retain a result.

This retains the result and all values contained within it, preventing them from being deallocated on the next call to neo4j_fetch_next() or when the result stream is closed via neo4j_close_results(). Once retained, the result must be explicitly released via neo4j_release().

Parameters
[result]A result.
Returns
The result.

◆ neo4j_run()

neo4j_result_stream_t* neo4j_run ( neo4j_connection_t connection,
const char *  statement,
neo4j_value_t  params 
)

Evaluate a statement.

Attention
The statement and the params must remain valid until the returned result stream is closed.
Parameters
[connection]The connection.
[statement]The statement to be evaluated. This must be a NULL terminated string and may contain UTF-8 multi-byte characters.
[params]The parameters for the statement, which must be a value of type NEO4J_MAP or neo4j_null.
Returns
A neo4j_result_stream_t, or NULL on error (errno will be set).

◆ neo4j_send()

neo4j_result_stream_t* neo4j_send ( neo4j_connection_t connection,
const char *  statement,
neo4j_value_t  params 
)

Evaluate a statement, ignoring any results.

The neo4j_result_stream_t returned from this function will not provide any results. It can be used to check for evaluation errors using neo4j_check_failure().

Parameters
[connection]The connection.
[statement]The statement to be evaluated. This must be a NULL terminated string and may contain UTF-8 multi-byte characters.
[params]The parameters for the statement, which must be a value of type NEO4J_MAP or neo4j_null.
Returns
A neo4j_result_stream_t, or NULL on error (errno will be set).

◆ neo4j_server_id()

const char* neo4j_server_id ( const neo4j_connection_t connection)

Get the server ID string.

Parameters
[connection]The connection.
Returns
The server ID string, or NULL if none was available.

◆ neo4j_statement_plan()

Return the statement plan for the result stream.

The returned statement plan, if not NULL, must be later released using neo4j_statement_plan_release().

If the was no plan (or profile) in the server response, the result of this function will be NULL and errno will be set to NEO4J_NO_PLAN_AVAILABLE. Note that errno will not be modified when a plan is returned, so error checking MUST evaluate the return value first.

Parameters
[results]The result stream.
Returns
The statement plan/profile, or NULL if a plan/profile was not available or on error (errno will be set).

◆ neo4j_statement_plan_release()

void neo4j_statement_plan_release ( struct neo4j_statement_plan plan)

Release a statement plan.

The pointer will be invalid and should not be used after this function is called.

Parameters
[plan]A statment plan.

◆ neo4j_statement_type()

int neo4j_statement_type ( neo4j_result_stream_t results)

Return the statement type for the result stream.

The returned value will be one of the following:

  • NEO4J_READ_ONLY_STATEMENT
  • NEO4J_WRITE_ONLY_STATEMENT
  • NEO4J_READ_WRITE_STATEMENT
  • NEO4J_SCHEMA_UPDATE_STATEMENT
  • NEO4J_CONTROL_STATEMENT
Attention
As the statement type is only available at the end of the result stream, invoking this function will will result in any unfetched results being pulled from the server and held in memory. It is usually better to exhaust the stream using neo4j_fetch_next() before invoking this method.
Parameters
[results]The result stream.
Returns
The statement type, or -1 on error (errno will be set).

◆ neo4j_std_logger_provider()

struct neo4j_logger_provider* neo4j_std_logger_provider ( FILE *  stream,
uint_fast8_t  level,
uint_fast32_t  flags 
)

Obtain a standard logger provider.

The logger will output to the provided FILE.

A bitmask of flags may be supplied, which may include:

  • NEO4J_STD_LOGGER_NO_PREFIX - don't output a prefix on each logline

If no flags are required, pass 0 or NEO4J_STD_LOGGER_DEFAULT.

Parameters
[stream]The stream to output to.
[level]The default level to log at.
[flags]A bitmask of flags for the standard logger output.
Returns
A neo4j_logger_provider, or NULL on error (errno will be set).

◆ neo4j_std_logger_provider_free()

void neo4j_std_logger_provider_free ( struct neo4j_logger_provider provider)

Free a standard logger provider.

Provider must have been obtained via neo4j_std_logger_provider().

Parameters
[provider]The provider to free.

◆ neo4j_strerror()

const char* neo4j_strerror ( int  errnum,
char *  buf,
size_t  buflen 
)

Look up the error message corresponding to an error number.

Parameters
[errnum]The error number.
[buf]A character buffer that may be used to hold the message.
[buflen]The length of the provided buffer.
Returns
A pointer to a character string containing the error message.

◆ neo4j_string()

neo4j_value_t neo4j_string ( const char *  s)

Construct a neo4j value encoding a string.

Parameters
[s]A pointer to a NULL terminated ASCII string. The pointer must remain valid, and the content unchanged, for the lifetime of the neo4j value.
Returns
A neo4j value encoding the String.

◆ neo4j_string_length()

unsigned int neo4j_string_length ( neo4j_value_t  value)

Return the length of a neo4j UTF-8 string.

Note that the result is undefined if the value is not of type NEO4J_STRING.

Parameters
[value]The neo4j string.
Returns
The length of the string in bytes.

◆ neo4j_string_value()

char* neo4j_string_value ( neo4j_value_t  value,
char *  buffer,
size_t  length 
)

Copy a neo4j string to a NULL terminated buffer.

As much of the string will be copied to the buffer as possible, and the result will be NULL terminated.

Note that the result is undefined if the value is not of type NEO4J_STRING.

Attention
The content copied to the buffer may contain UTF-8 multi-byte characters.
Parameters
[value]The neo4j string.
[buffer]A pointer to a buffer for storing the string. The pointer must remain valid, and the content unchanged, for the lifetime of the neo4j value.
[length]The length of the buffer.
Returns
A pointer to the supplied buffer.

◆ neo4j_tcp_connect()

neo4j_connection_t* neo4j_tcp_connect ( const char *  hostname,
unsigned int  port,
neo4j_config_t config,
uint_fast32_t  flags 
)

Establish a connection to a neo4j server.

A bitmask of flags may be supplied, which may include:

  • NEO4J_INSECURE - do not attempt to establish a secure connection. If a secure connection is required, then connect will fail with errno set to NEO4J_SERVER_REQUIRES_SECURE_CONNECTION.

If no flags are required, pass 0 or NEO4J_CONNECT_DEFAULT.

Parameters
[hostname]The hostname to connect to.
[port]The port to connect to.
[config]The neo4j client configuration to use for this connection.
[flags]A bitmask of flags to control connections.
Returns
A pointer to a neo4j_connection_t structure, or NULL on error (errno will be set).

◆ neo4j_tostring()

char* neo4j_tostring ( neo4j_value_t  value,
char *  strbuf,
size_t  n 
)

Get a string representation of a neo4j value.

Writes as much of the representation as possible into the buffer, ensuring it is always NULL terminated.

Parameters
[value]The neo4j value.
[strbuf]A buffer to write the string representation into.
[n]The length of the buffer.
Returns
A pointer to the provided buffer.

◆ neo4j_type()

neo4j_type_t neo4j_type ( neo4j_value_t  value)

Get the type of a neo4j value.

Parameters
[value]The neo4j value.
Returns
The type of the value.

◆ neo4j_typestr()

const char* neo4j_typestr ( neo4j_type_t  t)

Get a string description of the neo4j type.

Parameters
[t]The neo4j type.
Returns
A pointer to a NULL terminated string containing the type name.

◆ neo4j_u8clen()

int neo4j_u8clen ( const char *  s,
size_t  n 
)

Return the number of bytes in a UTF-8 character.

Parameters
[s]The sequence of bytes containing the character.
[n]The maximum number of bytes to inspect.
Returns
The length, in bytes, of the UTF-8 character, or -1 if a decoding error occurs (errno will be set).

◆ neo4j_u8codepoint()

int neo4j_u8codepoint ( const char *  s,
size_t *  n 
)

Return the Unicode codepoint of a UTF-8 character.

Parameters
[s]The sequence of bytes containing the character.
[n]A ponter to a size_t containing the maximum number of bytes to inspect. On successful return, this will be updated to contain the number of bytes consumed by the character.
Returns
The codepoint, or -1 if a decoding error occurs (errno will be set).

◆ neo4j_u8cpwidth()

int neo4j_u8cpwidth ( int  cp)

Return the column width of a Unicode codepoint.

Parameters
[cp]The codepoint value.
Returns
The width, in columns, of the Unicode codepoint, or -1 if the codepoint is unprintable.

◆ neo4j_u8cswidth()

int neo4j_u8cswidth ( const char *  s,
size_t  n 
)

Return the column width of a UTF-8 string.

Parameters
[s]The UTF-8 encoded string.
[n]The maximum number of bytes to inspect.
Returns
The width, in columns, of the UTF-8 string.

◆ neo4j_u8cwidth()

int neo4j_u8cwidth ( const char *  s,
size_t  n 
)

Return the column width of a UTF-8 character.

Parameters
[s]The sequence of bytes containing the character.
[n]The maximum number of bytes to inspect.
Returns
The width, in columns, of the UTF-8 character, or -1 if the character is unprintable or cannot be decoded.

◆ neo4j_update_counts()

Return the update counts for the result stream.

Attention
As the update counts are only available at the end of the result stream, invoking this function will will result in any unfetched results being pulled from the server and held in memory. It is usually better to exhaust the stream using neo4j_fetch_next() before invoking this method.
Parameters
[results]The result stream.
Returns
The update counts. If an error has occurred, all the counts will be zero.

◆ neo4j_ustring()

neo4j_value_t neo4j_ustring ( const char *  u,
unsigned int  n 
)

Construct a neo4j value encoding a string.

Parameters
[u]A pointer to a UTF-8 string. The pointer must remain valid, and the content unchanged, for the lifetime of the neo4j value.
[n]The length of the UTF-8 string. This must be less than UINT32_MAX in length (and will be truncated otherwise).
Returns
A neo4j value encoding the String.

◆ neo4j_ustring_value()

const char* neo4j_ustring_value ( neo4j_value_t  value)

Return a pointer to a UTF-8 string.

The pointer will be to a UTF-8 string, and will NOT be NULL terminated. The length of the string, in bytes, can be obtained using neo4j_ustring_length(value).

Note that the result is undefined if the value is not of type NEO4J_STRING.

Parameters
[value]The neo4j string.
Returns
A pointer to a UTF-8 string, which will not be terminated.

Variable Documentation

◆ NEO4J_BOOL

const neo4j_type_t NEO4J_BOOL

The neo4j boolean value type.

◆ NEO4J_FLOAT

const neo4j_type_t NEO4J_FLOAT

The neo4j float value type.

◆ NEO4J_IDENTITY

const neo4j_type_t NEO4J_IDENTITY

The neo4j identity value type.

◆ NEO4J_INT

const neo4j_type_t NEO4J_INT

The neo4j integer value type.

◆ NEO4J_LIST

const neo4j_type_t NEO4J_LIST

The neo4j list value type.

◆ NEO4J_MAP

const neo4j_type_t NEO4J_MAP

The neo4j map value type.

◆ NEO4J_NODE

const neo4j_type_t NEO4J_NODE

The neo4j node value type.

◆ NEO4J_NULL

const neo4j_type_t NEO4J_NULL

The neo4j null value type.

◆ NEO4J_PATH

const neo4j_type_t NEO4J_PATH

The neo4j path value type.

◆ neo4j_plan_table_ansi_colors

const struct neo4j_plan_table_colors* neo4j_plan_table_ansi_colors

Plan table colorization rules for ANSI terminal output.

◆ neo4j_plan_table_no_colors

const struct neo4j_plan_table_colors* neo4j_plan_table_no_colors

Plan table colorization rules for uncolorized plan table output.

◆ NEO4J_RELATIONSHIP

const neo4j_type_t NEO4J_RELATIONSHIP

The neo4j relationship value type.

◆ neo4j_results_table_ansi_colors

const struct neo4j_results_table_colors* neo4j_results_table_ansi_colors

Results table colorization rules for ANSI terminal output.

◆ neo4j_results_table_no_colors

const struct neo4j_results_table_colors* neo4j_results_table_no_colors

Results table colorization rules for uncolorized table output.

◆ NEO4J_STRING

const neo4j_type_t NEO4J_STRING

The neo4j string value type.