70 $this->Database =
get_package(
'database' ,
'last' , __FILE__ );
71 $this->DatabaseAlgorithms =
get_package(
'database::database_algorithms' ,
'last' , __FILE__ );
72 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
73 $this->SecurityParser =
get_package(
'security::security_parser' ,
'last' , __FILE__ );
74 $this->UserAlgorithms =
get_package(
'user::user_algorithms' ,
'last' , __FILE__ );
116 if( $this->AddLimitations ===
'1 = 1' )
118 $this->AddLimitations = $theAddLimitation;
122 throw(
new Exception(
'"AddLimitations" was already set' ) );
125 catch( Exception $e )
160 $this->Database->select(
161 $Fields ===
false ? $this->NativeTable.
'.*' : $Fields , $this->NativeTable ,
162 "( $this->AddLimitations ) AND $Condition"
166 catch( Exception $e )
194 private function fetch_create_parameters( $Record )
198 if(
get_field( $Record ,
'author' ,
false ) ===
false )
200 set_field( $Record ,
'author' , $this->UserAlgorithms->get_id() );
203 $Record = $this->SecurityParser->parse_parameters(
204 $Record ,
'author:integer;graph_type:integer;ordinatus:float;abscissa:integer'
207 return( $this->DatabaseAlgorithms->compile_fields_values( $Record ) );
209 catch( Exception $e )
241 list( $Fields , $Values ) = $this->fetch_create_parameters( $Record );
243 $this->Database->delete(
244 $this->NativeTable ,
"( $this->AddLimitations ) AND abscissa = ".
get_field( $Record ,
'abscissa' ).
245 ' AND graph_type = '.
get_field( $Record ,
'graph_type' )
247 $this->Database->commit();
249 $id = $this->DatabaseAlgorithms->create( $this->NativeTable , $Fields , $Values );
251 $EventManager =
get_package(
'event_manager' ,
'last' , __FILE__ );
252 $EventManager->trigger_event(
'on_after_create_graph_data' , array(
'id' => $id ) );
256 catch( Exception $e )