tab_users_signatures
in package
This class represents a data access layer for the `users_signatures` table.
It provides methods for retrieving, inserting, updating, and deleting records.
Table of Contents
Properties
- $allowedCols : array<string|int, mixed>
- This is an array that contains the list of allowed column names.
- $db : db_master
Methods
- __construct() : mixed
- Constructor for the class.
- __destruct() : void
- Destructor for the class.
- delete() : bool
- Deletes a record from the database based on the given value and column.
- get() : array<string|int, mixed>|bool
- Retrieves a record from the `users_signatures` table based on a specified value and column.
- insert() : bool
- Inserts a new record into the `users_signatures` table.
- update() : bool
- Updates the signature for a user based on the given UID.
Properties
$allowedCols
This is an array that contains the list of allowed column names.
protected
array<string|int, mixed>
$allowedCols
= ['id', 'uid', 'signature']
The columns included in this array can be used for filtering or sorting data.
$db
protected
db_master
$db
Methods
__construct()
Constructor for the class.
public
__construct() : mixed
__destruct()
Destructor for the class.
public
__destruct() : void
This method is automatically called when the object is no longer referenced or has gone out of scope.
It unsets the $db
and $allowedCols
properties of the object, freeing up memory.
delete()
Deletes a record from the database based on the given value and column.
public
delete(string $val[, string $col = 'uid' ]) : bool
Parameters
- $val : string
-
The value to match in the specified column.
- $col : string = 'uid'
-
The column name to search for the value. Default value is 'uid'.
Return values
bool —Returns true if the record is successfully deleted, false otherwise.
get()
Retrieves a record from the `users_signatures` table based on a specified value and column.
public
get(string $val[, string $col = 'uid' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to search for in the specified column.
- $col : string = 'uid'
-
The column to search for the value. (default: 'uid')
Return values
array<string|int, mixed>|bool —Returns the first matching record as an array or false if no match is found.
insert()
Inserts a new record into the `users_signatures` table.
public
insert(string $uid, string $sign) : bool
Parameters
- $uid : string
-
The unique identifier of the user.
- $sign : string
-
The signature of the user.
Return values
bool —Returns true if the record is successfully inserted, otherwise false.
update()
Updates the signature for a user based on the given UID.
public
update(string $uid, string $sign) : bool
Parameters
- $uid : string
-
The UID of the user.
- $sign : string
-
The new signature value.
Return values
bool —Returns true if the signature is successfully updated, false otherwise.