Name

SPVM::DBI::Data - Data Container for Special Types

Description

DBI::Data class in SPVM represents a data container for special types that cannot be represented by basic types like int or double.

This class holds a value as a string and a type_id to indicate how the value should be interpreted (e.g., as a large integer or a high-precision decimal).

This class implements Stringable interface.

Usage

use DBI::Data;

# Create a new data container
my $data = DBI::Data->new;
$data->set_type_id(DBI::Data->TYPE_ID_BIG_INT);
$data->set_value("123456789012345678901234567890");

# Stringification
my $string_value = $data->to_string;

Interfaces

Stringable

Enumerations

The following type IDs are defined in the enum section:

  • TYPE_ID_UNKNOWN (0)

    The data type is unknown.

  • TYPE_ID_BLOB (1)

    The data is a Binary Large Object (BLOB).

  • TYPE_ID_BIG_INT (2)

    The data is a large integer (e.g., Math::BigInt in Perl).

  • TYPE_ID_BIG_FLOAT (3)

    The data is a high-precision floating-point number (e.g., Math::BigFloat in Perl).

Fields

type_id

has type_id : rw int;

An ID that represents the data type. One of the values defined in the "Enumerations" section.

value

has value : rw string;

The data value represented as a string.

Class Methods

new

static method new : DBI::Data ()

Creates a new DBI::Data object.

Instance Methods

to_string

method to_string : string ()

Returns the "value" field. This method is intended to be used for stringification.

See Also

DBI, DBI::St, Stringable

Repository

https://github.com/yuki-kimoto/SPVM-DBI

Author

Yuki Kimoto kimoto.yuki@gmail.com

Copyright & License

Copyright (c) 2026 Yuki Kimoto

MIT License