69 $this->Database =
get_package(
'database' ,
'last' , __FILE__ );
70 $this->DatabaseAlgorithms =
get_package(
'database::database_algorithms' ,
'last' , __FILE__ );
71 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
72 $this->SecurityParser =
get_package(
'security::security_parser' ,
'last' , __FILE__ );
114 if( $this->AddLimitations ===
'1 = 1' )
116 $this->AddLimitations = $theAddLimitation;
120 throw(
new Exception(
'"AddLimitations" was already set' ) );
123 catch( Exception $e )
157 $Records = $this->Database->select(
158 '*' , $this->NativeTable ,
"( $this->AddLimitations ) AND $Condition"
161 foreach( $Records as $k => $v )
163 $Records[ $k ]->href = htmlspecialchars_decode( $Records[ $k ]->href , ENT_QUOTES );
168 catch( Exception $e )
212 function select( $Start , $Limit , $Field =
false , $Order =
false , $Condition =
'1 = 1' )
216 $Condition = $this->DatabaseAlgorithms->select_condition(
217 $Start , $Limit , $Field , $Order , $Condition , $this->NativeTable
222 catch( Exception $e )
254 $id = $this->Security->get( $id ,
'integer' );
256 $Records = $this->
unsafe_select( $this->NativeTable.
".id = $id" );
258 if( count( $Records ) == 0 )
260 throw(
new Exception(
'Record was not found' ) );
263 return( $Records[ 0 ] );
265 catch( Exception $e )
293 $Record = $this->SecurityParser->parse_parameters( $Record ,
'name:string;menu:string;href:string' );
295 list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
297 $id = $this->DatabaseAlgorithms->create( $this->NativeTable , $Fields , $Values );
301 catch( Exception $e )
333 $id = $this->Security->get( $id ,
'integer_list' );
335 return( $this->
unsafe_select( $this->NativeTable.
".id IN ( $id )" ) );
337 catch( Exception $e )
369 $id = $this->Security->get( $id ,
'integer_list' );
370 $Record = $this->SecurityParser->parse_parameters(
371 $Record ,
'name:string;menu:string;href:string' ,
'allow_not_set'
374 list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
376 if( isset( $Fields[ 0 ] ) )
378 $this->Database->update(
379 $this->NativeTable , $Fields , $Values ,
"( $this->AddLimitations ) AND id IN ( $id )"
381 $this->Database->commit();
384 catch( Exception $e )
408 function delete( $id )
412 $id = $this->Security->get( $id ,
'integer_list' );
416 $this->Database->delete( $this->NativeTable ,
"( $this->AddLimitations ) AND id IN ( $id )" );
417 $this->Database->commit();
419 catch( Exception $e )