本文整理汇总了PHP中DataType类的典型用法代码示例。如果您正苦于以下问题:PHP DataType类的具体用法?PHP DataType怎么用?PHP DataType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: typeToString
public function typeToString(DataType $type)
{
if ($type->getId() == DataType::BINARY) {
return 'BLOB';
}
return parent::typeToString($type);
}
示例2: typeToString
public function typeToString(DataType $type)
{
if ($type->getId() == DataType::IP) {
return 'varchar(19)';
}
if ($type->getId() == DataType::IP_RANGE) {
return 'varchar(41)';
}
return $type->getName();
}
示例3: typeToString
public function typeToString(DataType $type)
{
switch ($type->getId()) {
case DataType::BIGINT:
return 'INTEGER';
case DataType::BINARY:
return 'BLOB';
}
return parent::typeToString($type);
}
示例4: displaySharing
private function displaySharing()
{
$url = UrlRewriting::GetUrlByAlias("admin/data/share", "datatype=" . urlencode($_GET['show']) . "&blank=true");
$shares = Language::DirectTranslateHtml("SHARES");
$newshare = Language::DirectTranslateHtml("NEW_SHARE");
echo "<h2>" . $shares . "</h2><a href=\"javascript:showIFrameDialog('" . $newshare . "',300,200,'" . $url . "',true);\">" . $newshare . "</a>";
$datatype = new DataType($_GET['show']);
foreach ($datatype->getShares() as $share) {
echo "<br /><br />" . $share->GetName() . ":<br /><a href='" . $share->getUrl() . "'>" . $share->getUrl() . "</a>";
}
}
示例5: __construct
/**
* The NumberParser can parse integer and double datatypes.
* With NumberParser::setLanguage(en/de/it/es ...) one could set up a Language.
* The default language is english (en).
*
* @param DataType $datatype
*/
public function __construct($datatype)
{
$this->setLanguage('en');
$this->dataType = $datatype;
if ($datatype->getName() == 'xsd:integer') {
$this->integer = true;
} elseif ($datatype->getName() == 'xsd:double') {
$this->double = true;
} else {
throw new DataParserException("wrong parameter.");
}
}
示例6: testGetInputType
/**
* test if the method getInputType returns the correct inputtype
*/
public function testGetInputType()
{
$DataType = new DataType();
$this->assertEquals('number', $DataType->getInputType('int'));
$this->assertEquals('checkbox', $DataType->getInputType('bool'));
$this->assertEquals('file', $DataType->getInputType('blob'));
$this->assertEquals('single', $DataType->getInputType('binary'));
$this->assertEquals('text', $DataType->getInputType('text'));
$this->assertEquals('select-multiple', $DataType->getInputType('set'));
$this->assertEquals('date', $DataType->getInputType('date'));
$this->assertEquals('datetime', $DataType->getInputType('datetime'));
$this->assertEquals('number', $DataType->getInputType('year'));
}
示例7: typeToString
public function typeToString(DataType $type)
{
if ($type->getId() == DataType::BINARY) {
return 'BYTEA';
}
if (defined('POSTGRES_IP4_ENABLED')) {
if ($type->getId() == DataType::IP) {
return 'ip4';
}
if ($type->getId() == DataType::IP_RANGE) {
return 'ip4r';
}
}
return parent::typeToString($type);
}
示例8: dataTypeForValue
/**
* DataType for value
*
* @param mixed $pValue
* @return string
*/
public static function dataTypeForValue($pValue = null)
{
// Match the value against a few data types
if ($pValue === null) {
return DataType::TYPE_NULL;
} elseif ($pValue === '') {
return DataType::TYPE_STRING;
} elseif ($pValue instanceof \PHPExcel\RichText) {
return DataType::TYPE_INLINE;
} elseif ($pValue[0] === '=' && strlen($pValue) > 1) {
return DataType::TYPE_FORMULA;
} elseif (is_bool($pValue)) {
return DataType::TYPE_BOOL;
} elseif (is_float($pValue) || is_int($pValue)) {
return DataType::TYPE_NUMERIC;
} elseif (preg_match('/^[\\+\\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\\-\\+]?[0-2]?\\d{1,3})?$/', $pValue)) {
$tValue = ltrim($pValue, '+-');
if (is_string($pValue) && $tValue[0] === '0' && strlen($tValue) > 1 && $tValue[1] !== '.') {
return DataType::TYPE_STRING;
} elseif (strpos($pValue, '.') === false && $pValue > PHP_INT_MAX) {
return DataType::TYPE_STRING;
}
return DataType::TYPE_NUMERIC;
} elseif (is_string($pValue) && array_key_exists($pValue, DataType::getErrorCodes())) {
return DataType::TYPE_ERROR;
}
return DataType::TYPE_STRING;
}
示例9: getInternalColumns
protected function getInternalColumns()
{
if (is_null($this->columns)) {
$this->columns = array();
$keyLength = $this->getKeyLength();
if (is_null($keyLength)) {
throw new ErrorException("Cannot create meta-table-schema for indicies when no key-length is specified!");
}
$columnPage = new Column();
for ($i = 1; $i <= 33; $i++) {
$columnPage->setName("ref{$i}");
$columnPage->setDataType(DataType::INT());
$columnPage->setLength($keyLength);
$columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
$this->columns[] = clone $columnPage;
$columnPage->setName("val{$i}");
$columnPage->setDataType(DataType::INT());
$columnPage->setLength($keyLength);
$columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
$this->columns[] = clone $columnPage;
$columnPage->setName("row{$i}");
$columnPage->setDataType(DataType::INT());
$columnPage->setLength($keyLength);
$columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
$this->columns[] = clone $columnPage;
}
}
return $this->columns;
}
示例10: save
function save()
{
if ($username == null) {
echo "E-Mail is a required field.";
} else {
if ($password == null) {
echo "Password is a required field.";
} else {
if ($password != $password2) {
echo "Please make sure your passwords match.";
} else {
ProgressIndicator::Show();
$url = "http://demo.kikapptools.com/Gastos/crud/updateUser.php";
$httpClient_post = new httpClient();
$inputMetodo = new InputText();
$inputMetodo->setValue("login");
$httpClient_post->addVariable('username', $username);
$httpClient_post->addVariable('password', $password);
$httpClient_post->addVariable('id', $token);
$result = $httpClient_post->Execute('POST', $url);
$id_user = new InputText();
$struct = array("response" => DataType::Character(50));
Data::FromJson($struct, $result);
$id_user = $struct['response'];
ProgressIndicator::Hide();
AndroidAction::GoHome();
}
}
}
}
示例11: getByDataType
/**
*
* @param DataType $type
* @return DataTypeValidator
*/
public static function getByDataType(DataType $type)
{
$res = array();
$dataTypeID = DataBase::Current()->EscapeString($type->getID());
$rows = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}datatype_validator WHERE dataType = '" . $dataTypeID . "'");
foreach ($rows as $row) {
$validator = new DataTypeValidator();
$validator->id = $row->id;
$validator->dataTypeID = $row->dataType;
$validator->dataType = $type;
$validator->select = $row->select;
$validator->message = $row->message;
$res[] = $validator;
}
return $res;
}
示例12: login
function login()
{
if ($email == null) {
echo "E-Mail is a required field.";
} else {
if ($pass == null) {
echo "Password is a required field.";
} else {
ProgressIndicator::Show();
$url = "http://demo.kikapptools.com/magento/apiKikApp/api.php?metodo=login";
$httpClient_post = new httpClient();
$httpClient_post->addVariable('email', $email);
$httpClient_post->addVariable('password', $pass);
$result = $httpClient_post->Execute('POST', $url);
$customerToken = new InputText();
$userName = new InputText();
$response = array("customerToken" => DataType::Character(150), "userName" => DataType::Character(150));
Data::FromJson($response, $result);
$customerToken = $response['customerToken'];
$userName = $response['userName'];
ProgressIndicator::Hide();
if ($customerToken != "") {
StorageAPI::Set("token", $customerToken);
StorageAPI::Set("userName", $userName);
AndroidAction::GoHome();
} else {
echo "Invalid user";
}
}
}
}
示例13: login
function login()
{
if ($username == null) {
echo "E-Mail is a required field.";
} else {
if ($password == null) {
echo "Password is a required field.";
} else {
ProgressIndicator::Show();
$url = "http://demo.kikapptools.com/Gastos/crud/Login.php";
$httpClient_post = new httpClient();
$inputMetodo = new InputText();
$inputMetodo->setValue("login");
$httpClient_post->addVariable('username', $username);
$httpClient_post->addVariable('password', $password);
$result = $httpClient_post->Execute('POST', $url);
$id_user = new InputText();
$struct = array("response" => DataType::Character(50));
Data::FromJson($struct, $result);
$id_user = $struct['response'];
ProgressIndicator::Hide();
if ($id_user != "0") {
StorageAPI::Set("token", $id_user);
AndroidAction::GoHome();
} else {
echo "Wrong user or password";
}
}
}
}
示例14: save
function save()
{
if ($email == null) {
echo "EMail is a required field.";
} else {
if ($password == null) {
echo "Password is a required field.";
} else {
if ($password != $password_2) {
echo "Please make sure your passwords match.";
} else {
ProgressIndicator::Show();
$url = "http://demo.kikapptools.com/Gastos/crud/Register.php";
$http = new httpClient();
$http->addVariable('username', $email);
$http->addVariable('passcode', $password);
//lo de pasar la clave a md5 lo hace el Register.php
$result = $http->Execute('POST', $url);
$struct = array("id_usuario" => DataType::Character(101));
Data::FromJson($struct, $result);
$id_user = new InputText(100);
$id_user = $struct['id_usuario'];
if ($id_user == "0") {
echo "User already signed up";
} else {
echo "Signed up succesfully.";
StorageAPI::Set("token", $id_user);
AndroidAction::GoHome();
}
}
}
}
}
示例15: load_data
function load_data()
{
$url = "http://www.devxtend.com/Gecko/samples/3_2/rest/main_load_data";
$hc = new httpClient();
$rs = $hc->Execute("GET", $url);
$struct = array(array("id" => DataType::Character(6), "name" => DataType::Character(100)));
Data::FromJson($struct, $rs);
}