Skip to content

Commit

Permalink
Add class for handling types
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Apr 25, 2012
1 parent b984cb7 commit a2bf814
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
29 changes: 29 additions & 0 deletions libraries/Types.class.php
@@ -0,0 +1,29 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* SQL data types definition
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}

/**
* Generic class holding type definitions.
*/
class PMA_Types
{
public function getUnaryOperators() {
return array(
'IS NULL',
'IS NOT NULL',
"= ''",
"!= ''",
);
}

public function isUnaryOperator($op) {
return in_array($op, $this->getUnaryOperators());
}
}
10 changes: 10 additions & 0 deletions libraries/common.inc.php
Expand Up @@ -124,6 +124,11 @@
*/
require './libraries/Table.class.php';

/**
* the PMA_Types class
*/
require './libraries/Types.class.php';

if (!defined('PMA_MINIMUM_COMMON')) {
/**
* common functions
Expand Down Expand Up @@ -973,6 +978,11 @@
PMA_fatalError(__('You should upgrade to %s %s or later.'), array('MySQL', '5.0.15'));
}

/**
* Type handling object.
*/
$GLOBALS['PMA_Types'] = new PMA_Types();

if (PMA_DRIZZLE) {
// DisableIS must be set to false for Drizzle, it maps SHOW commands
// to INFORMATION_SCHEMA queries anyway so it's fast on large servers
Expand Down

0 comments on commit a2bf814

Please sign in to comment.