# mco_dict_version

> Retrieve the current version number of the database schema (dictionary).

### Prototype

        MCO_RET mco_dict_version(
            /*IN*/  mco_db_h db,
            /*OUT*/ int *dict_version
        );

### Arguments

`db`
Database connection handle.
`dict_version`
Pointer to an integer that will receive the current dictionary version number. This value is incremented each time the database schema is modified via DDL operations (e.g., adding a class or index).

### Description

> This function returns the internal version number of the database dictionary (schema).

> The dictionary version can be used to:

> - Detect schema changes between application runs,
> - Implement schema-aware caching or validation logic,
> - Coordinate upgrades in distributed or replicated environments.

> Note: The version number is persistent across database sessions and is stored as part of the database metadata.

### Return Codes

`MCO_S_OK`
Dictionary version successfully retrieved.
`MCO_E_INVALID_HANDLE`
The provided database handle is invalid or null.

### Example

        mco_db_h db;
        int version;
        MCO_RET rc;

        rc = mco_db_connect("mydb", &db);
        if (rc == MCO_S_OK) {
            rc = mco_dict_version(db, &version);
            if (rc == MCO_S_OK) {
                printf("Current dictionary version: %d\n", version);
            }
        }

### Files

Header file:
mco.h
Source file:
mcodict.c
Library:
libmcolib.a