https://open.mp logo
Title
d

damp-appointment-93881

05/25/2023, 9:12 AM
would it be a good idea to do something like this for the sake of modularity?
javascript
hook OnMySQLColumnCreate()
{
    Column_Define("accounts", "name varchar(24) NOT NULL UNIQUE KEY");
}

Column_Define(const string:table[], const string:column[])
{
    new query[256];

    mysql_format(MySQL_GetHandle(), query, sizeof(query), "ALTER TABLE '%e' ADD COLUMN IF NOT EXISTS '%e'", table, column);
    mysql_query(MySQL_GetHandle(), query, false);

    mysql_format(MySQL_GetHandle(), query, sizeof(query), "ALTER TABLE '%e' MODIFY IF EXISTS '%e'", table, column);
    mysql_query(MySQL_GetHandle(), query, false);
}