41 lines
847 B
PHP
41 lines
847 B
PHP
<?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":
|
|
case "timestamp without time zone":
|
|
case "char":
|
|
case "character varying":
|
|
case "text":
|
|
return is_string($data);
|
|
|
|
default:
|
|
return FALSE;
|
|
}
|
|
|
|
}
|
|
|
|
} |