| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | namespace Soluble\Metadata\Reader\Mapping; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Soluble\Datatype\Column; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use ArrayObject; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | class PdoMysqlMapping | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 11 |  |  | { | 
            
                                                        
            
                                    
            
            
                | 12 | 4 |  |     public static function getDatatypeMapping(): ArrayObject | 
            
                                                        
            
                                    
            
            
                | 13 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 14 | 4 |  |         $mapping = new ArrayObject([ | 
            
                                                        
            
                                    
            
            
                | 15 | 4 |  |             'STRING' => ['type' => Column\Type::TYPE_STRING, 'native' => 'CHAR'], | 
            
                                                        
            
                                    
            
            
                | 16 |  |  |             'VAR_STRING' => ['type' => Column\Type::TYPE_STRING, 'native' => 'VARCHAR'], | 
            
                                                        
            
                                    
            
            
                | 17 |  |  |             // BLOBS ARE CURRENTLY SENT AS TEXT | 
            
                                                        
            
                                    
            
            
                | 18 |  |  |             // I DIDN'T FIND THE WAY TO MAKE THE DIFFERENCE !!! | 
            
                                                        
            
                                    
            
            
                | 19 |  |  |             'BLOB' => ['type' => Column\Type::TYPE_BLOB, 'native' => 'BLOB'], | 
            
                                                        
            
                                    
            
            
                | 20 |  |  |             'TINY_BLOB' => ['type' => Column\Type::TYPE_BLOB, 'native' => 'TINY_BLOB'], | 
            
                                                        
            
                                    
            
            
                | 21 |  |  |             'MEDIUM_BLOB' => ['type' => Column\Type::TYPE_BLOB, 'native' => 'MEDIUM_BLOB'], | 
            
                                                        
            
                                    
            
            
                | 22 |  |  |             'LONG_BLOB' => ['type' => Column\Type::TYPE_BLOB, 'native' => 'LONG_BLOB'], | 
            
                                                        
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 24 |  |  |             // integer | 
            
                                                        
            
                                    
            
            
                | 25 |  |  |             'TINY' => ['type' => Column\Type::TYPE_INTEGER, 'native' => 'TINYINT'], | 
            
                                                        
            
                                    
            
            
                | 26 |  |  |             'SHORT' => ['type' => Column\Type::TYPE_INTEGER, 'native' => 'SMALLINT'], | 
            
                                                        
            
                                    
            
            
                | 27 |  |  |             'INT24' => ['type' => Column\Type::TYPE_INTEGER, 'native' => 'MEDIUMINT'], | 
            
                                                        
            
                                    
            
            
                | 28 |  |  |             'LONG' => ['type' => Column\Type::TYPE_INTEGER, 'native' => 'INTEGER'], | 
            
                                                        
            
                                    
            
            
                | 29 |  |  |             'LONGLONG' => ['type' => Column\Type::TYPE_INTEGER, 'native' => 'BIGINT'], | 
            
                                                        
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 31 |  |  |             // timestamps | 
            
                                                        
            
                                    
            
            
                | 32 |  |  |             'TIMESTAMP' => ['type' => Column\Type::TYPE_DATETIME, 'native' => 'TIMESTAMP'], | 
            
                                                        
            
                                    
            
            
                | 33 |  |  |             'DATETIME' => ['type' => Column\Type::TYPE_DATETIME, 'native' => 'DATETIME'], | 
            
                                                        
            
                                    
            
            
                | 34 |  |  |             // dates | 
            
                                                        
            
                                    
            
            
                | 35 |  |  |             'DATE' => ['type' => Column\Type::TYPE_DATE, 'native' => 'DATE'], | 
            
                                                        
            
                                    
            
            
                | 36 |  |  |             'NEWDATE' => ['type' => Column\Type::TYPE_DATE, 'native' => 'DATE'], | 
            
                                                        
            
                                    
            
            
                | 37 |  |  |             // time | 
            
                                                        
            
                                    
            
            
                | 38 |  |  |             'TIME' => ['type' => Column\Type::TYPE_TIME, 'native' => 'TIME'], | 
            
                                                        
            
                                    
            
            
                | 39 |  |  |             // decimals | 
            
                                                        
            
                                    
            
            
                | 40 |  |  |             'DECIMAL' => ['type' => Column\Type::TYPE_DECIMAL, 'native' => 'DECIMAL'], | 
            
                                                        
            
                                    
            
            
                | 41 |  |  |             'NEWDECIMAL' => ['type' => Column\Type::TYPE_DECIMAL, 'native' => 'DECIMAL'], | 
            
                                                        
            
                                    
            
            
                | 42 |  |  |             'FLOAT' => ['type' => Column\Type::TYPE_FLOAT, 'native' => 'FLOAT'], | 
            
                                                        
            
                                    
            
            
                | 43 |  |  |             'DOUBLE' => ['type' => Column\Type::TYPE_FLOAT, 'native' => 'DOUBLE'], | 
            
                                                        
            
                                    
            
            
                | 44 |  |  |             // boolean | 
            
                                                        
            
                                    
            
            
                | 45 |  |  |             'BIT' => ['type' => Column\Type::TYPE_BIT, 'native' => 'BIT'], | 
            
                                                        
            
                                    
            
            
                | 46 |  |  |             'BOOLEAN' => ['type' => Column\Type::TYPE_BOOLEAN, 'native' => 'BOOLEAN'], | 
            
                                                        
            
                                    
            
            
                | 47 |  |  |             'GEOMETRY' => ['type' => Column\Type::TYPE_SPATIAL_GEOMETRY, 'native' => null], | 
            
                                                        
            
                                    
            
            
                | 48 |  |  |             'NULL' => ['type' => Column\Type::TYPE_NULL, 'native' => 'NULL'] | 
            
                                                        
            
                                    
            
            
                | 49 |  |  |         ]); | 
            
                                                        
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 51 | 4 |  |         return $mapping; | 
            
                                                        
            
                                    
            
            
                | 52 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 53 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 54 |  |  |  |