func (bnd *bndFloat64Ptr) bind(value *float64, position int, stmt *Stmt) error { bnd.stmt = stmt bnd.value = value if value == nil { bnd.isNull = C.sb2(-1) } else { r := C.OCINumberFromReal( bnd.stmt.ses.srv.env.ocierr, //OCIError *err, unsafe.Pointer(value), //const void *rnum, 8, //uword rnum_length, &bnd.ociNumber) //OCINumber *number ); if r == C.OCI_ERROR { return bnd.stmt.ses.srv.env.ociError() } } r := C.OCIBINDBYPOS( bnd.stmt.ocistmt, //OCIStmt *stmtp, (**C.OCIBind)(&bnd.ocibnd), //OCIBind **bindpp, bnd.stmt.ses.srv.env.ocierr, //OCIError *errhp, C.ub4(position), //ub4 position, unsafe.Pointer(&bnd.ociNumber), //void *valuep, C.LENGTH_TYPE(C.sizeof_OCINumber), //sb8 value_sz, C.SQLT_VNU, //ub2 dty, unsafe.Pointer(&bnd.isNull), //void *indp, nil, //ub2 *alenp, nil, //ub2 *rcodep, 0, //ub4 maxarr_len, nil, //ub4 *curelep, C.OCI_DEFAULT) //ub4 mode ); if r == C.OCI_ERROR { return bnd.stmt.ses.srv.env.ociError() } return nil }
func (bnd *bndFloat32Slice) bind(values []float32, nullInds []C.sb2, position int, stmt *Stmt) error { bnd.stmt = stmt if nullInds == nil { nullInds = make([]C.sb2, len(values)) } alenp := make([]C.ACTUAL_LENGTH_TYPE, len(values)) rcodep := make([]C.ub2, len(values)) bnd.ociNumbers = make([]C.OCINumber, len(values)) for n := range values { alenp[n] = C.ACTUAL_LENGTH_TYPE(C.sizeof_OCINumber) r := C.OCINumberFromReal( bnd.stmt.ses.srv.env.ocierr, //OCIError *err, unsafe.Pointer(&values[n]), //const void *rnum, 4, //uword rnum_length, &bnd.ociNumbers[n]) //OCINumber *number ); if r == C.OCI_ERROR { return bnd.stmt.ses.srv.env.ociError() } } r := C.OCIBINDBYPOS( bnd.stmt.ocistmt, //OCIStmt *stmtp, (**C.OCIBind)(&bnd.ocibnd), //OCIBind **bindpp, bnd.stmt.ses.srv.env.ocierr, //OCIError *errhp, C.ub4(position), //ub4 position, unsafe.Pointer(&bnd.ociNumbers[0]), //void *valuep, C.LENGTH_TYPE(C.sizeof_OCINumber), //sb8 value_sz, C.SQLT_VNU, //ub2 dty, unsafe.Pointer(&nullInds[0]), //void *indp, &alenp[0], //ub4 *alenp, &rcodep[0], //ub2 *rcodep, 0, //ub4 maxarr_len, nil, //ub4 *curelep, C.OCI_DEFAULT) //ub4 mode ); if r == C.OCI_ERROR { return bnd.stmt.ses.srv.env.ociError() } r = C.OCIBindArrayOfStruct( bnd.ocibnd, bnd.stmt.ses.srv.env.ocierr, C.ub4(C.sizeof_OCINumber), //ub4 pvskip, C.ub4(C.sizeof_sb2), //ub4 indskip, C.ub4(C.sizeof_ub4), //ub4 alskip, C.ub4(C.sizeof_ub2)) //ub4 rcskip if r == C.OCI_ERROR { return bnd.stmt.ses.srv.env.ociError() } return nil }
func (env *Environment) numberFromFloat(value float64, dst unsafe.Pointer) error { return env.CheckStatus( C.OCINumberFromReal(env.errorHandle, unsafe.Pointer(&value), C.uword(unsafe.Sizeof(value)), (*C.OCINumber)(dst)), "numberFromReal") }