Update database operations and form capabilities

Database operations have been redefined and additional functionality has been added for handling database queries. Functions for updating rows by ID and inserting array into table have been updated for better reliability. In addition, new form attributes for managing decimal steps have been added to enhance data input capabilities. Refactoring and security improvements have also been addressed in the PDO class.
This commit is contained in:
stephan.kasdorf
2024-03-21 16:25:13 +01:00
parent a7ce13334c
commit a793f79798
6 changed files with 147 additions and 29 deletions

View File

@@ -72,9 +72,21 @@ abstract class Db implements IDb
}
/**
* @param array $rowset
* @param bool $id
* @return mixed|void
* @desc will update the a row with the $rowset parameter by the given id
* @param array $rowData
* @param int $id
* @return bool
*/
public function updateRowById(array $rowData, int $id): bool
{
return Pdo::updateRowById( self::getTable()['table'], self::getTable()['fields'], $rowData, $id );
}
/**
* @desc inserts a rowset into the table, by the given nextInsertIndex return
* @param $rowset
* @param $id
* @return void
*/
public function insertRowsetById($rowset = array(), $id = false)
{
@@ -95,16 +107,17 @@ abstract class Db implements IDb
* @desc inserts an array into the database as on of the fields may be encrypted, but it has to be a varbinary field
* @param array $dataset
* @param bool $encrypted
* @return bool
*/
public function insertArrayIntoTable($dataset = array(), $encrypted = false)
public function insertArrayIntoTable($dataset = array(), $encrypted = false): bool
{
if($encrypted)
{
Pdo::insertArrayIntoTable(self::$table['table'], $dataset, $encrypted);
return Pdo::insertArrayIntoTable(self::$table['table'], $dataset, $encrypted);
}
else
{
Pdo::insertArrayIntoTable(self::$table['table'], $dataset);
return Pdo::insertArrayIntoTable(self::$table['table'], $dataset);
}
}