westdc-zf1/application/module/Westdc/Dataimport/AbstractProcessing.php

41 lines
847 B
PHP
Raw Permalink Normal View History

<?php
/**
* Created by PhpStorm.
* User: liujin834
* Date: 15-1-27
* Time: 下午2:37
*/
namespace Westdc\Dataimport;
abstract class AbstractProcessing {
/**
* 获取判断数据类型的函数
* @param $pgsql_data_type
* @param $data
* @return null|string
*/
public function checkFieldsDataType($pgsql_data_type,$data){
switch ($pgsql_data_type){
case "integer":
case "bigint":
case "real":
case "double precision":
return is_int($data) || is_float($data);
case "date":
2015-01-31 13:37:44 +00:00
case "timestamp without time zone":
case "char":
case "character varying":
2015-01-31 13:37:44 +00:00
case "text":
return is_string($data);
default:
return FALSE;
}
}
}