You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							55 lines
						
					
					
						
							1.5 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							55 lines
						
					
					
						
							1.5 KiB
						
					
					
				
								<?php
							 | 
						|
								
							 | 
						|
								namespace App\Wrappers;
							 | 
						|
								
							 | 
						|
								use App\Common\DateTimeHandling;
							 | 
						|
								use App\Common\ErrorPayloadRendering;
							 | 
						|
								use Aura\SqlQuery\Common\DeleteInterface;
							 | 
						|
								use Aura\SqlQuery\QueryFactory;
							 | 
						|
								use DateTime;
							 | 
						|
								
							 | 
						|
								class SQLQueryBuilderWrapper
							 | 
						|
								{
							 | 
						|
								    public static function SELECT(string $table)
							 | 
						|
								    {
							 | 
						|
								        $query_factory = new QueryFactory(db: 'mysql');
							 | 
						|
								        $query = $query_factory->newSelect()
							 | 
						|
								            ->from("$table AS T")
							 | 
						|
								            ;
							 | 
						|
								        return $query
							 | 
						|
								            ->cols([
							 | 
						|
								                "T.*",
							 | 
						|
								            ]);
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    public static function SELECT_ONE(string $table, string $id)
							 | 
						|
								    {
							 | 
						|
								        return self::SELECT(table: $table)
							 | 
						|
								            ->where(cond: "T.ID=:__id__")
							 | 
						|
								            ->bindValue(name: "__id__", value: $id)
							 | 
						|
								            ->limit(limit: 1)
							 | 
						|
								            ;
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    public static function SELECT_WITH_PARENT_ID(string $table, string $parentIDName, string $parentIDValue)
							 | 
						|
								    {
							 | 
						|
								        return self::SELECT(table: $table)
							 | 
						|
								            ->where(cond: "$parentIDName=:__parent_id__")
							 | 
						|
								            ->bindValue(name: "__parent_id__", value: $parentIDValue)
							 | 
						|
								            ;
							 | 
						|
								    }
							 | 
						|
								    public static function INSERT(string $table)
							 | 
						|
								    {
							 | 
						|
								        $query_factory = new QueryFactory(db: 'mysql');
							 | 
						|
								        return $query_factory->newInsert()
							 | 
						|
								            ->into("$table")
							 | 
						|
								            ;
							 | 
						|
								    }
							 | 
						|
								    public static function UPDATE(string $table)
							 | 
						|
								    {
							 | 
						|
								        $query_factory = new QueryFactory(db: 'mysql');
							 | 
						|
								        return $query_factory->newUpdate()
							 | 
						|
								            ->table(table: "$table")
							 | 
						|
								            ;
							 | 
						|
								    }
							 | 
						|
								}
							 | 
						|
								
							 |