SQL Files

Talks about: , and

There are some restrictions on what counts as a .sql file for YoSQL.

Naming

In order to correctly guess which type (reading/writing/calling) your statement is, YoSQL does not parse your SQL code, but uses the file name of your .sql files or the name front matter. It applies the following rules to determine the type of a statement from its name:

You can always overwrite that guess with a specific type value in your front matter. This can be useful if you want to use a special name for your statement, but don’t want to adhere to the configured prefixes. On the other hand, enable validateMethodNamePrefixes to enforce that all statements are named accordingly to the configured prefixes.

File Extension

By default, YoSQL only considers files that end in .sql, but this can be configured using the sqlFilesSuffix option.

File Charset

By default, YoSQL uses the UTF-8 charset. In order to change this, use the sqlFilesCharset option.

Statement Separator

By default, YoSQL uses ; to separate multiple SQL statements within a single file. In order to change this, use the sqlStatementSeparator option.

License Headers

In case your .sql files contain a license header, use the skipLines option to skip those initial lines. Otherwise YoSQL will consider those lines to be part of the first statement in your .sql file.