table_container

What is a table_container

The table_container class is designed to manage table-like data structures and facilitate operations like selection, removal, filtering, and querying. It provides a flexible and type-safe interface for handling complex data queries.

Obtaining the table_container from a database

To perform a query you need to obtain the table_container object from your database, you can do it by using the container_execute method, this will return a shared pointer pointing to the table_container

Methods

select(std::string number)

Selects a specific record in the table or all records.

  • Parameters:

    • number: Record index (string). Use "*" for all records.

  • Returns: A pointer to the current instance.

remove(std::string number)

Marks specific records for removal based on the index.

  • Parameters:

    • number: Record index (string). Use "*" to mark all records.

  • Returns: A pointer to the current instance.

from(std::string table_to_query)

Specifies the table to query and loads its data.

  • Parameters:

    • table_to_query: Name of the table to query.

  • Returns: A pointer to the current instance.

where(std::string value, std::any is, bool is_not = false)

Filters data rows based on a condition.

  • Parameters:

    • value: Column name to filter on.

    • is: Value to compare against.

    • is_not: Whether to invert the condition (default: false).

  • Returns: A pointer to the current instance.

get_output()

Retrieves filtered results or deletes records (depending on the operation).

  • Returns: A table_vec containing the filtered records.

Supported Data Types

The class supports the following data types:

  • INT

  • DOUBLE

  • FLOAT

  • STRING

  • BOOL

Example

Last updated