Exemple #1
0
func (s *stringer) compileAndReplacePlaceholders(stmt *exql.Statement) (query string) {
	buf := stmt.Compile(s.t)

	j := 1
	for i := range buf {
		if buf[i] == '?' {
			query = query + "$" + strconv.Itoa(j)
			j++
		} else {
			query = query + string(buf[i])
		}
	}

	return query
}
Exemple #2
0
// CompileStatement allows sqladapter to compile the given statement into the
// format MySQL expects.
func (d *database) CompileStatement(stmt *exql.Statement, args []interface{}) (string, []interface{}) {
	return sqlbuilder.Preprocess(stmt.Compile(template), args)
}
Exemple #3
0
func (p *exprProxy) StatementQueryRow(stmt *exql.Statement, args ...interface{}) (*sql.Row, error) {
	s := stmt.Compile(p.t)
	return p.db.QueryRow(s, args...), nil
}
Exemple #4
0
func (p *exprProxy) StatementExec(stmt *exql.Statement, args ...interface{}) (sql.Result, error) {
	s := stmt.Compile(p.t)
	return p.db.Exec(s, args...)
}
Exemple #5
0
// CompileStatement allows sqladapter to compile the given statement into the
// format SQLite expects.
func (d *database) CompileStatement(stmt *exql.Statement, args []interface{}) (string, []interface{}) {
	query, args := sqlbuilder.Preprocess(stmt.Compile(template), args)
	return sqladapter.ReplaceWithDollarSign(query), args
}