Name

SPVM::DBI::St - Statement Handle

Description

DBI::St class in SPVM represents a statement handle. This class is a base class for statement handles, and each method is expected to be overridden in child classes like DBI::St::SQLite.

Usage

class DBD::MyDiriver::St extends DBI::St {
  
  # Overriding a method
  method execute : long ($ctx : Go::Context, $bind_values : object[] = undef) {
    
    # Implement a logic
  }
  
}

Fields

Database

has Database : ro DBI::Db;

The database handle that created this statement handle.

Statement

has Statement : ro string;

The SQL statement string.

Instance Methods

option_names

protected method option_names : string[] ()

Returns the valid option names for this statement handle. This method is intended to be overridden in child classes.

NUM_OF_FIELDS

method NUM_OF_FIELDS : int ($ctx : Go::Context)

In a child class, this method must return the number of fields (columns) in the result set.

Exceptions:

Always throws a DBI::Error::SQLState exception whose message begins with a 5-character SQLSTATE "IM001" because this method is not implemented.

NAME

method NAME : string[] ($ctx : Go::Context)

In a child class, this method must return an array of column names.

Exceptions:

Always throws a DBI::Error::SQLState exception whose message begins with a 5-character SQLSTATE "IM001" because this method is not implemented.

NULLABLE

method NULLABLE : int[] ($ctx : Go::Context)

In a child class, this method must return an array indicating if each column is nullable.

Exceptions:

Always throws a DBI::Error::SQLState exception whose message begins with a 5-character SQLSTATE "IM001" because this method is not implemented.

TYPE

method TYPE : int[] ($ctx : Go::Context)

In a child class, this method must return an array of column types.

Exceptions:

Always throws a DBI::Error::SQLState exception whose message begins with a 5-character SQLSTATE "IM001" because this method is not implemented.

PRECISION

method PRECISION : int[] ($ctx : Go::Context)

In a child class, this method must return an array of column precision values.

Exceptions:

Always throws a DBI::Error::SQLState exception whose message begins with a 5-character SQLSTATE "IM001" because this method is not implemented.

SCALE

method SCALE : int[] ($ctx : Go::Context)

In a child class, this method must return an array of column scale values.

Exceptions:

Always throws a DBI::Error::SQLState exception whose message begins with a 5-character SQLSTATE "IM001" because this method is not implemented.

execute

method execute : long ($ctx : Go::Context, $bind_values : object[] = undef)

In a child class, this method must execute the prepared statement and return the number of affected rows, or -1 if unknown.

Exceptions:

Always throws a DBI::Error::SQLState exception whose message begins with a 5-character SQLSTATE "IM001" because this method is not implemented.

fetchrow_array

method fetchrow_array : object[] ($ctx : Go::Context)

In a child class, this method must fetch the next row of data and return an array of objects or undef if there are no more rows.

Exceptions:

Always throws a DBI::Error::SQLState exception whose message begins with a 5-character SQLSTATE "IM001" because this method is not implemented.

rows

method rows : long ($ctx : Go::Context)

In a child class, this method must return the number of rows affected by the last execute.

Exceptions:

Always throws a DBI::Error::SQLState exception whose message begins with a 5-character SQLSTATE "IM001" because this method is not implemented.

finish

method finish : void ()

In a child class, this method is expected to indicate that no more data will be fetched from this statement handle.

Exceptions:

Always throws a DBI::Error::SQLState exception whose message begins with a 5-character SQLSTATE "IM001" because this method is not implemented.

DESTROY

method DESTROY : void ()

The destructor. Calls "finish".

See Also

DBI, DBI::Db, Go::Context

Repository

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

Author

Yuki Kimoto kimoto.yuki@gmail.com

Copyright & License

Copyright (c) 2026 Yuki Kimoto

MIT License