Schema, Table, Column and Database Naming
The RaimaDB system has very few restrictions on the naming of identifiers (schema, table, column, procedure or database names). HOWEVER, the user must be aware that additional restrictions for the names may be imposed by compilers or the file system in use during compilation or execution.
General Naming Suggestions
The general suggestions that apply to all identifiers are the following two:
- The first character of the identifier must be a letter of the alphabet (upper or lowercase) or an underscore ('_').
- The rest of the identifier name can consist of letters (upper or lowercase), underscores ('_') or digits (0-9).
These two suggestions will lessen the risks of many file system or compiler issues because of invalid file name characters or invalid characters in a C/C++ source file.
The default case for generate identifier names is uppercase.
Schema Naming Considerations
Some specific details that the user must be aware of with naming the schema file are:
- Problematic file names for the file system in use
- C/C++ keywords
- Macro names
- Invalid C/C++ identifiers
The rdm-compile
utility used to compile the schema and generate the necessary files for accessing the database with the RaimaDB APIs will use the base name of the schema file for generating: C/C++ header files; C/C++ source files; and, various labels within those files.
For example, the following will compiler the helloworld.sdl
schema file and generate the source files needed for a RaimaDB CPP API interface to a database using the helloworld.sdl
schema:
rdm-compile --cpp-api HelloWorld.sdl
The files generated will be:
HelloWorld_cat.cpp HelloWorld_cat.h HelloWorld_Doxyfile HelloWorld_gen.cpp HelloWorld_gen_api.h HelloWorld_mainpage.md HelloWorld_structs.h
The case of the schema file base name will be duplicated in the naming of the generated header and source files by the rdm-compile
utility.
Database Naming Considerations
For disk-based databases, the database name used must be a valid name for the file system in use. All database names will be converted to uppercase letters by default. The database name on the disk will have an ".rdm" extension in the Document Root (docroot) (docroot) directory. Database names with lowercase characters are supported but the name identifier will need to be in quotations.
Considerations
While the schema file name can be any name supported by the file system as long as it has a ".sdl
" extension, there are some limitations imposed by other entities in the development process that need to be considered when naming the schema file. Some of the issues that the developer needs to be aware of when naming a schema file are:
- SQL reserved words
- RaimaDB proprietary words
- Mixing of upper and lower case
- C/C++ keywords
- Macro names
- Invalid C/C++ identifiers
- Problematic filenames for the file system in use
- Unquoted identifiers are mapped to upper case
- The database name in
rdm_dbOpen()
is treated as a quoted identifier - Use quoted identifiers if you care about case
rdm-compile
have options for case
The above rules are suggestions and not enforced by the schema compiler.
While there is no practical limit to the length of the database name, compilers and other third-party tools may have limitations for database name lengths.
Review the Database Identifier (db-uri) section for how to reference the remote TFS when opening the database.