dict

package
v0.0.0-...-91c5940 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2017 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SPEC_SYSLOGINS_COLLECION_DEFAULT_SIZE      = 50
	SPEC_SYSDATABASES_COLLECION_DEFAULT_SIZE   = 10
	SPEC_SYSSCHEMAS_COLLECION_DEFAULT_SIZE     = 10
	SPEC_SYSTABLES_COLLECION_DEFAULT_SIZE      = 50
	SPEC_SYSPRINCIPALS_COLLECION_DEFAULT_SIZE  = 20
	SPEC_SYSPERMISSIONS_COLLECION_DEFAULT_SIZE = 50
)
View Source
const (
	SA_LOGIN_ID  = 1000    // login_id of 'sa'. IMPORTANT: IF YOU CHANGE THIS VALUE, YOU MUST CHANGE THE VALUE IN sql_install_script STRING, IN "install_master_db.go" FILE, AT LINE 'INSERT INTO syslogins'
	TRASHDB_DBID = 100     // dbid of 'trashdb'
	SCHID_DBO    = 0       // all databases will have a 'dbo' schema with this schid
	SCHID_START  = 5000    // first schid (excepted for 'dbo' schemas, which schid are always SCHID_DBO)
	PALID_START  = 30000   // first palid
	TBLID_START  = 7000000 // first tblid
)
View Source
const (
	SPEC_WORKERS_MAX_LIMIT                  = 64  // because permissions for each worker are put in a uint64 bitset
	SPEC_READ_TIMEOUT_MIN_LIMIT             = 1   // min read timeout, in seconds
	SPEC_LOCK_TICKER_INTERVAL_MIN_LIMIT     = 200 // min lock ticker interval, in milliseconds
	SPEC_LOCK_TIMEOUT_TICKS_COUNT_MIN_LIMIT = 1   // min timeout ticks count
)
View Source
const (
	SHOW_PERM_SORT_BY_OBJECT = 1 << iota
	SHOW_PERM_SORT_BY_PRINCIPAL
)
View Source
const (
	MAX_SERVERNAME_RUNE_LENGTH = 500 // servername max rune length
)
View Source
const SYSIDX_PREFIX = "sysidx$"

Variables

This section is empty.

Functions

func Display_perm

func Display_perm(perm rsql.Permission_t) string

func Get_new_index_sysname_string

func Get_new_index_sysname_string(gtabledef *rsql.GTabledef) string

Get_new_index_sysname_string creates a new index name, different from all names in indexmap and different from index_name in base Tabledef.

func Install_master_db

func Install_master_db(instance_name string, server_default_collation string, server_default_language string, server_listener_address string)

Install_master_db initializes the current directory, so that it can be used by the database server. It creates master.db in the current directory, and directories needed by the database server. If the directory is not empty, the function calls log.Fatal(). If server_listener_address is empty string, it will be set to a default value.

func Quote_escape

func Quote_escape(s string) string

Quote_escape replaces all single quotes by two single quotes, to escape them as SQL string.

func SQL_string

func SQL_string(perm rsql.Permission_t) string

func Sql_creation_script_table

func Sql_creation_script_table(database_name string, schema_name string, gtabledef *rsql.GTabledef, server_default_collation string, coll *collate.Collator) string

Sql_creation_script_table creates the CREATE TABLE script for the table. It is also used by BACKUP DATABASE statement.

If server_default_collation is not empty string, COLLATE clause will not appear for VARCHAR columns having this collation. So, to always specify the COLLATE clause for all VARCHAR columns, pass an empty string (or any string that is not a collation) as argument.

Argument coll is the collation to sort the index names.

Types

type Alter_column_nullability_t

type Alter_column_nullability_t uint8

used by ALTER TABLE statements.

const (
	ALTER_COLUMN_NULLABILITY_NONE Alter_column_nullability_t = 0
	ALTER_COLUMN_NULL             Alter_column_nullability_t = 1
	ALTER_COLUMN_NOT_NULL         Alter_column_nullability_t = 2
)

type Backup_gtabledef_item

type Backup_gtabledef_item struct {
	Gt_gtabledef   *rsql.GTabledef
	Gt_permissions []*Backup_permission
}

type Backup_list_of_principals

type Backup_list_of_principals struct {
	// contains filtered or unexported fields
}

Backup_list_of_principals is used to sort the list of principals by alphabetical order.

func New_Backup_list_of_principals

func New_Backup_list_of_principals(lst []*Backup_principal_item, coll *collate.Collator) Backup_list_of_principals

func (Backup_list_of_principals) Len

func (list Backup_list_of_principals) Len() int

func (Backup_list_of_principals) Less

func (list Backup_list_of_principals) Less(i, j int) bool

func (Backup_list_of_principals) Swap

func (list Backup_list_of_principals) Swap(i, j int)

type Backup_permission

type Backup_permission struct {
	Pm_principal string
	Pm_grant     rsql.Permission_t
	Pm_deny      rsql.Permission_t
}

type Backup_principal_item

type Backup_principal_item struct {
	Pal_database_name   string
	Pal_name            string
	Pal_palid           int64
	Pal_type            Pal_type_t
	Pal_login_id        int64
	Pal_system_flag     Pal_sysflag_t
	Pal_member_of       []string
	Lg_name             string // this field and following only for users, not for roles
	Lg_password_hash    string
	Lg_default_database string
	Lg_default_language string
	Lg_disabled_flag    bool
	Lg_system_flag      Lg_sysflag_t // LG_SYSFLAG_SA for 'sa', else 0
}

type Database_params

type Database_params struct {
	Dbp_name   string
	Dbp_status lex.Auxword_t
	Dbp_mode   lex.Auxword_t
	Dbp_access lex.Auxword_t
}

Database_params is used by ALTER DATABASE to pass argument to VM.

type Db_access_t

type Db_access_t uint8
const (
	DB_ACCESS_RESTRICTED_USER Db_access_t = 1 + iota
	DB_ACCESS_MULTI_USER
)

func (Db_access_t) String

func (access Db_access_t) String() string

type Db_mode_t

type Db_mode_t uint8
const (
	DB_MODE_READ_WRITE Db_mode_t = 1 + iota
	DB_MODE_READ_ONLY
)

func (Db_mode_t) String

func (mode Db_mode_t) String() string

type Db_status_t

type Db_status_t uint8
const (
	DB_STATUS_BEING_CREATED Db_status_t = 1 + iota
	DB_STATUS_ONLINE
	DB_STATUS_OFFLINE
	DB_STATUS_CORRUPTED
	DB_STATUS_BEING_DROPPED
)

func (Db_status_t) String

func (status Db_status_t) String() string

type Db_sysflag_t

type Db_sysflag_t int64
const (
	DB_SYSFLAG_TRASHDB Db_sysflag_t = 1 << iota
)

type Dict_tran_status_t

type Dict_tran_status_t uint8
const (
	DICT_TRAN_STATUS_NONE               Dict_tran_status_t = iota // set by COMMIT sql statement
	DICT_TRAN_STATUS_INSIDE_TRANSACTION                           // set by BEGIN sql statement
)

type Dictionary_manager

type Dictionary_manager struct {
	// contains filtered or unexported fields
}
var MASTER Dictionary_manager

func (*Dictionary_manager) Add_sysdatabase

func (dictmgr *Dictionary_manager) Add_sysdatabase(context *rsql.Context, database_name string) *rsql.Error

Add_sysdatabase implements CREATE DATABASE statement.

func (*Dictionary_manager) Add_sysindex

func (dictmgr *Dictionary_manager) Add_sysindex(context *rsql.Context, table_qname rsql.Object_qname_t, index_name string, index_name_original string, index_type rsql.Td_index_type_t, cluster_type rsql.Td_cluster_type_t, keyname_list []string) (gtabledef_new_clustered *rsql.GTabledef, rsql_err *rsql.Error)

Add_sysindex implements CREATE INDEX and ALTER TABLE ADD CONSTRAINT statements.

func (*Dictionary_manager) Add_syslogin

func (dictmgr *Dictionary_manager) Add_syslogin(context *rsql.Context, login_name string, login_params Login_params) *rsql.Error

Add_syslogin implements CREATE LOGIN statement.

func (*Dictionary_manager) Add_sysprincipal_role

func (dictmgr *Dictionary_manager) Add_sysprincipal_role(context *rsql.Context, database_name string, role_name string) *rsql.Error

Add_sysprincipal_role implements CREATE ROLE statement.

func (*Dictionary_manager) Add_sysprincipal_user

func (dictmgr *Dictionary_manager) Add_sysprincipal_user(context *rsql.Context, database_name string, user_name string, login_name string) *rsql.Error

Add_sysprincipal_user implements CREATE USER statement.

func (*Dictionary_manager) Add_systable

func (dictmgr *Dictionary_manager) Add_systable(context *rsql.Context, database_name string, schema_name string, gtabledef *rsql.GTabledef) *rsql.Error

Add_systable implements CREATE TABLE statement.

func (*Dictionary_manager) Authenticate_login

func (dictmgr *Dictionary_manager) Authenticate_login(login_name string, password string) (login_name_lc string, login_id int64, login_default_language string, login_default_database string, rsql_err *rsql.Error)

func (*Dictionary_manager) COMMIT

func (dictmgr *Dictionary_manager) COMMIT()

func (*Dictionary_manager) COMMIT_and_BEGIN_EXCLUSIVE

func (dictmgr *Dictionary_manager) COMMIT_and_BEGIN_EXCLUSIVE()

func (*Dictionary_manager) Change_authorization

func (dictmgr *Dictionary_manager) Change_authorization(context *rsql.Context, database_name string, change_owner_login string) *rsql.Error

Change_authorization implements ALTER AUTHORIZATION statement.

func (*Dictionary_manager) Change_database_status

func (dictmgr *Dictionary_manager) Change_database_status(context *rsql.Context, database_name string, new_status Db_status_t) *rsql.Error

Change_database_status changes the status of the database (DB_STATUS_ONLINE, DB_STATUS_OFFLINE, DB_STATUS_CORRUPTED). It is used by the RESTORE command.

func (*Dictionary_manager) Change_sysdatabase

func (dictmgr *Dictionary_manager) Change_sysdatabase(context *rsql.Context, database_name string, changes Database_params) *rsql.Error

Change_sysdatabase implements ALTER DATABASE statement.

func (*Dictionary_manager) Change_sysindex

func (dictmgr *Dictionary_manager) Change_sysindex(context *rsql.Context, table_qname rsql.Object_qname_t, index_name string, change_index_name string, change_index_name_original string) *rsql.Error

Change_sysindex implements ALTER INDEX statement.

func (*Dictionary_manager) Change_syslogin

func (dictmgr *Dictionary_manager) Change_syslogin(context *rsql.Context, login_name string, changes Login_params) *rsql.Error

Change_syslogin implements ALTER LOGIN statement.

func (*Dictionary_manager) Change_sysprincipal_role

func (dictmgr *Dictionary_manager) Change_sysprincipal_role(context *rsql.Context, database_name string, role_name string, change_name string, add_member_name string, drop_member_name string) *rsql.Error

Change_sysprincipal_role implements ALTER ROLE statement.

func (*Dictionary_manager) Change_sysprincipal_user

func (dictmgr *Dictionary_manager) Change_sysprincipal_user(context *rsql.Context, database_name string, user_name string, change_name string, change_login string) *rsql.Error

Change_sysprincipal_user implements ALTER USER statement.

func (*Dictionary_manager) Change_systable

func (dictmgr *Dictionary_manager) Change_systable(context *rsql.Context, table_qname rsql.Object_qname_t, change_table_name string, change_table_name_original string, column_name string, change_column_name string, change_column_name_original string, change_column_nullability Alter_column_nullability_t) *rsql.Error

Change_systable implements ALTER TABLE statement. Note that we want to allow changing table name even if table is with invalid status.

func (*Dictionary_manager) Change_trashdb_to_read_only_at_install

func (dictmgr *Dictionary_manager) Change_trashdb_to_read_only_at_install(context *rsql.Context) *rsql.Error

used by Install_master_db(), to put trashdb in read only mode at installation.

func (*Dictionary_manager) Check_SA

func (dictmgr *Dictionary_manager) Check_SA(context *rsql.Context) *rsql.Error

Check_SA checks if login is 'sa'.

func (*Dictionary_manager) Check_all_databases_status_mode_access

func (dictmgr *Dictionary_manager) Check_all_databases_status_mode_access(context *rsql.Context, registration *lk.Registration) *rsql.Error

Check_all_databases_status_mode_access checks status, mode and access of database.

This function checks if status is DB_STATUS_OFFLINE/CORRUPTED, if mode is DB_MODE_READ_ONLY, and if access is DB_ACCESS_RESTRICTED_USER. If the user want to make some action incompatible with these attributes, an error is returned.

func (*Dictionary_manager) Check_databases_status_not_corrupted

func (dictmgr *Dictionary_manager) Check_databases_status_not_corrupted(database_name string) *rsql.Error

Check_databases_status_not_corrupted returns an error if database status is DB_STATUS_CORRUPTED.

func (*Dictionary_manager) Check_dictionary_maps

func (dictmgr *Dictionary_manager) Check_dictionary_maps()

Check_dictionary_maps is only used for debugging purpose. It should not be used in production code.

func (*Dictionary_manager) Check_is_SA

func (dictmgr *Dictionary_manager) Check_is_SA(context *rsql.Context) *rsql.Error

func (*Dictionary_manager) Check_is_SA_or_DBO

func (dictmgr *Dictionary_manager) Check_is_SA_or_DBO(context *rsql.Context, database_name string) *rsql.Error

func (*Dictionary_manager) Check_objects_permissions

func (dictmgr *Dictionary_manager) Check_objects_permissions(context *rsql.Context, registration *lk.Registration) *rsql.Error

Check_objects_permissions checks if login has all requested permissions on all objects.

func (*Dictionary_manager) Close

func (dictmgr *Dictionary_manager) Close()

func (*Dictionary_manager) DB_change_GTabledef_status_all

func (dictmgr *Dictionary_manager) DB_change_GTabledef_status_all(gtabledef *rsql.GTabledef, status rsql.Td_status_t)

func (*Dictionary_manager) DB_change_Tabledef_status

func (dictmgr *Dictionary_manager) DB_change_Tabledef_status(tabledef *rsql.Tabledef, status rsql.Td_status_t)

func (*Dictionary_manager) DB_delete_GTabledef_all

func (dictmgr *Dictionary_manager) DB_delete_GTabledef_all(gtblid int64)

func (*Dictionary_manager) DB_delete_Tabledef

func (dictmgr *Dictionary_manager) DB_delete_Tabledef(tblid int64)

func (*Dictionary_manager) DB_insert_GTabledef

func (dictmgr *Dictionary_manager) DB_insert_GTabledef(gtabledef *rsql.GTabledef)

func (*Dictionary_manager) DB_insert_GTabledef_all

func (dictmgr *Dictionary_manager) DB_insert_GTabledef_all(gtabledef *rsql.GTabledef)

func (*Dictionary_manager) DB_insert_Tabledef

func (dictmgr *Dictionary_manager) DB_insert_Tabledef(tabledef *rsql.Tabledef)

func (*Dictionary_manager) DB_substitute_GTabledef

func (dictmgr *Dictionary_manager) DB_substitute_GTabledef(context *rsql.Context, gtabledef *rsql.GTabledef) (wcache_new *cache.Wcache, rsql_err *rsql.Error)

used when the native key is changed. The number of files and their names is not changed. Only their content is modified to reflect the new table layout.

THIS FUNCTION IS NOT USED ANY MORE.

func (*Dictionary_manager) Execute

func (dictmgr *Dictionary_manager) Execute(stmt_kind Stmt_kind_t, arg sqlite3.NamedArgs)

func (*Dictionary_manager) Get_gtable_full_name

func (dictmgr *Dictionary_manager) Get_gtable_full_name(tabledef *rsql.Tabledef) string

Get_gtable_full_name returns qualified name string of the base table. It is used for error message, to get the full base table name, when we pass any tabledef as argument.

func (*Dictionary_manager) Get_gtabledef

func (dictmgr *Dictionary_manager) Get_gtabledef(table_qname rsql.Object_qname_t) (*rsql.GTabledef, *rsql.Error)

Get_gtabledef returns requested tabledef.

func (*Dictionary_manager) Get_gtblid

func (dictmgr *Dictionary_manager) Get_gtblid(table_qname rsql.Object_qname_t) (int64, *rsql.Error)

Get_gtblid returns gtblid.

func (*Dictionary_manager) Get_named_gtabledefs

func (dictmgr *Dictionary_manager) Get_named_gtabledefs() (result []Named_GTabledefs)

Get_named_gtabledefs returns a slice of GTabledefs, sorted by <database_name, schema_name, gtabledef_name>.

func (*Dictionary_manager) Get_sysdatabase_id

func (dictmgr *Dictionary_manager) Get_sysdatabase_id(database_name []byte) (dbid int64, ok bool)

Get_sysdatabase_id implements DB_ID function.

func (*Dictionary_manager) Get_sysdatabase_info

func (dictmgr *Dictionary_manager) Get_sysdatabase_info(database_name string) (info string, rsql_err *rsql.Error)

Get_sysdatabase_info gets status, mode and access of the database. It is used by SHOW INFO.

func (*Dictionary_manager) Get_sysdatabase_name

func (dictmgr *Dictionary_manager) Get_sysdatabase_name(dbid int64) (database_name string, ok bool)

Get_sysdatabase_name implements DB_NAME function.

func (*Dictionary_manager) Get_syslogin_id

func (dictmgr *Dictionary_manager) Get_syslogin_id(login_name []byte) (login_id int64, ok bool)

Get_syslogin_id implements SUSER_ID function.

func (*Dictionary_manager) Get_syslogin_name

func (dictmgr *Dictionary_manager) Get_syslogin_name(login_id int64) (login_name string, ok bool)

Get_syslogin_name implements SUSER_NAME function.

func (*Dictionary_manager) Get_sysparameters_int_value

func (dictmgr *Dictionary_manager) Get_sysparameters_int_value(param_id Server_parameter_t) int64

func (*Dictionary_manager) Get_sysparameters_string_value

func (dictmgr *Dictionary_manager) Get_sysparameters_string_value(param_id Server_parameter_t) string

func (*Dictionary_manager) Get_sysprincipal_id

func (dictmgr *Dictionary_manager) Get_sysprincipal_id(dbid int64, principal_name []byte) (palid int64, ok bool)

Get_sysprincipal_id implements USER_ID function.

func (*Dictionary_manager) Get_sysprincipal_name

func (dictmgr *Dictionary_manager) Get_sysprincipal_name(dbid int64, palid int64) (principal_name string, ok bool)

Get_sysprincipal_name implements USER_NAME function.

func (*Dictionary_manager) Get_sysschema_id

func (dictmgr *Dictionary_manager) Get_sysschema_id(dbid int64, schema_name []byte) (schid int64, ok bool)

Get_sysschema_id implements SCHEMA_ID function.

func (*Dictionary_manager) Get_sysschema_name

func (dictmgr *Dictionary_manager) Get_sysschema_name(dbid int64, schid int64) (schema_name string, ok bool)

Get_sysschema_name implements SCHEMA_NAME function.

func (*Dictionary_manager) Grant_or_deny_syspermission_for_principals

func (dictmgr *Dictionary_manager) Grant_or_deny_syspermission_for_principals(context *rsql.Context, object_qname rsql.Object_qname_t, perm_grant rsql.Permission_t, perm_deny rsql.Permission_t, list_of_principal_names []string) *rsql.Error

Grant_or_deny_syspermission_for_principals implements GRANT or DENY statement.

func (*Dictionary_manager) LOCK

func (dictmgr *Dictionary_manager) LOCK()

func (*Dictionary_manager) LOCK_and_BEGIN_EXCLUSIVE

func (dictmgr *Dictionary_manager) LOCK_and_BEGIN_EXCLUSIVE()

func (*Dictionary_manager) Load_dict_from_master_db

func (dictmgr *Dictionary_manager) Load_dict_from_master_db()

Load_dict_from_master_db loads all records from the master database into memory.

It cannot be called in init(), because the server calls os.Chdir to change the current directory, but init() is run before os.Chdir is called, and the path of master.db would be wrong.

func (*Dictionary_manager) Must_load_SYSDATABASES

func (dictmgr *Dictionary_manager) Must_load_SYSDATABASES()

Must_load_SYSDATABASES loads all databases stored in master.db into dictmgr. It is done at init, when the server starts.

func (*Dictionary_manager) Must_load_SYSLOGINS

func (dictmgr *Dictionary_manager) Must_load_SYSLOGINS()

Must_load_SYSLOGINS loads all logins stored in master.db into dictmgr. It is done at init, when the server starts.

func (*Dictionary_manager) Must_load_SYSPARAMETERS

func (dictmgr *Dictionary_manager) Must_load_SYSPARAMETERS()

Must_load_SYSPARAMETERS loads all parameters stored in master.db into dictmgr. It is done at init, when the server starts.

func (*Dictionary_manager) Must_load_SYSPERMISSIONS

func (dictmgr *Dictionary_manager) Must_load_SYSPERMISSIONS()

Must_load_SYSPRINCIPALS loads all principals stored in master.db into dictmgr. It is done at init, when the server starts.

func (*Dictionary_manager) Must_load_SYSPRINCIPALS

func (dictmgr *Dictionary_manager) Must_load_SYSPRINCIPALS()

Must_load_SYSPRINCIPALS loads all principals stored in master.db into dictmgr. It is done at init, when the server starts.

func (*Dictionary_manager) Must_load_SYSSCHEMAS

func (dictmgr *Dictionary_manager) Must_load_SYSSCHEMAS()

Must_load_SYSSCHEMAS loads all schemas stored in master.db into dictmgr. It is done at init, when the server starts.

func (*Dictionary_manager) Must_load_SYSTABLES

func (dictmgr *Dictionary_manager) Must_load_SYSTABLES()

func (*Dictionary_manager) Must_load_params_from_master_db

func (dictmgr *Dictionary_manager) Must_load_params_from_master_db(param Server_parameter_t) (value_int int64, value_string string)

Must_load_params_from_master_db reads the specified parameter directly from master.db.

It is used during server initialization to get the logger rotation parameters.

func (*Dictionary_manager) Open

func (dictmgr *Dictionary_manager) Open()

func (*Dictionary_manager) Print_dictionary_maps

func (dictmgr *Dictionary_manager) Print_dictionary_maps()

Print_dictionary_maps is only used for debugging purpose. It should not be used in production code.

func (*Dictionary_manager) Remove_sysdatabase

func (dictmgr *Dictionary_manager) Remove_sysdatabase(context *rsql.Context, database_name string) *rsql.Error

Remove_sysdatabase implements DROP DATABASE statement.

func (*Dictionary_manager) Remove_sysindex

func (dictmgr *Dictionary_manager) Remove_sysindex(context *rsql.Context, table_qname rsql.Object_qname_t, index_name string) *rsql.Error

Remove_sysindex implements DROP INDEX statement.

It is not allowed to drop a clustered index (aka native index). You must drop the table and recreate a new one.

func (*Dictionary_manager) Remove_syslogin

func (dictmgr *Dictionary_manager) Remove_syslogin(context *rsql.Context, login_name string) *rsql.Error

Remove_syslogin implements DROP LOGIN statement.

func (*Dictionary_manager) Remove_sysprincipal_role

func (dictmgr *Dictionary_manager) Remove_sysprincipal_role(context *rsql.Context, database_name string, role_name string) *rsql.Error

Remove_sysprincipal_role implements DROP ROLE statement.

func (*Dictionary_manager) Remove_sysprincipal_user

func (dictmgr *Dictionary_manager) Remove_sysprincipal_user(context *rsql.Context, database_name string, user_name string) *rsql.Error

Remove_sysprincipal_user implements DROP USER statement.

Cannot remove 'dbo' user.

func (*Dictionary_manager) Remove_systable

func (dictmgr *Dictionary_manager) Remove_systable(context *rsql.Context, table_qname rsql.Object_qname_t) *rsql.Error

Remove_systable implements DROP TABLE statement.

func (*Dictionary_manager) Retrieve_list_of_gtabledefs

func (dictmgr *Dictionary_manager) Retrieve_list_of_gtabledefs(database_name string) ([]*rsql.GTabledef, *rsql.Error)

Retrieve_list_of_gtabledefs returns a list of all tables in database. It is used by BACKUP DATABASE.

func (*Dictionary_manager) Retrieve_list_of_table_names

func (dictmgr *Dictionary_manager) Retrieve_list_of_table_names(database_name string) ([]rsql.Object_qname_t, *rsql.Error)

Retrieve_list_of_table_names returns a list of all tables in database. It is used by DUMP DATABASE, to have the list of tables to lock.

func (*Dictionary_manager) Retrieve_sorted_list_of_GTabledefs

func (dictmgr *Dictionary_manager) Retrieve_sorted_list_of_GTabledefs(context *rsql.Context, params rsql.Show_params) (header string, list []Show_table_item, rsql_err *rsql.Error)

Retrieve_sorted_list_of_GTabledefs returns a list of tables, sorted by alphabetical order.

If params.Sh_option_ALL == true, tables from all databases are retrieved. Else, only tables in this database are retrieved.

If params.Sh_object_name == "", all tables are retrieved. Else, only tables with this name are retrieved.

If params.Sh_LIKE_flag == true, params.Sh_LIKE_pattern is a LIKE pattern.

func (*Dictionary_manager) Retrieve_sorted_list_of_databases

func (dictmgr *Dictionary_manager) Retrieve_sorted_list_of_databases(context *rsql.Context, params rsql.Show_params) (header string, list []Show_database_item, rsql_err *rsql.Error)

Retrieve_sorted_list_of_databases returns a list of databases, sorted by alphabetical order.

If params.Sh_database_name == "", all databases are retrieved. Else, only this database is retrieved.

If params.Sh_LIKE_flag == true, params.Sh_LIKE_pattern is a LIKE pattern.

func (*Dictionary_manager) Retrieve_sorted_list_of_logins

func (dictmgr *Dictionary_manager) Retrieve_sorted_list_of_logins(context *rsql.Context, params rsql.Show_params) (header string, list []Show_login_item, rsql_err *rsql.Error)

Retrieve_sorted_list_of_logins returns a list of logins, sorted by alphabetical order.

If params.Sh_object_name == "", all logins are retrieved. Else, only this login is retrieved.

If params.Sh_LIKE_flag == true, params.Sh_LIKE_pattern is a LIKE pattern.

func (*Dictionary_manager) Retrieve_sorted_list_of_principals

func (dictmgr *Dictionary_manager) Retrieve_sorted_list_of_principals(context *rsql.Context, params rsql.Show_params, requested_pal_type Pal_type_t) (header string, list []Show_principal_item, sql_membership_script string, rsql_err *rsql.Error)

Retrieve_sorted_list_of_principals returns a list of principals, sorted by alphabetical order.

If params.Sh_option_ALL == true, principals from all databases are retrieved. Else, only principals in this database are retrieved.

If params.Sh_object_name == "", all principals are retrieved. Else, only principals with this name are retrieved.

If params.Sh_LIKE_flag == true, params.Sh_LIKE_pattern is a LIKE pattern.

If requested_pal_type == PAL_TYPE_USER, users and roles are retrieved, as we usually wants to see users and roles in the same listing. If requested_pal_type == PAL_TYPE_ROLE, only roles are retrieved.

func (*Dictionary_manager) Retrieve_sorted_list_of_principals_gtabledefs_for_BACKUP

func (dictmgr *Dictionary_manager) Retrieve_sorted_list_of_principals_gtabledefs_for_BACKUP(context *rsql.Context, database_name string, params rsql.Backup_params) (list_principals []*Backup_principal_item, list_gtabledefs_perms []*Backup_gtabledef_item, rsql_err *rsql.Error)

Retrieve_sorted_list_of_principals_gtabledefs_for_BACKUP retrieves all information about the database: logins, users, roles, gtabledefs and permissions.

func (*Dictionary_manager) Retrieve_sorted_list_of_sysparameters

func (dictmgr *Dictionary_manager) Retrieve_sorted_list_of_sysparameters(context *rsql.Context, params rsql.Show_params) (header string, list []Show_sysparameter_item, rsql_err *rsql.Error)

Retrieve_sorted_list_of_sysparameters returns a list of parameters, sorted by id.

If params.Sh_object_name == "", all parameters are retrieved. Else, only this parameter is retrieved.

If params.Sh_LIKE_flag == true, params.Sh_LIKE_pattern is a LIKE pattern.

func (*Dictionary_manager) Revoke_syspermission_for_principals

func (dictmgr *Dictionary_manager) Revoke_syspermission_for_principals(context *rsql.Context, object_qname rsql.Object_qname_t, perm rsql.Permission_t, list_of_principal_names []string, from_all bool) *rsql.Error

Revoke_syspermission_for_principals implements REVOKE statement.

func (*Dictionary_manager) UNLOCK

func (dictmgr *Dictionary_manager) UNLOCK()

func (*Dictionary_manager) Update_sysparameter_value_int

func (dictmgr *Dictionary_manager) Update_sysparameter_value_int(context *rsql.Context, param_id Server_parameter_t, value int64, option Param_update_option_t) *rsql.Error

Update_sysparameter_value_int implements ALTER SERVER PARAMETER statement, for changing integer value. Option is PARAM_UPDATE_AT_RESTART or PARAM_UPDATE_IMMEDIATE

func (*Dictionary_manager) Update_sysparameter_value_string

func (dictmgr *Dictionary_manager) Update_sysparameter_value_string(context *rsql.Context, param_id Server_parameter_t, value string, option Param_update_option_t) *rsql.Error

Update_sysparameter_value_int implements ALTER SERVER PARAMETER statement, for changing string value. Option is PARAM_UPDATE_AT_RESTART or PARAM_UPDATE_IMMEDIATE

func (*Dictionary_manager) Use_sysdatabase

func (dictmgr *Dictionary_manager) Use_sysdatabase(login_id int64, login_name_for_info string, database_name string) (dbid int64, schema_name string, schema_schid int64, user_name string, user_palid int64, rsql_err *rsql.Error)

Use_sysdatabase implements USE database statement.

type Index_params

type Index_params struct {
	Table_qname         rsql.Object_qname_t
	Index_name          string
	Index_name_original string
	Index_type          rsql.Td_index_type_t
	Cluster_type        rsql.Td_cluster_type_t
	Colname_list        []string
}

used to pass arguments of CREATE INDEX to vm.

type Lg_sysflag_t

type Lg_sysflag_t int64
const (
	LG_SYSFLAG_SA Lg_sysflag_t = 1 << iota
)

type Login_params

type Login_params struct {
	Lgp_name             string
	Lgp_password_hash    string
	Lgp_default_database string
	Lgp_default_language string
	Lgp_disable_option   lex.Auxword_t
}

Login_params is used to pass login information to VM, for CREATE LOGIN and ALTER LOGIN.

type Map_login_dbid_key

type Map_login_dbid_key struct {
	// contains filtered or unexported fields
}

type Map_login_dbid_user

type Map_login_dbid_user map[Map_login_dbid_key]int64

Map_login_dbid_user store the user palid for each key <login_id, dbid>. It is a helper map, to accelerate the lookup. Without it, we would have to lookup all elements in MASTER.dm_SYSPRINCIPALS.

It is updated by CREATE USER, ALTER USER, DROP USER, and also by CREATE DATABASE ('dbo' user is created), and DROP DATABASE (all users are deleted).

type Named_GTabledefs

type Named_GTabledefs struct {
	M_db_name     string
	M_schema_name string
	M_gtabledef   *rsql.GTabledef
}

type Pal_sysflag_t

type Pal_sysflag_t int64
const (
	PAL_SYSFLAG_USER_DBO    Pal_sysflag_t = 1 << iota
	PAL_SYSFLAG_ROLE_PUBLIC Pal_sysflag_t = 1 << iota
)

type Pal_type_t

type Pal_type_t uint8
const (
	PAL_TYPE_USER Pal_type_t = iota
	PAL_TYPE_ROLE
)

type Param_update_option_t

type Param_update_option_t uint8
const (
	PARAM_UPDATE_AT_RESTART Param_update_option_t = iota // parameter is updated at next restart of the server
	PARAM_UPDATE_IMMEDIATE                               // parameter is updated immediately
)

type Perm_key_t

type Perm_key_t struct {
	Objid int64
	Palid int64
}

type Role_list

type Role_list []*Sysprincipal

type Server_parameter_t

type Server_parameter_t uint32
const (
	PARAM_SERVER_DEFAULT_COLLATION Server_parameter_t = iota
	PARAM_SERVER_SERVERNAME
	PARAM_SERVER_WORKERS_MAX
	PARAM_SERVER_GLOBAL_PAGE_CACHE_MEMORY
	PARAM_SERVER_DEFAULT_DATABASE
	PARAM_SERVER_DEFAULT_LANGUAGE
	PARAM_SERVER_QUOTED_IDENTIFIER
	PARAM_SERVER_BULK_DIR
	PARAM_SERVER_DUMP_DIR
	PARAM_SERVER_READ_TIMEOUT
	PARAM_SERVER_LOCK_TICKER_INTERVAL
	PARAM_SERVER_LOCK_TIMEOUT_TICKS_COUNT
	PARAM_SERVER_LOGGING_MAX_SIZE
	PARAM_SERVER_LOGGING_MAX_COUNT
	PARAM_SERVER_LOGGING_LOCALTIME
	PARAM_SERVER_WCACHE_MEMORY_MAX
	PARAM_SERVER_WCACHE_MODIF_MAX
	PARAM_SERVER_BATCH_TEXT_MAX_SIZE
	PARAM_SERVER_BATCH_INSERTS_MAX_COUNT

	SPEC_SYSPARAMETERS_COLLECION_ARRAY_SIZE // size of array of Sysparameter
)

List of server parameters.

WARNING: IF YOU CHANGE THE NUMBERING, YOU MUST ALSO CHANGE THEM IN install_master_db.go.

func (Server_parameter_t) String

func (sp Server_parameter_t) String() string

type Show_database_item

type Show_database_item struct {
	Database_name string
	Dbid          int64
	System_flag   Db_sysflag_t
	Output_text   string
}

type Show_list_of_databases

type Show_list_of_databases struct {
	// contains filtered or unexported fields
}

Show_list_of_databases is used to sort the list of databases by alphabetical order.

func New_Show_list_of_databases

func New_Show_list_of_databases(lst []Show_database_item, coll *collate.Collator) Show_list_of_databases

func (Show_list_of_databases) Len

func (list Show_list_of_databases) Len() int

func (Show_list_of_databases) Less

func (list Show_list_of_databases) Less(i, j int) bool

func (Show_list_of_databases) Swap

func (list Show_list_of_databases) Swap(i, j int)

type Show_list_of_indexdefs

type Show_list_of_indexdefs struct {
	// contains filtered or unexported fields
}

Show_list_of_indexdefs is used to sort the list of indexdefs by alphabetical order.

func New_Show_list_of_indexdefs

func New_Show_list_of_indexdefs(lst []*rsql.Tabledef, coll *collate.Collator) Show_list_of_indexdefs

func (Show_list_of_indexdefs) Len

func (list Show_list_of_indexdefs) Len() int

func (Show_list_of_indexdefs) Less

func (list Show_list_of_indexdefs) Less(i, j int) bool

func (Show_list_of_indexdefs) Swap

func (list Show_list_of_indexdefs) Swap(i, j int)

type Show_list_of_logins

type Show_list_of_logins struct {
	// contains filtered or unexported fields
}

Show_list_of_logins is used to sort the list of logins by alphabetical order.

func New_Show_list_of_logins

func New_Show_list_of_logins(lst []Show_login_item, coll *collate.Collator) Show_list_of_logins

func (Show_list_of_logins) Len

func (list Show_list_of_logins) Len() int

func (Show_list_of_logins) Less

func (list Show_list_of_logins) Less(i, j int) bool

func (Show_list_of_logins) Swap

func (list Show_list_of_logins) Swap(i, j int)

type Show_list_of_permissions

type Show_list_of_permissions struct {
	// contains filtered or unexported fields
}

Show_list_of_permissions is used to sort the list of permissions by alphabetical order.

func New_Show_list_of_permissions

func New_Show_list_of_permissions(lst []Show_permissions, coll *collate.Collator, sort_by Show_perm_sort_by_t) Show_list_of_permissions

func (Show_list_of_permissions) Len

func (list Show_list_of_permissions) Len() int

func (Show_list_of_permissions) Less

func (list Show_list_of_permissions) Less(i, j int) bool

func (Show_list_of_permissions) Swap

func (list Show_list_of_permissions) Swap(i, j int)

type Show_list_of_principals

type Show_list_of_principals struct {
	// contains filtered or unexported fields
}

Show_list_of_principals is used to sort the list of principals by alphabetical order.

func New_Show_list_of_principals

func New_Show_list_of_principals(lst []Show_principal_item, coll *collate.Collator) Show_list_of_principals

func (Show_list_of_principals) Len

func (list Show_list_of_principals) Len() int

func (Show_list_of_principals) Less

func (list Show_list_of_principals) Less(i, j int) bool

func (Show_list_of_principals) Swap

func (list Show_list_of_principals) Swap(i, j int)

type Show_list_of_strings

type Show_list_of_strings struct {
	// contains filtered or unexported fields
}

Show_list_of_strings is used to sort a list of strings by alphabetical order.

func New_Show_list_of_strings

func New_Show_list_of_strings(lst []string, coll *collate.Collator) Show_list_of_strings

func (Show_list_of_strings) Len

func (list Show_list_of_strings) Len() int

func (Show_list_of_strings) Less

func (list Show_list_of_strings) Less(i, j int) bool

func (Show_list_of_strings) Swap

func (list Show_list_of_strings) Swap(i, j int)

type Show_list_of_sysparameters

type Show_list_of_sysparameters struct {
	// contains filtered or unexported fields
}

Show_list_of_sysparameters is used to sort the list of parameters by alphabetical order.

func (Show_list_of_sysparameters) Len

func (list Show_list_of_sysparameters) Len() int

func (Show_list_of_sysparameters) Less

func (list Show_list_of_sysparameters) Less(i, j int) bool

func (Show_list_of_sysparameters) Swap

func (list Show_list_of_sysparameters) Swap(i, j int)

type Show_list_of_tables

type Show_list_of_tables struct {
	// contains filtered or unexported fields
}

Show_list_of_tables is used to sort the list of tables by alphabetical order.

func New_Show_list_of_tables

func New_Show_list_of_tables(lst []Show_table_item, coll *collate.Collator) Show_list_of_tables

func (Show_list_of_tables) Len

func (list Show_list_of_tables) Len() int

func (Show_list_of_tables) Less

func (list Show_list_of_tables) Less(i, j int) bool

func (Show_list_of_tables) Swap

func (list Show_list_of_tables) Swap(i, j int)

type Show_login_item

type Show_login_item struct {
	Login_name        string
	Login_id          int64
	Login_system_flag Lg_sysflag_t
	Output_text       string
}

type Show_perm_sort_by_t

type Show_perm_sort_by_t uint8

type Show_permissions

type Show_permissions struct {
	Objid int64
	Palid int64

	Database_name string
	Schema_name   string
	Object_name   string

	Pal_RU   string // principal is role "R" or user "U"
	Pal_name string

	Pm_grant rsql.Permission_t
	Pm_deny  rsql.Permission_t
}

type Show_principal_item

type Show_principal_item struct {
	Pal_database_name string
	Pal_name          string
	Pal_palid         int64
	Pal_type          Pal_type_t
	Pal_login_id      int64
	Pal_system_flag   Pal_sysflag_t
	Output_text       string
}

type Show_sysparameter_item

type Show_sysparameter_item struct {
	Param_name  string
	Param_id    Server_parameter_t
	Output_text string
}

type Show_table_item

type Show_table_item struct {
	Database_name string
	Schema_name   string
	Table_name    string
	Gtblid        int64
	Output_text   string
}

type Stmt_kind_t

type Stmt_kind_t uint32
const (
	DICT_STMT_INVALID Stmt_kind_t = iota // not used
	DICT_STMT_BEGIN_EXCLUSIVE
	DICT_STMT_COMMIT
	DICT_STMT_ROLLBACK
	DICT_STMT_SYSPARAMETERS_UPDATE_VALUE_STRING
	DICT_STMT_SYSPARAMETERS_UPDATE_VALUE_INT
	DICT_STMT_SYSLOGINS_INSERT
	DICT_STMT_SYSLOGINS_UPDATE
	DICT_STMT_SYSLOGINS_DELETE
	DICT_STMT_SYSDATABASES_INSERT
	DICT_STMT_SYSDATABASES_UPDATE_NAME
	DICT_STMT_SYSDATABASES_UPDATE_STATUS
	DICT_STMT_SYSDATABASES_UPDATE_MODE
	DICT_STMT_SYSDATABASES_UPDATE_ACCESS
	DICT_STMT_SYSDATABASES_DELETE
	DICT_STMT_SYSSCHEMAS_INSERT
	DICT_STMT_SYSSCHEMAS_IN_DBID_DELETE
	DICT_STMT_SYSPRINCIPALS_INSERT
	DICT_STMT_SYSPRINCIPALS_UPDATE
	DICT_STMT_SYSPRINCIPALS_DELETE
	DICT_STMT_SYSPRINCIPALS_DELETE_ALL_DBID
	DICT_STMT_SYSROLEMEMBERS_INSERT
	DICT_STMT_SYSROLEMEMBERS_DELETE
	DICT_STMT_SYSROLEMEMBERS_DELETE_PALID
	DICT_STMT_SYSROLEMEMBERS_DELETE_ALL_DBID
	DICT_STMT_SYSCOLDEFS_INSERT
	DICT_STMT_SYSCOLDEFS_UPDATE_COLNAME
	DICT_STMT_SYSCOLDEFS_UPDATE_NULLABILITY
	DICT_STMT_SYSCOLDEFS_DELETE_GTBLID
	DICT_STMT_SYSCOLDEFS_DELETE_ALL_DBID
	DICT_STMT_SYSTABLEDEFS_INSERT
	DICT_STMT_SYSTABLEDEFS_UPDATE_STATUS
	DICT_STMT_SYSTABLEDEFS_UPDATE_NAME
	DICT_STMT_SYSTABLEDEFS_DELETE
	DICT_STMT_SYSTABLEDEFS_DELETE_GTBLID
	DICT_STMT_SYSTABLEDEFS_DELETE_ALL_DBID
	DICT_STMT_SYSGTABLEDEFS_INSERT
	DICT_STMT_SYSGTABLEDEFS_UPDATE_NAME
	DICT_STMT_SYSGTABLEDEFS_DELETE
	DICT_STMT_SYSGTABLEDEFS_DELETE_ALL_DBID
	DICT_STMT_SYSPERMISSIONS_INSERT
	DICT_STMT_SYSPERMISSIONS_UPDATE
	DICT_STMT_SYSPERMISSIONS_DELETE
	DICT_STMT_SYSPERMISSIONS_DELETE_PRINCIPAL
	DICT_STMT_SYSPERMISSIONS_DELETE_GTBLID
	DICT_STMT_SYSPERMISSIONS_DELETE_ALL_DBID

	DICT_STMT_ARRAY_SIZE // used to create stmt array of proper size
)

type Sysdatabase

type Sysdatabase struct {
	Db_dbid        int64
	Db_name        string
	Db_create_date time.Time
	Db_status      Db_status_t  // being_created, recovering, open, closed, corrupted, restoring
	Db_mode        Db_mode_t    // read_write, read_only
	Db_access      Db_access_t  // restricted_user, multi_user
	Db_system_flag Db_sysflag_t // DB_SYSFLAG_TRASHDB for 'trashdb', else 0
}

func (*Sysdatabase) Database_info

func (database *Sysdatabase) Database_info() string

Database_info returns information about the status, mode and access of the database, for display.

type Sysdatabases_collection

type Sysdatabases_collection struct {
	// contains filtered or unexported fields
}

collection of databases

type Syslogin

type Syslogin struct {
	Lg_login_id         int64  // unique
	Lg_name             string // unique
	Lg_password_hash    string
	Lg_default_database string
	Lg_default_language string
	Lg_disabled_flag    bool
	Lg_create_date      time.Time
	Lg_system_flag      Lg_sysflag_t // LG_SYSFLAG_SA for 'sa', else 0
}

type Syslogins_collection

type Syslogins_collection struct {
	// contains filtered or unexported fields
}

type Sysparameter

type Sysparameter struct {
	Param_id                  Server_parameter_t
	Param_name                string
	Param_value_int           int64  // current parameter value
	Param_value_string        string // current parameter value
	Param_value_int_stored    int64  // parameter value as stored in master.db file
	Param_value_string_stored string // parameter value as stored in master.db file
}

func (*Sysparameter) String

func (param *Sysparameter) String() string

type Sysparameters_collection

type Sysparameters_collection struct {
	// contains filtered or unexported fields
}

type Syspermission_t

type Syspermission_t struct {
	Pm_grant rsql.Permission_t
	Pm_deny  rsql.Permission_t
}

type Syspermissions_collection

type Syspermissions_collection struct {
	// contains filtered or unexported fields
}

type Sysprincipal

type Sysprincipal struct {
	Pal_palid               int64         // palid
	Pal_dbid                int64         // principal always belongs to a database
	Pal_name                string        // unique pal_name in a database
	Pal_type                Pal_type_t    // U user, R role
	Pal_create_date         time.Time     // creation time
	Pal_default_schema_name string        // for U, always "dbo". For R, not used.
	Pal_login_id            int64         // must be unique for each database. For U, references a syslogin entry. For R, not used.
	Pal_system_flag         Pal_sysflag_t // PAL_SYSFLAG_USER_DBO for 'dbo', PAL_SYSFLAG_ROLE_PUBLIC for 'public', else 0

	Pal_member_of Role_list // list of roles the principal is a member of. The role 'public' is never put in this list ('public' membership is implicit for all users. It cannot be added, nor removed.).
}

Sysprincipal is a role or a user.

func (*Sysprincipal) Is_member_of

func (principal *Sysprincipal) Is_member_of(role *Sysprincipal) bool

func (*Sysprincipal) Membership_add

func (principal *Sysprincipal) Membership_add(role *Sysprincipal)

func (*Sysprincipal) Membership_remove

func (principal *Sysprincipal) Membership_remove(role *Sysprincipal)

func (*Sysprincipal) Membership_subtree_contains

func (principal *Sysprincipal) Membership_subtree_contains(role *Sysprincipal) bool

Membership_subtree_contains checks if role exists in the membership subtree of principal.

Returns true if principal is role, or is member, submember, subsubmember etc of role.

type Sysprincipal_namekey_t

type Sysprincipal_namekey_t struct {
	Pal_dbid int64
	Pal_name string
}

type Sysprincipals_collection

type Sysprincipals_collection struct {
	// contains filtered or unexported fields
}

type Sysschema

type Sysschema struct {
	Sch_dbid  int64
	Sch_schid int64
	Sch_name  string
}

type Sysschema_namekey_t

type Sysschema_namekey_t struct {
	Sch_dbid int64
	Sch_name string
}

type Sysschema_schidkey_t

type Sysschema_schidkey_t struct {
	Sch_dbid  int64
	Sch_schid int64
}

type Sysschemas_collection

type Sysschemas_collection struct {
	// contains filtered or unexported fields
}

type Systable_namekey_t

type Systable_namekey_t struct {
	Gdbid       int64
	Gschid      int64
	Gtable_name string
}

type Systables_collection

type Systables_collection struct {
	// contains filtered or unexported fields
}

type Table_params

type Table_params struct {
	Table_qname rsql.Object_qname_t

	Change_table_name          string
	Change_table_name_original string

	Column_name                 string
	Change_column_name          string
	Change_column_name_original string
	Change_column_nullability   Alter_column_nullability_t
}

used to pass arguments of ALTER TABLE to vm.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL