dvdbdata

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SqlOracleLike      = 1
	SqlPostgresLike    = 2
	SqlTraceError      = 128
	CommonMaxBatch     = 1000
	ComplexIdSeparator = "_._"
)
View Source
const (
	TypeDate   = "Date"
	TypeInt    = "int"
	TypeInt64  = "int64"
	TypeString = "string"
	TypeBool   = "bool"
)
View Source
const (
	IdsPlaceholderStart  = "${"
	IdsPlaceholderFinish = "IDS}"
)
View Source
const (
	SqlKindUpdate    = 0
	SqlKindSingle    = 1
	SqlKindRow       = 2
	SqlKindTable     = 3
	SqlKindList      = 4
	SqlKindRowText   = 5
	SqlKindTableText = 6
)

Variables

View Source
var MaxConnections = 20
View Source
var NullStringAsBytes = []byte("NULL")

Functions

func AddItemsToPool

func AddItemsToPool(db *DBConnection, sql string, cols int, pool [][]interface{}) ([][]interface{}, error)

func CheckReplaceNonUtf8Characters added in v1.0.2

func CheckReplaceNonUtf8Characters(b []byte, onlyCheck bool) ([]byte, string)

func CheckReplaceNonUtf8CharactersInStringArray added in v1.0.2

func CheckReplaceNonUtf8CharactersInStringArray(m []string, onlyCheck bool) string

func CheckReplaceNonUtf8CharactersInStringArrayOfArray added in v1.0.2

func CheckReplaceNonUtf8CharactersInStringArrayOfArray(m [][]string, onlyCheck bool) string

func CollectAllChildInfo added in v1.0.2

func CollectAllChildInfo(tableId string, data [][]interface{}, r map[string]map[string]int) error

func ConvertListToBooleanMap

func ConvertListToBooleanMap(ids []string) map[string]bool

func CreateTableByDefinition

func CreateTableByDefinition(db *DBConnection, def string) error

func ExecuteSqlData

func ExecuteSqlData(db *DBConnection, data []byte) error

func ExecuteSqlFromFile

func ExecuteSqlFromFile(db *DBConnection, fileName string) error

func ExecuteSqlFromFolder

func ExecuteSqlFromFolder(db *DBConnection, root string) error

func FindIdsPlaceholder added in v1.0.2

func FindIdsPlaceholder(s string) (outerStart int, outerFinish int, innerStart int, innerFinish int)

func FindIntInIntArray

func FindIntInIntArray(val int, data []int) int

func GetColumnListFromMetaByIndices

func GetColumnListFromMetaByIndices(meta *TableMetaData, indices []int) string

func GetComplexIdForItem

func GetComplexIdForItem(row []string, ids []int) string

func GetConnectionKindMask added in v1.0.2

func GetConnectionKindMask(kind string) int

func GetConnectionType

func GetConnectionType(connName string) int

func GetDBConnectionDirect

func GetDBConnectionDirect(props map[string]string, connName string) (*sql.DB, string, error)

func GetDateNowFunction

func GetDateNowFunction(sqlType int) string

func GetDefaultDbConnection

func GetDefaultDbConnection() string

func GetExistingItems

func GetExistingItems(meta *TableMetaData, ids [][]string, db *DBConnection) ([]string, error)

func GetHexValue added in v1.0.2

func GetHexValue(b byte) string

func GetIdsFromItems

func GetIdsFromItems(meta *TableMetaData, items [][]string) [][]string

func GetMetaInfo

func GetMetaInfo(meta *TableMetaData) string

func GetPropertyGlobalDefinition

func GetPropertyGlobalDefinition(props map[string]string) string

func GetSingleValuesFromString

func GetSingleValuesFromString(data [][]string, column int) []string

func GetSqlQueryForGettingRowById added in v1.0.2

func GetSqlQueryForGettingRowById(metaInfo *TableMetaData, columns string) (start string, finish string, cols int, err error)

func GetSqlTableByIds added in v1.0.2

func GetSqlTableByIds(db *DBConnection, tableId string, ids []string) ([][]interface{}, error)

func GetSqlTableByQuery added in v1.0.2

func GetSqlTableByQuery(db *DBConnection, ids []string, query string) ([][]interface{}, error)

func GetTableNameColumnsFromDefinition

func GetTableNameColumnsFromDefinition(def string) (table string, columns []string, colDef []string, err error)

func GetTimestampLessDay

func GetTimestampLessDay(sqlType int) string

func InitByGlobalProperties added in v1.0.2

func InitByGlobalProperties()

func OrderObjectsByHierarchy

func OrderObjectsByHierarchy(objects [][]string, leftObjects map[string]bool,
	idCol int, depCols []int) ([][][]string, error)

func PlaceStringToSqlQuery

func PlaceStringToSqlQuery(v string, tp string, b []byte, options int) ([]byte, error)

func PreExecute

func PreExecute(properties map[string]string) error

func PreExecuteCsvFile

func PreExecuteCsvFile(conn *DBConnection, name string, options int) error

func PreExecuteForNewerVersions

func PreExecuteForNewerVersions(props map[string]string, db *DBConnection, folder string) error

func ReadGlobalDBProperty

func ReadGlobalDBProperty(props map[string]string, db *DBConnection, name string, defValue string) (string, error)

func ReadItemsInBatches

func ReadItemsInBatches(db *DBConnection, start string, finish string, ids []string, cols int) ([][]interface{}, error)

func ReadItemsInBulk added in v1.0.2

func ReadItemsInBulk(db *DBConnection, query string, cols int) ([][]interface{}, error)

func SavePortionOfItems

func SavePortionOfItems(items [][]string, sqlTable string, conn *DBConnection, left map[string]bool,
	columnIds []int, options int, types []string) error

func SplitSqlSequences

func SplitSqlSequences(data []byte) []string

func SqlInit

func SqlInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)

func SqlRun

func SqlRun(data []interface{}) bool

func SqlSingleValueByConnection

func SqlSingleValueByConnection(db *DBConnection, query string) (string, bool, error)

func SqlSingleValueByConnectionName

func SqlSingleValueByConnectionName(connName string, query string) (string, bool, error)

func SqlUpdateByConnection

func SqlUpdateByConnection(db *DBConnection, query string) error

func SqlUpdateByConnectionName

func SqlUpdateByConnectionName(connName string, query string) error

func WriteGlobalDBProperty

func WriteGlobalDBProperty(props map[string]string, db *DBConnection, name string, value string) error

Types

type DBConnection added in v1.0.2

type DBConnection struct {
	Db       *sql.DB
	KindMask int
	Kind     string
	Name     string
}

func GetDBConnection

func GetDBConnection(connName string) (r *DBConnection, err error)

func (*DBConnection) Close added in v1.0.2

func (db *DBConnection) Close(forced bool) (err error)

func (*DBConnection) Exec added in v1.0.2

func (db *DBConnection) Exec(query string, args ...interface{}) (sql.Result, error)

func (*DBConnection) Query added in v1.0.2

func (db *DBConnection) Query(query string, args ...interface{}) (*sql.Rows, error)

type SqlAction

type SqlAction struct {
	Db             string   `json:"db"`
	Query          string   `json:"query"`
	QueryOracle    string   `json:"queryOracle"`
	QueryPostgres  string   `json:"queryPostgres"`
	Result         string   `json:"result"`
	Kind           string   `json:"kind"`
	Columns        []string `json:"columns"`
	EmptyErrorCode int      `json:"emptyErrCode"`
	Error          string   `json:"error"`
	KindNo         int
}

type TableMetaData

type TableMetaData struct {
	Id           string   `json:"id"`
	Name         string   `json:"name"`
	Dependencies []int    `json:"dependencies"`
	IdColumns    []int    `json:"idColumns"`
	MajorColumn  int      `json:"majorColumn"`
	Types        []string `json:"types"`
	Columns      []string `json:"columns"`
	References   []string `json:"references"`
	QuoteColumns bool     `json:"quoteColumns"`
}

func ReadTableMetaData

func ReadTableMetaData(table string, props map[string]string) (*TableMetaData, error)

func ReadTableMetaDataFromGlobal added in v1.0.2

func ReadTableMetaDataFromGlobal(tableId string) (*TableMetaData, error)

Jump to

Keyboard shortcuts

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