SQLite database related question
#1

What should I do, open the database on the server start and close it on the server exit or open it only when I'm making a query?

This:
pawn Код:
public OnGameModeInit()
{
    db_open("mydatabase.sqlite");
    return 1;
}

public OnGameModeExit()
{
    db_close(db_var);
    return 1;
}
Or this:
pawn Код:
public OnPlayerConnect()
{
    db_open("name.sqlite");
    // query and code
    db_close(db_var);
    return 1;
}
Reply
#2

Keep the connection alive, don't kill it every time that you use OnPlayerConnect. I'm 99% positive that re-opening it and closing it every time that OnPlayerConnect is called would be the inefficient way, resulting in the rest of your OnPlayerConnect code being executed a lot slower.

Anyhow, kudos on using SQLite.
Reply
#3

Alright, thanks for sharing your opinion.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)