github.com/instana/go-sensor@v1.62.2-0.20240520081010-4919868049e1/instrumentation_sql_conn.go (about)

     1  // (c) Copyright IBM Corp. 2023
     2  
     3  package instana
     4  
     5  import (
     6  	"database/sql/driver"
     7  )
     8  
     9  type wConn struct {
    10  	driver.Conn
    11  
    12  	connDetails DbConnDetails
    13  	sensor      TracerLogger
    14  }
    15  
    16  func (conn *wConn) Prepare(query string) (driver.Stmt, error) {
    17  	stmt, err := conn.Conn.Prepare(query)
    18  	if err != nil {
    19  		return stmt, err
    20  	}
    21  
    22  	if stmtAlreadyWrapped(stmt) {
    23  		return stmt, nil
    24  	}
    25  
    26  	w := wrapStmt(stmt, query, conn.connDetails, conn.sensor)
    27  
    28  	return w, nil
    29  }