tab_mail_attachments
in package
Class tab_mail_attachments
Represents a table for storing mail attachments in a database.
Table of Contents
Properties
- $allowedCols : array<string|int, mixed>
- Declares an array of allowed column names.
- $db : db_master
Methods
- __construct() : mixed
- Class constructor.
- __destruct() : void
- Destructor method for the class.
- delete() : bool
- Delete a record from the mail_attachments table based on a given value and column.
- get() : array<string|int, mixed>|bool
- Retrieve the first record from the 'mail_attachments' table that matches the specified column and value.
- getall() : array<string|int, mixed>|bool
- Retrieve all records from the 'mail_attachments' table that match the specified column and value.
- insert() : bool
- Insert a new record into the mail_attachments table.
Properties
$allowedCols
Declares an array of allowed column names.
protected
array<string|int, mixed>
$allowedCols
= ['id', 'mail', 'attachment']
An array containing allowed column names. The column names can include the following values: 'id', 'mail', 'attachment'.
$db
protected
db_master
$db
- The instance of the db_master class used for database operations.
Methods
__construct()
Class constructor.
public
__construct() : mixed
Initializes an instance of the class and assigns the global database manager object to the property $db.
__destruct()
Destructor method for the class.
public
__destruct() : void
This method is automatically called when the object is destroyed. It is used to clean up any resources or variables that were used during the lifespan of the object.
delete()
Delete a record from the mail_attachments table based on a given value and column.
public
delete(string $val[, string $col = 'mail' ]) : bool
Parameters
- $val : string
-
The value to search for.
- $col : string = 'mail'
-
The column to search in. Default is 'mail'.
Return values
bool —Returns true if the record was deleted successfully, false otherwise.
get()
Retrieve the first record from the 'mail_attachments' table that matches the specified column and value.
public
get(string $val[, string $col = 'mail' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to search for in the specified column.
- $col : string = 'mail'
-
The column to search in. Defaults to 'mail'.
Return values
array<string|int, mixed>|bool —The first matching record if found, or false if the specified column is not allowed or no records are found.
getall()
Retrieve all records from the 'mail_attachments' table that match the specified column and value.
public
getall(string $val[, string $col = 'mail' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to search for in the specified column.
- $col : string = 'mail'
-
The column to search in. Defaults to 'mail'.
Return values
array<string|int, mixed>|bool —An array of matching records if found, or false if the specified column is not allowed or no records are found.
insert()
Insert a new record into the mail_attachments table.
public
insert(string $mailid, string $attachment) : bool
Parameters
- $mailid : string
-
The mail ID to insert.
- $attachment : string
-
The attachment to insert.
Return values
bool —Return true if the record was successfully inserted, false otherwise.