Exemplo n.º 1
0
// Ping makes a round trip call to the server to confirm that the connection and
// server are active.
func (conn *Connection) Ping() error {
	if !conn.IsConnected() {
		return nil
	}
	return conn.environment.CheckStatus(C.OCIPing(conn.handle, conn.environment.errorHandle,
		C.OCI_DEFAULT), "Ping")

}
Exemplo n.º 2
0
func (c *OCI8Conn) ping(ctx context.Context) error {
	rv := C.OCIPing(
		(*C.OCISvcCtx)(c.svc),
		(*C.OCIError)(c.err),
		C.OCI_DEFAULT)
	if rv != C.OCI_SUCCESS {
		return errors.New("ping failed")
	}
	return nil
}
Exemplo n.º 3
0
Arquivo: ses.go Projeto: ricsmania/ora
// Ping returns nil when an Oracle server is contacted; otherwise, an error.
func (ses *Ses) Ping() (err error) {
	ses.mu.Lock()
	defer ses.mu.Unlock()
	ses.log(_drv.cfg.Log.Ses.Ping)
	err = ses.checkClosed()
	if err != nil {
		return errE(err)
	}
	r := C.OCIPing(
		ses.ocisvcctx,      //OCISvcCtx     *svchp,
		ses.srv.env.ocierr, //OCIError      *errhp,
		C.OCI_DEFAULT)      //ub4           mode );
	if r == C.OCI_ERROR {
		return errE(ses.srv.env.ociError())
	}
	return nil
}
Exemplo n.º 4
0
// Makes a lightweight call to the server. A successful result indicates the server is active.  A block indicates the connection may be in use by
// another thread. A failure indicates a communication error.
func (conn *connection) ping() error {
	if C.OCIPing((*C.OCIServer)(conn.svr), (*C.OCIError)(conn.err), C.OCI_DEFAULT) != C.OCI_SUCCESS {
		return ociGetError(conn.err)
	}
	return nil
}