Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2013-06-20 20:43:53 +02:00
commit b86062ff81
9 changed files with 735 additions and 246 deletions

View File

@ -0,0 +1,106 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Specialized String Class for phpMyAdmin
*
* Defines a set of function callbacks that have a pure C version available if
* the "ctype" extension is available, but otherwise have PHP versions to use
* (that are slower).
*
* The SQL Parser code relies heavily on these functions.
*
* @package PhpMyAdmin-String
* @subpackage CType
*/
if (! defined('PHPMYADMIN')) {
exit;
}
class PMA_StringCType
{
/**
* Checks if a character is an alphanumeric one
*
* @param string $c character to check for
*
* @return boolean whether the character is an alphanumeric one or not
*/
public static function isAlnum($c)
{
return ctype_alnum($c);
} // end of the "isAlnum()" function
/**
* Checks if a character is an alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is an alphabetic one or not
*/
public static function isAlpha($c)
{
return ctype_alpha($c);
} // end of the "isAlpha()" function
/**
* Checks if a character is a digit
*
* @param string $c character to check for
*
* @return boolean whether the character is a digit or not
*/
public static function isDigit($c)
{
return ctype_digit($c);
} // end of the "isDigit()" function
/**
* Checks if a character is an upper alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is an upper alphabetic one or not
*/
public static function isUpper($c)
{
return ctype_upper($c);
} // end of the "isUpper()" function
/**
* Checks if a character is a lower alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is a lower alphabetic one or not
*/
public static function isLower($c)
{
return ctype_lower($c);
} // end of the "PisLower()" function
/**
* Checks if a character is a space one
*
* @param string $c character to check for
*
* @return boolean whether the character is a space one or not
*/
public static function isSpace($c)
{
return ctype_space($c);
} // end of the "isSpace()" function
/**
* Checks if a character is an hexadecimal digit
*
* @param string $c character to check for
*
* @return boolean whether the character is an hexadecimal digit or not
*/
public static function isHexDigit($c)
{
return ctype_xdigit($c);
} // end of the "isHexDigit()" function
}
?>

View File

@ -0,0 +1,135 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Specialized String Functions for phpMyAdmin
*
* Defines a set of function callbacks that have a pure C version available if
* the "ctype" extension is available, but otherwise have PHP versions to use
* (that are slower).
*
* The SQL Parser code relies heavily on these functions.
*
* @package PhpMyAdmin-String
* @subpackage Native
*/
if (! defined('PHPMYADMIN')) {
exit;
}
class PMA_StringNativeType
{
/**
* Checks if a character is an alphanumeric one
*
* @param string $c character to check for
*
* @return boolean whether the character is an alphanumeric one or not
*/
public static function isAlnum($c)
{
return (self::isUpper($c) || self::isLower($c) || self::isDigit($c));
} // end of the "isAlnum()" function
/**
* Checks if a character is an alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is an alphabetic one or not
*/
public static function isAlpha($c)
{
return ($GLOBALS['PMA_StringType']::isUpper($c) || $GLOBALS['PMA_StringType']::isLower($c));
} // end of the "isAlpha()" function
/**
* Checks if a character is a digit
*
* @param string $c character to check for
*
* @return boolean whether the character is a digit or not
*/
public static function isDigit($c)
{
$ord_zero = 48; //ord('0');
$ord_nine = 57; //ord('9');
$ord_c = ord($c);
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
} // end of the "isDigit()" function
/**
* Checks if a character is an upper alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is an upper alphabetic one or not
*/
public static function isUpper($c)
{
$ord_zero = 65; //ord('A');
$ord_nine = 90; //ord('Z');
$ord_c = ord($c);
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
} // end of the "isUpper()" function
/**
* Checks if a character is a lower alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is a lower alphabetic one or not
*/
public static function isLower($c)
{
$ord_zero = 97; //ord('a');
$ord_nine = 122; //ord('z');
$ord_c = ord($c);
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
} // end of the "isLower()" function
/**
* Checks if a character is a space one
*
* @param string $c character to check for
*
* @return boolean whether the character is a space one or not
*/
public static function isSpace($c)
{
$ord_space = 32; //ord(' ')
$ord_tab = 9; //ord('\t')
$ord_CR = 13; //ord('\n')
$ord_NOBR = 160; //ord('U+00A0);
$ord_c = ord($c);
return ($ord_c == $ord_space
|| $ord_c == $ord_NOBR
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_tab, $ord_CR));
} // end of the "isSpace()" function
/**
* Checks if a character is an hexadecimal digit
*
* @param string $c character to check for
*
* @return boolean whether the character is an hexadecimal digit or not
*/
public static function isHexDigit($c)
{
$ord_Aupper = 65; //ord('A');
$ord_Fupper = 70; //ord('F');
$ord_Alower = 97; //ord('a');
$ord_Flower = 102; //ord('f');
$ord_zero = 48; //ord('0');
$ord_nine = 57; //ord('9');
$ord_c = ord($c);
return (PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine)
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Aupper, $ord_Fupper)
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Alower, $ord_Flower));
} // end of the "isHexDigit()" function
}
?>

View File

@ -317,7 +317,7 @@ function PMA_SQP_parse($sql)
}
// Checks for white space
if (PMA_STR_isSpace($c)) {
if ($GLOBALS['PMA_StringType']::isSpace($c)) {
$this_was_space = true;
$count2++;
continue;
@ -492,7 +492,7 @@ function PMA_SQP_parse($sql)
var_dump(PMA_STR_isSqlIdentifier($c, false));
var_dump($c == '@');
var_dump($c == '.');
var_dump(PMA_STR_isDigit($GLOBALS['PMA_String']::substr($sql, $count2 + 1, 1)));
var_dump($GLOBALS['PMA_StringType']::isDigit($GLOBALS['PMA_String']::substr($sql, $count2 + 1, 1)));
var_dump($previous_was_space);
var_dump($previous_was_bracket);
var_dump($previous_was_listsep);
@ -503,7 +503,7 @@ function PMA_SQP_parse($sql)
if (PMA_STR_isSqlIdentifier($c, false)
|| $c == '@'
|| ($c == '.'
&& PMA_STR_isDigit($GLOBALS['PMA_String']::substr($sql, $count2 + 1, 1))
&& $GLOBALS['PMA_StringType']::isDigit($GLOBALS['PMA_String']::substr($sql, $count2 + 1, 1))
&& ($previous_was_space || $previous_was_bracket || $previous_was_listsep))
) {
/* DEBUG
@ -524,7 +524,7 @@ function PMA_SQP_parse($sql)
$is_digit = (
!$is_identifier
&& !$is_sql_variable
&& PMA_STR_isDigit($c)
&& $GLOBALS['PMA_StringType']::isDigit($c)
);
$is_hex_digit = (
$is_digit
@ -592,7 +592,7 @@ function PMA_SQP_parse($sql)
$is_float_digit = false;
}
}
if (($is_hex_digit && PMA_STR_isHexDigit($c2)) || ($is_digit && PMA_STR_isDigit($c2))) {
if (($is_hex_digit && $GLOBALS['PMA_StringType']::isHexDigit($c2)) || ($is_digit && $GLOBALS['PMA_StringType']::isDigit($c2))) {
$count2++;
continue;
} else {

View File

@ -32,9 +32,11 @@ if (@function_exists('mb_strlen')) {
* Load ctype handler.
*/
if (@extension_loaded('ctype')) {
include './libraries/string_type_ctype.lib.php';
include './libraries/StringCType.class.php';
$PMA_StringType = new PMA_StringCType();
} else {
include './libraries/string_type_native.lib.php';
include './libraries/String_NativeType.class.php';
$PMA_StringType = new PMA_StringNativeType();
}
/**
@ -92,8 +94,8 @@ function PMA_STR_numberInRangeInclusive($num, $lower, $upper)
* @return boolean whether the character is an SQL identifier or not
*/
function PMA_STR_isSqlIdentifier($c, $dot_is_valid = false)
{
return (PMA_STR_isAlnum($c)
{
return ($GLOBALS['PMA_StringType']::isAlnum($c)
|| ($ord_c = ord($c)) && $ord_c >= 192 && $ord_c != 215 && $ord_c != 249
|| $c == '_'
|| $c == '$'

View File

@ -1,104 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Specialized String Functions for phpMyAdmin
*
* Defines a set of function callbacks that have a pure C version available if
* the "ctype" extension is available, but otherwise have PHP versions to use
* (that are slower).
*
* The SQL Parser code relies heavily on these functions.
*
* @package PhpMyAdmin-String
* @subpackage CType
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Checks if a character is an alphanumeric one
*
* @param string $c character to check for
*
* @return boolean whether the character is an alphanumeric one or not
*/
function PMA_STR_isAlnum($c)
{
return ctype_alnum($c);
} // end of the "PMA_STR_isAlnum()" function
/**
* Checks if a character is an alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is an alphabetic one or not
*/
function PMA_STR_isAlpha($c)
{
return ctype_alpha($c);
} // end of the "PMA_STR_isAlpha()" function
/**
* Checks if a character is a digit
*
* @param string $c character to check for
*
* @return boolean whether the character is a digit or not
*/
function PMA_STR_isDigit($c)
{
return ctype_digit($c);
} // end of the "PMA_STR_isDigit()" function
/**
* Checks if a character is an upper alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is an upper alphabetic one or not
*/
function PMA_STR_isUpper($c)
{
return ctype_upper($c);
} // end of the "PMA_STR_isUpper()" function
/**
* Checks if a character is a lower alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is a lower alphabetic one or not
*/
function PMA_STR_isLower($c)
{
return ctype_lower($c);
} // end of the "PMA_STR_isLower()" function
/**
* Checks if a character is a space one
*
* @param string $c character to check for
*
* @return boolean whether the character is a space one or not
*/
function PMA_STR_isSpace($c)
{
return ctype_space($c);
} // end of the "PMA_STR_isSpace()" function
/**
* Checks if a character is an hexadecimal digit
*
* @param string $c character to check for
*
* @return boolean whether the character is an hexadecimal digit or not
*/
function PMA_STR_isHexDigit($c)
{
return ctype_xdigit($c);
} // end of the "PMA_STR_isHexDigit()" function
?>

View File

@ -1,133 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Specialized String Functions for phpMyAdmin
*
* Defines a set of function callbacks that have a pure C version available if
* the "ctype" extension is available, but otherwise have PHP versions to use
* (that are slower).
*
* The SQL Parser code relies heavily on these functions.
*
* @package PhpMyAdmin-String
* @subpackage Native
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Checks if a character is an alphanumeric one
*
* @param string $c character to check for
*
* @return boolean whether the character is an alphanumeric one or not
*/
function PMA_STR_isAlnum($c)
{
return (PMA_STR_isUpper($c) || PMA_STR_isLower($c) || PMA_STR_isDigit($c));
} // end of the "PMA_STR_isAlnum()" function
/**
* Checks if a character is an alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is an alphabetic one or not
*/
function PMA_STR_isAlpha($c)
{
return (PMA_STR_isUpper($c) || PMA_STR_isLower($c));
} // end of the "PMA_STR_isAlpha()" function
/**
* Checks if a character is a digit
*
* @param string $c character to check for
*
* @return boolean whether the character is a digit or not
*/
function PMA_STR_isDigit($c)
{
$ord_zero = 48; //ord('0');
$ord_nine = 57; //ord('9');
$ord_c = ord($c);
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
} // end of the "PMA_STR_isDigit()" function
/**
* Checks if a character is an upper alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is an upper alphabetic one or not
*/
function PMA_STR_isUpper($c)
{
$ord_zero = 65; //ord('A');
$ord_nine = 90; //ord('Z');
$ord_c = ord($c);
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
} // end of the "PMA_STR_isUpper()" function
/**
* Checks if a character is a lower alphabetic one
*
* @param string $c character to check for
*
* @return boolean whether the character is a lower alphabetic one or not
*/
function PMA_STR_isLower($c)
{
$ord_zero = 97; //ord('a');
$ord_nine = 122; //ord('z');
$ord_c = ord($c);
return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
} // end of the "PMA_STR_isLower()" function
/**
* Checks if a character is a space one
*
* @param string $c character to check for
*
* @return boolean whether the character is a space one or not
*/
function PMA_STR_isSpace($c)
{
$ord_space = 32; //ord(' ')
$ord_tab = 9; //ord('\t')
$ord_CR = 13; //ord('\n')
$ord_NOBR = 160; //ord('U+00A0);
$ord_c = ord($c);
return ($ord_c == $ord_space
|| $ord_c == $ord_NOBR
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_tab, $ord_CR));
} // end of the "PMA_STR_isSpace()" function
/**
* Checks if a character is an hexadecimal digit
*
* @param string $c character to check for
*
* @return boolean whether the character is an hexadecimal digit or not
*/
function PMA_STR_isHexDigit($c)
{
$ord_Aupper = 65; //ord('A');
$ord_Fupper = 70; //ord('F');
$ord_Alower = 97; //ord('a');
$ord_Flower = 102; //ord('f');
$ord_zero = 48; //ord('0');
$ord_nine = 57; //ord('9');
$ord_c = ord($c);
return (PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine)
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Aupper, $ord_Fupper)
|| PMA_STR_numberInRangeInclusive($ord_c, $ord_Alower, $ord_Flower));
} // end of the "PMA_STR_isHexDigit()" function
?>

View File

@ -0,0 +1,184 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Tests for Specialized String Functions (multi-byte) for phpMyAdmin
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/StringMB.class.php';
/**
* Tests for Specialized String Functions (multi-byte) for phpMyAdmin
*
* @package PhpMyAdmin-test
*/
class PMA_String_Mb_Test extends PHPUnit_Framework_TestCase
{
protected $internal_encoding;
/**
* Setup function for test cases
*
* @access protected
* @return void
*/
protected function setUp()
{
$this->internal_encoding = mb_internal_encoding();
}
/**
* TearDown function for tests, restores internal encoding
*
* @access protected
* @return void
*/
protected function tearDown()
{
mb_internal_encoding($this->internal_encoding);
}
/**
* Test for PMA_StringMB::strlen
*
* @param integer $length Length of the string
* @param string $str String to check for
* @param string $encoding Encoding of the string
*
* @return void
* @test
* @dataProvider mbStrlenData
*/
public function testMbStrlen($length, $str, $encoding)
{
mb_internal_encoding($encoding);
$this->assertEquals(
$length,
PMA_StringMB::strlen($str)
);
}
/**
* Data provider for testMbStrlen
*
* @return array Test data
*/
public function mbStrlenData()
{
return array(
array(2, "ab", "UTF-8"),
array(9, "åèö - doo", "UTF-8"),
array(12, "åèö - doo", "ISO-8859-1")
);
}
/**
* Test for PMA_StringMB::substr
*
* @param string $str Expected substring
* @param string $haystack String to check in
* @param int $start Starting position of substring
* @param int $length Length of substring
* @param string $encoding Encoding of the string
*
* @return void
* @test
* @dataProvider mbSubStrData
*/
public function testMbSubStr($str, $haystack, $start, $length, $encoding)
{
mb_internal_encoding($encoding);
$this->assertEquals(
$str,
PMA_StringMB::substr($haystack, $start, $length)
);
}
/**
* Data provider for testMbSubStr
*
* @return array Test data
*/
public function mbSubStrData()
{
return array(
array("b", "ab", 1, 1, "UTF-8"),
array("èö", "åèö - doo", 1, 2, "UTF-8"),
);
}
/**
* Test for PMA_StringMB::strpos
*
* @param int $pos Expected position
* @param string $haystack String to search in
* @param string $needle String to search for
* @param int $offset Search offset
* @param string $encoding Encoding to test against
*
* @return void
* @test
* @dataProvider mbStrposData
*/
public function testMbStrpos($pos, $haystack, $needle, $offset, $encoding)
{
mb_internal_encoding($encoding);
$this->assertEquals(
$pos,
PMA_StringMB::strpos($haystack, $needle, $offset)
);
}
/**
* Data provider for testMbStrpos
*
* @return array Test data
*/
public function mbStrposData()
{
return array(
array(1, "ab", "b", 0, "UTF-8"),
array(2, "åèö - doo", "ö", 0, "UTF-8"),
array(6, "åèöè", "è", 3, "ISO-8859-1")
);
}
/**
* Test for PMA_StringMB::strtolower
*
* @param string $expected Expected lowercased string
* @param string $string String to convert to lowercase
* @param string $encoding Encoding to test against
*
* @return void
* @test
* @dataProvider mbStrToLowerData
*/
public function testMbStrToLower($expected, $string, $encoding)
{
mb_internal_encoding($encoding);
$this->assertEquals(
$expected,
PMA_StringMB::strtolower($string)
);
}
/**
* Data provider for testMbStrpos
*
* @return array Test data
*/
public function mbStrToLowerData()
{
return array(
array("mary had a", "Mary Had A", "UTF-8"),
array("τάχιστη", "Τάχιστη", "UTF-8")
);
}
}
?>

View File

@ -0,0 +1,151 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Tests for Specialized String Functions (native) for phpMyAdmin
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/StringNative.class.php';
/**
* Tests for Specialized String Functions (native) for phpMyAdmin
*
* @package PhpMyAdmin-test
*/
class PMA_StringNative_Test extends PHPUnit_Framework_TestCase
{
/**
* Test for PMA_StringNative::strlen
*
* @param integer $length Length of the string
* @param string $str String to check for
*
* @return void
* @test
* @dataProvider nativeStrlenData
*/
public function testNativeStrlen($length, $str)
{
$this->assertEquals(
$length,
PMA_StringNative::strlen($str)
);
}
/**
* Data provider for testNativeStrlen
*
* @return array Test data
*/
public function nativeStrlenData()
{
return array(
array(2, "ab"),
array(9, "test data"),
array(0, "")
);
}
/**
* Test for PMA_StringNative::substr
*
* @param string $str Expected substring
* @param string $haystack String to check in
* @param int $start Starting position of substring
* @param int $length Length of substring
*
* @return void
* @test
* @dataProvider nativeSubStrData
*/
public function testNativeSubStr($str, $haystack, $start, $length)
{
$this->assertEquals(
$str,
PMA_StringNative::substr($haystack, $start, $length)
);
}
/**
* Data provider for testNativeSubStr
*
* @return array Test data
*/
public function nativeSubStrData()
{
return array(
array("b", "ab", 1, 1),
array("data", "testdata", 4, 4)
);
}
/**
* Test for PMA_StringNative::strpos
*
* @param int $pos Expected position
* @param string $haystack String to search in
* @param string $needle String to search for
* @param int $offset Search offset
*
* @return void
* @test
* @dataProvider nativeStrposData
*/
public function testNativeStrpos($pos, $haystack, $needle, $offset)
{
$this->assertEquals(
$pos,
PMA_StringNative::strpos($haystack, $needle, $offset)
);
}
/**
* Data provider for testNativeStrpos
*
* @return array Test data
*/
public function nativeStrposData()
{
return array(
array(1, "ab", "b", 0),
array(4, "test data", " ", 0)
);
}
/**
* Test for PMA_StringNative::strtolower
*
* @param string $expected Expected lowercased string
* @param string $string String to convert to lowercase
*
* @return void
* @test
* @dataProvider nativeStrToLowerData
*/
public function testNativeStrToLower($expected, $string)
{
$this->assertEquals(
$expected,
PMA_StringNative::strtolower($string)
);
}
/**
* Data provider for testNativeStrpos
*
* @return array Test data
*/
public function nativeStrToLowerData()
{
return array(
array("mary had a", "Mary Had A", "UTF-8"),
array("test string", "TEST STRING", "UTF-8")
);
}
}
?>

View File

@ -0,0 +1,148 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Tests for Specialized String Functions for phpMyAdmin
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/string.lib.php';
require_once 'libraries/StringNativeType.class.php';
/**
* Tests for Specialized String Functions for phpMyAdmin
*
* @package PhpMyAdmin-test
*/
class PMA_String_Test extends PHPUnit_Framework_TestCase
{
/**
* Setup function for test cases
*
* @access protected
* @return void
*/
protected function setUp()
{
$GLOBALS['PMA_StringType'] = new PMA_StringNativeType();
}
/**
* Test for Str_charIsEscaped
*
* @param boolean $expected Expected value from test
* @param string $str String to check for
* @param integer $pos Character to check for
* @param integer $start Starting position of string
*
* @return void
* @test
* @dataProvider charIsEscapedData
*/
public function testCharIsEscaped($expected, $str, $pos, $start)
{
$this->assertEquals(
$expected,
PMA_STR_charIsEscaped($str, $pos, $start)
);
}
/**
* Data provider for testCharIsEscaped
*
* @return array Test data
*/
public function charIsEscapedData()
{
return array(
array(false, 'test', -1, 0),
array(false, 'test', 5, 3),
array(false, 'test', 3, 5),
array(true, '\\test', 1, -1),
array(false, '\\\\test', 2, -1),
array(true, '\\\\tes\\t', 6, 0)
);
}
/**
* Test for PMA_STR_numberInRangeInclusive
*
* @param bool $expected Expected value from test
* @param integer $num Number to check for
* @param integer $lower Lower bound
* @param integer $upper Upper bound
*
* @return void
* @test
* @dataProvider numberInRangeData
*/
public function testNumberInRangeInclusive(
$expected, $num, $lower, $upper
) {
$this->assertEquals(
$expected,
PMA_STR_numberInRangeInclusive($num, $lower, $upper)
);
}
/**
* Data provider for testNumberInRangeInclusive
*
* @return void
*/
public function numberInRangeData()
{
return array(
array(true, 2, 2, 3),
array(true, 5, 4, 5),
array(true, 50, 0, 100),
array(false, -1, 0, 20),
array(false, 31, 0, 30)
);
}
/**
* Test for PMA_STR_isSqlIdentifier
*
* @param boolean $expected Expected value from test
* @param string $c Character to check for
* @param boolean $dot_is_valid whether the dot character is valid or not
*
* @return void
* @test
* @dataProvider isSqlIdentifierData
*/
public function testIsSqlIdentifier($expected, $c, $dot_is_valid = false)
{
$this->assertEquals(
$expected,
PMA_STR_isSqlIdentifier($c, $dot_is_valid)
);
}
/**
* Data provider for testIsSqlIdentifier
*
* @return array Test data
*/
public function isSqlIdentifierData()
{
return array(
array(true, '2'),
array(true, 'a'),
array(true, '.', true),
array(false, '.'),
array(true, chr(192)),
array(false, chr(215)),
array(false, chr(249)),
array(true, '_'),
array(true, '$')
);
}
}
?>