Subversion Repositories oidplus

Rev

Rev 863 | Rev 1086 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 863 Rev 1050
Line 15... Line 15...
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
17
 * limitations under the License.
18
 */
18
 */
19
 
19
 
20
if (!defined('INSIDE_OIDPLUS')) die();
20
namespace ViaThinkSoft\OIDplus;
21
 
21
 
22
class OIDplusDatabaseConnectionMySQLi extends OIDplusDatabaseConnection {
22
class OIDplusDatabaseConnectionMySQLi extends OIDplusDatabaseConnection {
23
        private $conn = null; // only with MySQLnd
23
        private $conn = null; // only with MySQLnd
24
        private $prepare_cache = array();
24
        private $prepare_cache = array();
25
        private $last_error = null; // we need that because MySQL divides prepared statement errors and normal query errors, but we have only one "error()" method
25
        private $last_error = null; // we need that because MySQL divides prepared statement errors and normal query errors, but we have only one "error()" method
Line 102... Line 102...
102
                $password = OIDplus::baseConfig()->getValue('MYSQL_PASSWORD', '');
102
                $password = OIDplus::baseConfig()->getValue('MYSQL_PASSWORD', '');
103
                $database = OIDplus::baseConfig()->getValue('MYSQL_DATABASE', 'oidplus');
103
                $database = OIDplus::baseConfig()->getValue('MYSQL_DATABASE', 'oidplus');
104
                $socket   = OIDplus::baseConfig()->getValue('MYSQL_SOCKET',   '');
104
                $socket   = OIDplus::baseConfig()->getValue('MYSQL_SOCKET',   '');
105
                list($hostname,$port) = explode(':', $host.':'.ini_get("mysqli.default_port"));
105
                list($hostname,$port) = explode(':', $host.':'.ini_get("mysqli.default_port"));
106
                $port = intval($port);
106
                $port = intval($port);
107
                $this->conn = @new mysqli($hostname, $username, $password, $database, $port, $socket);
107
                $this->conn = @new \mysqli($hostname, $username, $password, $database, $port, $socket);
108
                if (!empty($this->conn->connect_error) || ($this->conn->connect_errno != 0)) {
108
                if (!empty($this->conn->connect_error) || ($this->conn->connect_errno != 0)) {
109
                        $message = $this->conn->connect_error;
109
                        $message = $this->conn->connect_error;
110
                        throw new OIDplusConfigInitializationException(trim(_L('Connection to the database failed!').' '.$message));
110
                        throw new OIDplusConfigInitializationException(trim(_L('Connection to the database failed!').' '.$message));
111
                }
111
                }
112
 
112