Пример #1
0
 $attributeName = $_REQUEST['attributename'];
 if ($attributeName && $layerName) {
     $msLayer = $map->getLayerByName($layerName);
     if ($msLayer && ($msLayer->connectiontype == MS_POSTGIS || $msLayer->connectiontype == MS_ORACLESPATIAL)) {
         // get dns string containing : type of database, user name, password, host and database :
         $dsn = PluginsMapUtils::getDSNConnection($msLayer);
         if ($dsn) {
             // data substitution :
             $data = PluginsMapUtils::getQueryParamsFromDataString($msLayer, false, true);
             // DB :
             $edb = new Easy_MDB2();
             $edb->setDSN($dsn);
             $edb->start();
             // Query :
             $db_table = $data['db_table'];
             $mdb2FieldType = $edb->getFieldType($db_table, $attributeName);
             switch ($mdb2FieldType) {
                 case 'integer':
                 case 'decimal':
                 case 'float':
                 case 'boolean':
                     $attributeType = 'N';
                     break;
                 case 'text':
                 case 'date':
                 case 'time':
                 case 'timestamp':
                 case 'blob':
                 case 'clob':
                     $attributeType = 'S';
                     break;