Refactor and enhance database and form operations

Significant changes have been implemented in the database operations, particularly in update and insert functions, ensuring more stable and efficient handling of queries. Form capabilities have been enhanced by adding new attributes for processing decimal steps, further improving data input methods. This update also includes considerable refactoring and security enhancements in the PDO class.
This commit is contained in:
stephan.kasdorf
2024-03-27 12:24:25 +01:00
parent a793f79798
commit e92091f235
27 changed files with 160 additions and 111 deletions

102
core/i/IDb.php Executable file
View File

@@ -0,0 +1,102 @@
<?php
namespace Nibiru\Adapter;
/**
* Created by PhpStorm.
* User: kasdorf
* Date: 10.11.17
* Time: 09:06
*/
interface IDb
{
/**
* @desc will update the a row with the $rowset parameter by the given id
* @param array $rowData
* @param int $id
* @return mixed
*/
public function updateRowById( array $rowData, int $id );
/**
* @desc updates a row by a given field and field where search value
* @param false $wherefield
* @param false $wherevalue
* @param false $rowfield
* @param false $rowvalue
* @return mixed
*/
public function updateRowByFieldWhere( $wherefield = false, $wherevalue = false, $rowfield = false, $rowvalue = false );
/**
* will return the last inserted id of the given table
* @return int
*/
public function lastInsertId();
/**
* @desc Will load the given database table as an array
* @return mixed
*/
public function loadTableAsArray();
/**
* @desc Has to select a given Rowset by the index ID of the table
* @param bool $id
* @return mixed
*/
public function selectRowsetById( $id = false );
/**
* @desc inserts a rowset into the table, by the given nextInsertIndex return
* value for the table
* @param bool $id
* @param array $rowset
* @return mixed
*/
public function insertRowsetById( $rowset = array(), $id = false );
/**
* @desc in order to have a page navigation a dataset should also be selectable
* by a min and max value, result limitation
* @param bool $min
* @param bool $max
* @return mixed
*/
public function selectDatasetByMinMax( $min = false, $max = false );
/**
* @desc insert a given array by a format into the table of the database
* @param array $dataset
* @return mixed
*/
public function insertArrayIntoTable( $dataset = array() );
/**
* @desc will return a result array from the searched where field from the database
* containing the entire dataset rows
* @param array $fieldWhere
* @param false $sortOrder
* @return mixed
*/
public function selectDatasetByFieldWhere( $fieldWhere = array(), $sortOrder = false );
/**
* @desc selects a row by the fieldname and the given value, should be
* array('fieldname' => 'value')
* @param array $field
* @return mixed
*/
public function selectRowByFieldWhere( $field = array() );
/**
* @desc beacause there is no autoindex this has to be part of every database model
* class, so the next index is always correctly set
* @return mixed
*/
public function nextInsertIndex();
/**
* @desc loads the password from the datbaase for remembering
* @param bool $user_name
* @return mixed
*/
public function loadPasswordByUsername( $user_name = false );
}