Subversion Repositories oidplus

Rev

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

Rev 635 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 OIDplusSqlSlangPluginMySQL extends OIDplusSqlSlangPlugin {
22
class OIDplusSqlSlangPluginMySQL extends OIDplusSqlSlangPlugin {
23
 
23
 
24
        public static function id(): string {
24
        public static function id(): string {
25
                return 'mysql';
25
                return 'mysql';
Line 61... Line 61...
61
        public function detect(OIDplusDatabaseConnection $db): bool {
61
        public function detect(OIDplusDatabaseConnection $db): bool {
62
                try {
62
                try {
63
                        $vers = $db->query("select version() as dbms_version")->fetch_object()->dbms_version;
63
                        $vers = $db->query("select version() as dbms_version")->fetch_object()->dbms_version;
64
                        $vers = strtolower($vers);
64
                        $vers = strtolower($vers);
65
                        return (strpos($vers, 'mysql') !== false) || (strpos($vers, 'mariadb') !== false);
65
                        return (strpos($vers, 'mysql') !== false) || (strpos($vers, 'mariadb') !== false);
66
                } catch (Exception $e) {
66
                } catch (\Exception $e) {
67
                        return false;
67
                        return false;
68
                }
68
                }
69
        }
69
        }
70
 
70
 
71
        public function insert_id(OIDplusDatabaseConnection $db): int {
71
        public function insert_id(OIDplusDatabaseConnection $db): int {