C API - Values
Version 0.4.0

The value class represents a single value of any type.

API Reference

void duckdb_destroy_value(duckdb_value *value);
duckdb_value duckdb_create_varchar(const char *text);
duckdb_value duckdb_create_int64(int64_t val);
char *duckdb_get_varchar(duckdb_value value);
int64_t duckdb_get_int64(duckdb_value value);

duckdb_destroy_value


Destroys the value and de-allocates all memory allocated for that type.

Syntax


void duckdb_destroy_value(
  duckdb_value *value
);

Parameters


  • value

The value to destroy.


duckdb_create_varchar


Creates a value from a varchar

Syntax


duckdb_value duckdb_create_varchar(
  const char *text
);

Parameters


  • value

The varchar value

  • returns

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_int64


Creates a value from an int64

Syntax


duckdb_value duckdb_create_int64(
  int64_t val
);

Parameters


  • value

The bigint value

  • returns

The value. This must be destroyed with duckdb_destroy_value.


duckdb_get_varchar


Obtains a string representation of the given value. The result must be destroyed with duckdb_free.

Syntax


char *duckdb_get_varchar(
  duckdb_value value
);

Parameters


  • value

The value

  • returns

The string value. This must be destroyed with duckdb_free.


duckdb_get_int64


Obtains an int64 of the given value.

Syntax


int64_t duckdb_get_int64(
  duckdb_value value
);

Parameters


  • value

The value

  • returns

The int64 value, or 0 if no conversion is possible


Search Shortcut cmd + k | ctrl + k