gda.sql_builder
Module for SqlBuilder class
Types 4
Methods
SqlBuilder self()Returns `this`, for use in `with` statements.SqlBuilderGidBuilder builder()Get builder for [gda.sql_builder.SqlBuilder] Returns: New builder objectgda.types.SqlBuilderId addCase(gda.types.SqlBuilderId testExpr, gda.types.SqlBuilderId elseExpr, gda.types.SqlBuilderId[] whenArray, gda.types.SqlBuilderId[] thenArray)Creates a new CASE ... WHEN ... THEN ... ELSE ... END expression. The WHEN expression and the THEN expression IDs are taken from the when_array and then_array at the same index, for each index infe...gda.types.SqlBuilderId addCond(gda.types.SqlOperatorType op, gda.types.SqlBuilderId op1, gda.types.SqlBuilderId op2, gda.types.SqlBuilderId op3)Builds a new expression which represents a condition (or operation).gda.types.SqlBuilderId addCondV(gda.types.SqlOperatorType op, gda.types.SqlBuilderId[] opIds)Builds a new expression which represents a condition (or operation).gda.types.SqlBuilderId addExprValue(gda.data_handler.DataHandler dh = null, gobject.value.Value value = null)Defines an expression in builder which may be reused to build other parts of a statement.gda.types.SqlBuilderId addFieldId(string fieldName, string tableName = null)Defines an expression representing a field in builder, which may be reused to build other parts of a statement, for instance as a parameter to [gda.sql_builder.SqlBuilder.addCond] or [gda.sql_build...void addFieldValueAsGvalue(string fieldName, gobject.value.Value value = null)Valid only for: INSERT, UPDATE statements.void addFieldValueId(gda.types.SqlBuilderId fieldId, gda.types.SqlBuilderId valueId)Valid only for: INSERT, UPDATE, SELECT statements <itemizedlist> <listitem><para>For UPDATE: specifies that the field represented by field_id will be set to the value identified by value_id.</para>...gda.types.SqlBuilderId addFunction(string funcName, gda.types.SqlBuilderId[] args)Builds a new expression which represents a function applied to some argumentsgda.types.SqlBuilderId addId(string str)Defines an expression representing an identifier in builder, which may be reused to build other parts of a statement, for instance as a parameter to [gda.sql_builder.SqlBuilder.addCond] or [gda.sql...gda.types.SqlBuilderId addParam(string paramName, gobject.types.GType type, bool nullok)Defines a parameter in builder which may be reused to build other parts of a statement.void compoundAddSubSelectFromBuilder(gda.sql_builder.SqlBuilder subselect)Add a sub select to a COMPOUND statementvoid compoundSetType(gda.types.SqlStatementCompoundType compoundType)Changes the type of compound which builder is making, for a COMPOUND statementgda.statement.Statement getStatement()Creates a new #GdaStatement statement from builder's contents. Returns: a new #GdaStatement object, or null if an error occurred Throws: [SqlBuilderException]gda.types.SqlBuilderId importExpressionFromBuilder(gda.sql_builder.SqlBuilder query, gda.types.SqlBuilderId exprId)Imports the an expression located in query into builder.void joinAddField(gda.types.SqlBuilderId joinId, string fieldName)Alter a join in a SELECT statement to make its condition use equal field values in the fields named field_name in both tables, via the USING keyword.gda.types.SqlBuilderId selectAddField(string fieldName, string tableName = null, string alias_ = null)Valid only for: SELECT statements.gda.types.SqlBuilderId selectAddTarget(string tableName, string alias_ = null)Adds a new target to a SELECT statementgda.types.SqlBuilderId selectAddTargetId(gda.types.SqlBuilderId tableId, string alias_ = null)Adds a new target to a SELECT statement. If there already exists a target representing the same table and the same alias (or with the same absence of alias) then the same target ID is returned inst...void selectGroupBy(gda.types.SqlBuilderId exprId)Valid only for: SELECT statementsvoid selectOrderBy(gda.types.SqlBuilderId exprId, bool asc, string collationName = null)Adds a new ORDER BY expression to a SELECT statement.void selectSetDistinct(bool distinct, gda.types.SqlBuilderId exprId)Defines (if distinct is true) or removes (if distinct is false) a DISTINCT clause for a SELECT statement.void selectSetHaving(gda.types.SqlBuilderId condId)Valid only for: SELECT statementsvoid selectSetLimit(gda.types.SqlBuilderId limitCountExprId, gda.types.SqlBuilderId limitOffsetExprId)If limit_count_expr_id is not `0`, defines the maximum number of rows in the #GdaDataModel resulting from the execution of the built statement. In this case, the offset from which the rows must be ...void setTable(string tableName)Valid only for: INSERT, UPDATE, DELETE statementsvoid setWhere(gda.types.SqlBuilderId condId)Valid only for: UPDATE, DELETE, SELECT statementsConstructors
this(gda.types.SqlStatementType stmtType)Create a new #GdaSqlBuilder object to build #GdaStatement or #GdaSqlStatement objects of type stmt_typeFluent builder implementation template for gda.sql_builder.SqlBuilder
Fluent builder for gda.sql_builder.SqlBuilder
Methods
SqlBuilder build()Create object from builder. Returns: New objectclassSqlBuilderException : ErrorWrap