library

Database

VERSIONlatest All functions for databases operations.

DATABASES

NAME

databases - All functions for databases operations.

SYNOPSIS

sql

DESCRIPTION

Databases functions are used to access databases.

Database structure for foreign key
In version 5.0 or more of sncode, tables are stored in table sn_tables and fields in tables sn_fields. Category has been changed in this version. A category is a reference to another tables elements. Often called foreign key in database terminology. In sncode a foreign key is implemented in the following way: A field of the table is set as type foreign. The name of the field of the foreign table is set in foreign_field. The name of the foreign table is set in foreign_table. The foreign table use the field specify in foreign field as a key to the original table.

Table 1. sn_tables

uid uid of row

Many other fields

table_name

Name of the table

 

Table 2. sn_fields

uid uid of row

Many others fields

uid_sn_tables

Uid of tables with these fields

field_name

Name of the field

field_type

Type of field : image, foreign, text

field_format

Format of field : int, varchar, enum

field_length

Length of field : 255

foreign_table

Name of foreign table

foreign_field

Name of foreign field

local_field

Name of local field use as the key

Database structure for upload
Image or upload in general are defined with the original name of field, the name the file has been saved (sn_name_original) and the directory where the file has been saved (sn_path_original) and the content-type of the file (sn_ct_original) and the size of the file (sn_size_original).
Database structure for sn_cdate, sn_mdate, sn_cuid, sn_muid
These fields are used by Extenso to specify the creation and modification date, the creation uid and modify uid of the user. IN THIS VERSION OF SNCODE, THOSE FIELDS ARE NOT AUTOMATICALY SAVE.

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>