[mapserver-users] MySQL field-types to Dbase field-types

Azimuth, E. Perik perik at azimuth.nl
Wed Mar 6 11:58:21 EST 2002


Hi All,

little offtopic maybe but has anyone tried to translate the table 
field-types of MySQL to the table of a Dbase file using PHP?

Currently i am working on a function which translates a MySQL table to a 
shapefile based on the index of the MySQL-fields where X and Y (lat / lon) 
are situated.
All is set up and running ok, but it's now only based on a table with 
doubles and strings.

These table-fields is a much longer list for a MySQL table then for a Dbase 
table.

So in principle i need to pass:

- field-name
- field-type
- field-len

of a MySQL database to an array which defines the newly created database 
using PHP.


So far i gathered the following MySQL field-types:

TINYINT
SMALLINT
INTEGER
MEDIUMINT
BIGINT
DECIMAL or NUMERIC
FLOAT
DOUBLE or REAL
TIMESTAMP
DATE
TIME
DATETIME
YEAR
String (<-- CHAR or VARCHAR)
BLOB or TEXT  (use max_length to determine the maximum length)
SET
ENUM
NULL-type


For the dbase file the field-types are:

N (numeric)
C (character)
D (date)
L (logical)
M (memo).


Any help regarding this is greatly appreciated,

Erwin







More information about the mapserver-users mailing list