data-type ::= VARCHAR | NUMBER | BINARY dynamic-parameter ::= ? insert-value ::= dynamic-parameter | literal search-condition ::= column-identifier comparison-operator literal select-list ::= * | column-identifier [, column-identifier]… table-name ::= user-defined-name user-defined-name ::= letter [digit | letter] What all this grammar means is that the SimpleText driver supports a CREATE TABLE statement, a DROP TABLE statement, an INSERT statement (with parameters), and a very simple SELECT statement (with a WHERE clause). It may not seem like much, but this grammar is the foundation that will allow us to create a table, insert some data, and select it back. SimpleText File Format The format of the files used by the SimpleText driver is, of course, very simple. The first line contains a signature, followed by each one of the column names (and optional data types). Any subsequent lines in the text file are assumed to be comma-separated data. There is no size limit to the text file, but the larger the file, the longer it takes to retrieve data (the entire file is read when selecting data; there is no index support). The data file extension is hard coded to be .SDF (Simple Data File). For example, the statement CREATE TABLE TEST (COL1 VARCHAR, COL2 NUMBER, COL3 BINARY) creates a file named TEST.SDF, with the following initial data: .SDFCOL1,#COL2,@COL3 Note that none of the SQL grammar is case-sensitive. The .SDF is the file signature (this is how the SimpleText driver validates whether the text file can be used), followed by a comma-separated list of column names. The first character of the column name can specify the data type of the column. A column name starting with a # indicates a numeric column, while a column name starting with an @ indicates a binary column. What s that? Binary data in a text file? Well, not quite. A binary column actually contains an offset pointer into a sister file. This file, with an extension of .SBF (Simple Binary File), contains any binary data for columns in the text file, as well as the length of the data (maximum length of 1048576 bytes). Any other column name is considered to be character data (with a maximum length of 5120 bytes). The following statement shows how data is inserted into the TEST table: INSERT INTO TEST VALUES (’FOO’, 123, ‘0123456789ABCDEF’) After the INSERT, TEST.SDF will contain the following data: .SDFCOL1,#COL2,@COL3 FOO,123,0
Our stuff is composed of devoted and highly-tainted professionals, creating a mix of powerful and high-quality web hosting perl services, check web hosting perl.