# In all of the following statements, the '{0}' variable represents the table name

# The statement that creates the table. This is using a special collator to make sure ID comparison is case sensitive
create_table = CREATE TABLE {0} (ID NVARCHAR(255) PRIMARY KEY , \
                                 LAST_CHANGED DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, \
                                 CONTENT VARBINARY(max) NOT NULL)

# The statement that drops the table
delete_table = DROP TABLE {0}

# Get all the ids (keys) from a table
get_all_ids = SELECT ID FROM {0}

# Get the content of row 
get_by_id = SELECT CONTENT FROM {0} WHERE ID = ?

# The selection clause that is used whenever dealing with multiple entries
multiple_selection_clause = ID IN (#)

# Load multiple contents by id
get_multiple = SELECT CONTENT FROM {0} WHERE #

# Check if a row exists
content_exists = SELECT 1 FROM {0} WHERE ID = ?

# Insert a new document into the table
insert_content = INSERT INTO {0} (ID, CONTENT) VALUES (?, ?)

# Update an existing document
update_content = UPDATE {0} SET LAST_CHANGED=CURRENT_TIMESTAMP, CONTENT = ? WHERE ID = ?

# Remove an existing document
remove_content = DELETE FROM {0} WHERE #

# Remove all documents
remove_all_content = DELETE FROM {0}

# Lock documents
lock_content = SELECT ID FROM {0} WHERE # WITH (UPDLOCK, ROWLOCK)