FETCHASSOC
FETCHASSOC is a term used to describe a fetch mode in database access libraries that returns a single row as an associative data structure. In this mode, each field is addressed by its column name, so the result is a mapping from column names (strings) to their corresponding values. This contrasts with numeric fetch modes that use column positions.
In practice, the concept appears in several languages and APIs under slightly different naming. The common
Usage typically involves selecting fetch mode when executing a query or when retrieving results, for example
Advantages of FETCHASSOC include improved readability and resilience to changes in column order, since code references
See also: FETCH_NUM, FETCH_BOTH, and database API fetch modes.