| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * Licensed to CRATE Technology GmbH("Crate") under one or more contributor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * license agreements.  See the NOTICE file distributed with this work for | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * additional information regarding copyright ownership.  Crate licenses | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * this file to you under the Apache License, Version 2.0 (the "License"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * you may not use this file except in compliance with the License.  You may | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * obtain a copy of the License at | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * http://www.apache.org/licenses/LICENSE-2.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * Unless required by applicable law or agreed to in writing, software | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * License for the specific language governing permissions and limitations | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * under the License. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * However, if you have executed another commercial license agreement | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * with Crate these terms will supersede the license and you may use the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * software solely pursuant to the terms of the relevant commercial agreement. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | namespace Crate\DBAL\Driver\PDOCrate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | use Crate\PDO\PDO; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | use Doctrine\DBAL\Driver\PDO\Exception; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | use Doctrine\DBAL\Driver\PDO\Statement; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | use Doctrine\DBAL\Driver\ServerInfoAwareConnection; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | use Doctrine\DBAL\Driver\Statement as StatementInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | class PDOConnection extends PDO implements ServerInfoAwareConnection | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      * @param string $dsn | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      * @param string $user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 | 12 |  |      * @param string $password | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      * @param array $options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 | 12 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 | 12 |  |     public function __construct($dsn, $user = null, $password = null, array $options = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 | 12 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         parent::__construct($dsn, $user, $password, $options); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, CrateStatement::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      * Checks whether a query is required to retrieve the database server version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 | 6 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      * @return boolean True if a query is required to retrieve the database server version, false otherwise. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 | 6 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     public function requiresQueryForServerVersion() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |      * References: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |      * - https://github.com/doctrine/dbal/issues/2025 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |      * - https://github.com/doctrine/dbal/pull/517 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      * - https://github.com/doctrine/dbal/pull/373 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     public function prepare($sql, $options = null): StatementInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |             $stmt = $this->connection->prepare($sql, $options); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |             assert($stmt instanceof PDOStatement); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |             return new Statement($stmt); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         } catch (PDOException $exception) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |             throw Exception::new($exception); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 78 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 79 |  |  |     public function exec($sql): int | 
            
                                                                        
                            
            
                                    
            
            
                | 80 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  |         try { | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  |             $result = $this->connection->exec($sql); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 84 |  |  |             assert($result !== false); | 
            
                                                                        
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  |             return $result; | 
            
                                                                        
                            
            
                                    
            
            
                | 87 |  |  |         } catch (PDOException $exception) { | 
            
                                                                        
                            
            
                                    
            
            
                | 88 |  |  |             throw Exception::new($exception); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 91 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 92 |  |  |  | 
            
                        
This interface has been deprecated. The supplier of the interface has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.