2015-01-30 15:08:23 +00:00
|
|
|
<?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":
|
2015-01-30 15:08:23 +00:00
|
|
|
case "char":
|
|
|
|
case "character varying":
|
2015-01-31 13:37:44 +00:00
|
|
|
case "text":
|
2015-01-30 15:08:23 +00:00
|
|
|
return is_string($data);
|
|
|
|
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|