Skip to content

Commit

Permalink
Remove unused sql functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
splewis committed Apr 6, 2016
1 parent e8105b3 commit 0731ced
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions scripting/retakes/generic.sp
Original file line number Diff line number Diff line change
Expand Up @@ -218,53 +218,6 @@ stock bool Chance(float p) {
float f = GetRandomFloat();
return f < p;
}
/**
* Creates a table given an array of table arguments.
*/
stock void SQL_CreateTable(Handle db_connection, const char[] table_name, const char[][] fields, int num_fields) {
char buffer[1024];
Format(buffer, sizeof(buffer), "CREATE TABLE IF NOT EXISTS %s (", table_name);
for (int i = 0; i < num_fields; i++) {
StrCat(buffer, sizeof(buffer), fields[i]);
if (i != num_fields - 1)
StrCat(buffer, sizeof(buffer), ", ");
}
StrCat(buffer, sizeof(buffer), ")");

if (!SQL_FastQuery(db_connection, buffer)) {
char err[255];
SQL_GetError(db_connection, err, sizeof(err));
LogError(err);
}
}

/**
* Adds a new field to a table.
*/
stock void SQL_AddColumn(Handle db_connection, const char[] table_name, const char[] column_info) {
char buffer[1024];
Format(buffer, sizeof(buffer), "ALTER TABLE %s ADD COLUMN %s", table_name, column_info);
if (!SQL_FastQuery(db_connection, buffer)) {
char err[255];
SQL_GetError(db_connection, err, sizeof(err));
if (StrContains(err, "Duplicate column name", false) == -1) {
LogError(err);
}
}
}

/**
* Sets the primary key for a table.
*/
stock void SQL_UpdatePrimaryKey(Handle db_connection, const char[] table_name, const char[] primary_key) {
char buffer[1024];
Format(buffer, sizeof(buffer), "ALTER TABLE %s DROP PRIMARY KEY, ADD PRIMARY KEY (%s)", table_name, primary_key);
if (!SQL_FastQuery(db_connection, buffer)) {
char err[255];
SQL_GetError(db_connection, err, sizeof(err));
LogError(err);
}
}

/**
* Fills a buffer with the current map name,
Expand Down

0 comments on commit 0731ced

Please sign in to comment.