Skip to main content

Module script_split

Module script_split 

Source
Expand description

Cutting a file of statements into the statements it carries.

§The cut is made over the blanked text, never over the raw one

A separator inside a text literal, a quoted name or a comment is not a separator. crate::sql::strip() replaces every such region with as many spaces as it had bytes, so the blanked text keeps the offsets of the original: the search runs over the blanked text, the cut is applied to the original, and every byte the caller wrote survives.

§Why the separator can be redefined

A routine body carries separators of its own. Without a way to redefine the separator, such a file would be cut in the middle of the body and each fragment sent as a statement of its own. The redefinition is a directive of the file, is never sent to the server, and applies only inside the file it appears in. It never relaxes the rule that one call carries one statement.

Running the statements this module produces is super::script. Cutting a file and running it are different jobs: the cut is pure and provable without a server, and everything here is tested that way.

Structs§

Piece
One statement taken out of a file.
Statements
The statements of one file, produced one at a time.

Functions§

split
Cuts a file into the statements it carries, one at a time.
validate_delimiter
Refuses a separator that could never separate anything.