Content


NTL
Core
DbSchema

DbSchema


Utility class providing high level abstraction for fetching some additional information about tables and columns. The class methods cache retrieved information so that further calls are very fast. To refresh information (querying it again from database) use refresh argument, specifying it as true.

You can find more information in comments below.

class DbSchema final
{
public:
    struct PrimaryKey // Primary key information 
    {
        String Name; // Primary key name 
        StringArray Columns; // Columns forming primary key 
    };

    struct Column // Column information 
    {
        DbValue DefaultValue; // Default value 
    };
public:
    static bool getPrimaryKey(const String& table, IDbStatement* statement, IDbQueryBuilder* qb, PrimaryKey& target, const bool& refresh = false); // Query table primary key information. Throw exceptions in case of error 
    static bool getPrimaryKey(const String& table, IDbConnection* connection, IDbQueryBuilder* qb, PrimaryKey& target, const bool& refresh = false); // Query table primary key information. Throw exceptions in case of error 
    static bool getAutoIncrementColumn(const String& table, IDbStatement* statement, IDbQueryBuilder* qb, String& target, const bool& refresh = false); // Query table autoincrement column information. Throw exceptions in case of error 
    static bool getAutoIncrementColumn(const String& table, IDbConnection* connection, IDbQueryBuilder* qb, String& target, const bool& refresh = false); // Query table autoincrement column information. Throw exceptions in case of error 
    static bool getColumn(const String& table, const String& column, IDbStatement* statement, Column& target, const bool& refresh = false); // Query table column information (default value). Throw exceptions in case of error 
    static bool getColumn(const String& table, const String& column, IDbConnection* connection, Column& target, const bool& refresh = false); // Query table column information (default value). Throw exceptions in case of error 
};
Namespace: nitisa
Include: Nitisa/Db/DbSchema.h