112 lines
1.9 KiB
PHP
112 lines
1.9 KiB
PHP
<?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
|
|
{
|
|
/**
|
|
* Returns list of unary operators.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getUnaryOperators() {
|
|
return array(
|
|
'IS NULL',
|
|
'IS NOT NULL',
|
|
"= ''",
|
|
"!= ''",
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Check whether operator is unary.
|
|
*
|
|
* @param string $op operator name
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function isUnaryOperator($op) {
|
|
return in_array($op, $this->getUnaryOperators());
|
|
}
|
|
|
|
/**
|
|
* Returns list of operators checking for NULL.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getNullOperators() {
|
|
return array(
|
|
'IS NULL',
|
|
'IS NOT NULL',
|
|
);
|
|
}
|
|
|
|
/**
|
|
* ENUM search operators
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getEnumOperators() {
|
|
return array(
|
|
'=',
|
|
'!=',
|
|
);
|
|
}
|
|
|
|
/**
|
|
* TEXT search operators
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getTextOperators() {
|
|
return array(
|
|
'LIKE',
|
|
'LIKE %...%',
|
|
'NOT LIKE',
|
|
'=',
|
|
'!=',
|
|
'REGEXP',
|
|
'REGEXP ^...$',
|
|
'NOT REGEXP',
|
|
"= ''",
|
|
"!= ''",
|
|
'IN (...)',
|
|
'NOT IN (...)',
|
|
'BETWEEN',
|
|
'NOT BETWEEN',
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Number search operators
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getNumberOperators() {
|
|
return array(
|
|
'=',
|
|
'>',
|
|
'>=',
|
|
'<',
|
|
'<=',
|
|
'!=',
|
|
'LIKE',
|
|
'NOT LIKE',
|
|
'IN (...)',
|
|
'NOT IN (...)',
|
|
'BETWEEN',
|
|
'NOT BETWEEN',
|
|
);
|
|
}
|
|
}
|