smf_db_calculate_type

Description

Determines the correct column type and size based on the given parameters.

Syntax

array smf_db_calculate_type (string $type_name[, int $type_size[, bool $reverse]])



Parameter $type_name

Expected type: String
Description: The name of a column type (see smf_db_create_column for possible values)



Parameter $type_size

Expected type: Integer
Description: The desired size for the column. If not specified, SMF will determine the appropriate size



Parameter $reverse

Expected type: Boolean
Description: If true, returns the "generic" type for the given specific type. Has no effect in MySQL since it's the "generic" type.



Return value

Expected type: Array
Description: Returns the appropriate size and type for your db system

Array Elements
Key Optional Expected type Description
0 no String The name of the appropriate datatype
1 no Integer The appropriate size (or null if no size was given)


Notes

  • Because MySQL is the "generic baseline", simply returns whatever it was passed
  • See the postgresql and sqlite versions for more info
Advertisement: