Next: reconnect Up: Communication with the MySQL Previous: field.names Contents
Subsections

- Answer

###
`field.info; BYTE`

Retrieves information about the fields of the current result set. The `BYTE` should have one of the predefined values `field.name, field.org.name, field.table, field.org.table, field.db` or `field.info`. If it has any other value, the effect will be the same is if it was `field.name`.

#### Answer

Depending on whether the control byte was:

- `field.name`: A `data.field.names; MOBILE []MOBILE []BYTE` containing the names of the fields. If the field was given an alias with an AS clause, the alias is given as name.
- `field.org.name`: A `data.field.names` message carrying the names of the fields, but aliases in the names are ignored.
- `field.table`: A `data.field.names` message containing the names of the tables containing the fields. If the field is calculated, the string will be empty. If the table was given an alias with an AS clause, the alias is given as name.
- `field.org.table`: The same as for `field.table`, but aliases in the table names are ignored.
- `field.db`: A `data.field.names` message containing the names of the databases that the fields come from. If the field is calculated, the name is an empty string.
- `field.info`: A `field.info; MOBILE []MYSQL.FIELD.INFO` message containing information about the fields. The `MYSQL.FIELD.INFO` record provides the following data:
  - `INT length`: The width of the field, as specified in the table definition.
  - `INT max.length`: The maximum width of the field for the result set (the length of the longest field value for the rows actually in the result set).
  - `INT decimals`: The number of decimals for numeric fields.
  - `INT charsetnr`: The character set number for the field.
  - `MYSQL.TYPE type`: The type of the field:

    Type value | Type description
    tiny | TINYINT field
    short | SMALLINT field
    long | INTEGER field
    int24 | MEDIUMINT field
    longlong | BIGINT field
    decimal | DECIMAL or NUMERIC field
    newdecimal | Precision math DECIMAL or NUMERIC
    float | FLOAT field
    double | DOUBLE or REAL field
    bit | BIT field
    timestamp | TIMESTAMP field
    date | DATE field
    time | TIME field
    datetime | DATETIME field
    year | YEAR field
    string | CHAR or BINARY field
    var.string | VARCHAR or VARBINARY field
    blob | BLOB or TEXT field (use `max.length` to determine the maximum length)
    set | SET field
    enum | ENUM field
    geometry | Spatial field
    null | NULL-type field

    To distinguish between binary and non-binary data for string data types, check whether the `charsetnr` value is 63 - or alternatively if `binary.charset` is `TRUE`. If so, the character set is binary, which indicates binary rather than non-binary data. This is how to distinguish between BINARY and CHAR, VARBINARY and VARCHAR, and BLOB and TEXT.

  - `BOOL not.null`: Whether the field can't be NULL
  - `BOOL pri.key`: Whether the field is part of a primary key
  - `BOOL unique.key`: Whether the field is part of a unique key
  - `BOOL multiple.key`: Whether the field is part of a non-unique key
  - `BOOL unsigned`: Whether the field has the UNSIGNED attribute
  - `BOOL zerofill`: Whether the field has the ZEROFILL attribute
  - `BOOL binary`: Whether the field has the BINARY attribute
  - `BOOL auto.increment`: Whether the field has the AUTO_INCREMENT attribute
  - `BOOL binary.charset`: Whether `charsetnr` is 63, indicating binary data for string data types.

Next: reconnect Up: Communication with the MySQL Previous: field.names Contents