All help topics · Link to this topic
Showing help on 'sqlite_open()'
Syntax: sqlite_open(STR <path to database>, [INT options]) => INTThe function `sqlite_open' will attempt to open the database at <path> for use with SQLite. The programmer must be a wizard, or E_PERM is raised.
The second argument is a bitmask of options. Options are:
SQLITE_PARSE_OBJECTS [4]: Determines whether strings beginning with a pound symbol (#) are interpreted as MOO object numbers or not.
The default is true, which means that any queries that would return a string (such as "#123") will be returned as objects.
SQLITE_PARSE_TYPES [2]: If unset, no parsing of rows takes place and only strings are returned.
SQLITE_SANITIZE_STRINGS [8]: If set, newlines (\n) are converted into tabs (\t) to avoid corrupting the MOO database. Default is unset.
NOTE: If the MOO doesn't support bitmasking, you can still specify options. You'll just have to manipulate the int yourself. e.g. if you want to parse objects and types, arg[2] would be a 6. If you only want to parse types, arg[2] would be 2.
If successful, the function will return the numeric handle for the open database.
E_QUOTA is raised if too many handles are open. E_INVARG is raised if the path is invalid or the database is already open; duplicate-open errors include the existing handle as the error value. If SQLite cannot open the database, E_NONE is raised with the SQLite error message.