Documentation

DatabaseHelpers
in package
uses DatabaseTrait

Useful functions for dealing with Database data

Table of Contents

Properties

$error_message  : string

Methods

castStringToFloat()  : float|null
This function is used to cast the value stream values to the data type of the attribute/tag
castStringToInt()  : int|null
This function is used to cast the value stream values to the data type of the attribute/tag
configErrorMessage()  : string
Returns the configuration error message.
convertPostgresTypeArray()  : array<string|int, mixed>
Take a postgres typed array and converts it to a php array e.g. {"test 1","test 2"} from postgres will yield ["test 1", "test 2"]
getConfig()  : TiqConfig
Gets the TIQ configuration.
getDb()  : PgSQL
Gets database instance.
isDebug()  : bool
Is debug mode or not.
resolveHistoryTable()  : string
Resolves the history table name for a given node ID (tag or attribute)

Properties

$error_message

public static string $error_message = 'An issue occurred, please contact ThinkIQ for Support and enable debugging'
  • Base error message

Methods

castStringToFloat()

This function is used to cast the value stream values to the data type of the attribute/tag

public static castStringToFloat(string|null $string) : float|null
Parameters
$string : string|null
Return values
float|null

castStringToInt()

This function is used to cast the value stream values to the data type of the attribute/tag

public static castStringToInt(string|null $string) : int|null
Parameters
$string : string|null
Return values
int|null

configErrorMessage()

Returns the configuration error message.

public static configErrorMessage() : string
Return values
string

convertPostgresTypeArray()

Take a postgres typed array and converts it to a php array e.g. {"test 1","test 2"} from postgres will yield ["test 1", "test 2"]

public static convertPostgresTypeArray(string|null $data[, string $type_hint = 'string' ]) : array<string|int, mixed>
Parameters
$data : string|null
  • The postgres typed array.
$type_hint : string = 'string'

values can be int, float, string

Tags
throws
Exception
Return values
array<string|int, mixed>

getConfig()

Gets the TIQ configuration.

public static getConfig() : TiqConfig
Return values
TiqConfig

getDb()

Gets database instance.

public static getDb() : PgSQL

The database connection is stored in a static property within the DatabaseConnectionManager class, ensuring that it is truly a singleton across the entire application, regardless of which class calls this method.

Return values
PgSQL

isDebug()

Is debug mode or not.

public static isDebug() : bool
Return values
bool

resolveHistoryTable()

Resolves the history table name for a given node ID (tag or attribute)

public static resolveHistoryTable(string|int $node_id) : string
Parameters
$node_id : string|int
  • FQN or tag_id or attribute_id
Tags
throws
HistoryTableResolutionException

if the history table cannot be determined

throws
NotImplementedException
throws
Exception
Return values
string
  • The history table name (without schema prefix)

        
On this page

Search results