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 OIDplusDatabaseConnectionPgSql extends OIDplusDatabaseConnection {
22
class OIDplusDatabaseConnectionPgSql extends OIDplusDatabaseConnection {
23
        private $conn = null;
23
        private $conn = null;
24
        private $already_prepared = array();
24
        private $already_prepared = array();
25
        private $last_error = null; // do the same like MySQL+PDO, just to be equal in the behavior
25
        private $last_error = null; // do the same like MySQL+PDO, just to be equal in the behavior
Line 71... Line 71...
71
        }
71
        }
72
 
72
 
73
        public function insert_id(): int {
73
        public function insert_id(): int {
74
                try {
74
                try {
75
                        return (int)$this->query('select lastval() as id')->fetch_object()->id;
75
                        return (int)$this->query('select lastval() as id')->fetch_object()->id;
76
                } catch (Exception $e) {
76
                } catch (\Exception $e) {
77
                        return 0;
77
                        return 0;
78
                }
78
                }
79
        }
79
        }
80
 
80
 
81
        public function error(): string {
81
        public function error(): string {
Line 125... Line 125...
125
                $this->already_prepared = array();
125
                $this->already_prepared = array();
126
                $this->last_error = null;
126
                $this->last_error = null;
127
 
127
 
128
                try {
128
                try {
129
                        $this->query("SET NAMES 'utf8'");
129
                        $this->query("SET NAMES 'utf8'");
130
                } catch (Exception $e) {
130
                } catch (\Exception $e) {
131
                }
131
                }
132
        }
132
        }
133
 
133
 
134
        protected function doDisconnect()/*: void*/ {
134
        protected function doDisconnect()/*: void*/ {
135
                $this->already_prepared = array();
135
                $this->already_prepared = array();