Basic FunctionalityAssets ManagementDBOn this pageDB Description: A record that represents a database. Column Type: Field. Description: Type definition for a database column. The boolean type is only used for representing the database NULL value with the boolean false value. Signature: type Column = integer | number | string | boolean Row Type: Field. Description: Type definition for a database row. Signature: type Row = {Column} SQL Type: Field. Description: Type definition for an SQL query. Can be SQL string or a pair of SQL string and an array of parameters. Signature: type SQL = string | {string, {Row}} existDB Type: Function. Description: Checks whether an attached database exists. Signature: existDB: function(self: DB, dbName: string): boolean Parameters: ParameterTypeDescriptiondbNamestringThe name of the attached database to check. Returns: Return TypeDescriptionbooleanWhether the attached database exists or not. exist Type: Function. Description: Checks whether a table exists in the database. Signature: exist: function(self: DB, tableName: string, schema?: string): boolean Parameters: ParameterTypeDescriptiontableNamestringThe name of the table to check.schemastring[optional] The name of the database to check in. Returns: Return TypeDescriptionbooleanWhether the table exists or not. transaction Type: Function. Description: Executes a list of SQL statements as a single transaction. Signature: transaction: function(self: DB, sqls: {SQL}): boolean Parameters: ParameterTypeDescriptionsqls{SQL}A list of SQL statements to execute. Returns: Return TypeDescriptionbooleanWhether the transaction was successful or not. transactionAsync Type: Function. Description: Executes a list of SQL statements as a single transaction asynchronously. Signature: transactionAsync: function(self: DB, sqls: {SQL}): boolean Parameters: ParameterTypeDescriptionsqls{SQL}A list of SQL statements to execute. Returns: Return TypeDescriptionbooleanWhether the transaction was successful or not. query Type: Function. Description: Executes an SQL query and returns the results as a list of rows. Signature: query: function( self: DB, sql: string, args: Row, withColumn?: boolean --[[false]] ): {Row} Parameters: ParameterTypeDescriptionsqlstringThe SQL statement to executeargsRow[optional] A list of values to substitute into the SQL statement.withColumnboolean[optional] Whether to include column names in the result (default false). Returns: Return TypeDescription{Row}A list of rows returned by the query. query Type: Function. Description: Executes an SQL query and returns the results as a list of rows. Signature: query: function( self: DB, sql: string, withColumn?: boolean --[[false]] ): {Row} | nil Parameters: ParameterTypeDescriptionsqlstringThe SQL statement to executewithColumnboolean[optional] Whether to include column names in the result (default false). Returns: Return TypeDescription{Row} | nilA list of rows returned by the query, or nil if the query failed. insert Type: Function. Description: Inserts a row of data into a table within a transaction. Signature: insert: function(self: DB, tableName: string, values: {Row}): boolean Parameters: ParameterTypeDescriptiontableNamestringThe name of the table to insert into.valuesRowThe values to insert into the table. Returns: Return TypeDescriptionbooleanWhether the insertion was successful or not. exec Type: Function. Description: Executes an SQL statement and returns the number of rows affected. Signature: exec: function(self: DB, sql: string): integer Parameters: ParameterTypeDescriptionsqlstringThe SQL statement to execute. Returns: Return TypeDescriptionintegerThe number of rows affected by the statement, returns -1 if the statement failed. exec