func (env *Environment) numberFromInt(value int64, dst unsafe.Pointer) error { return env.CheckStatus( C.OCINumberFromInt(env.errorHandle, unsafe.Pointer(&value), C.uword(unsafe.Sizeof(value)), C.OCI_NUMBER_SIGNED, (*C.OCINumber)(dst)), "numberFromInt") }
func (bnd *bndInt32) bind(value int32, position int, stmt *Stmt) error { bnd.stmt = stmt r := C.OCINumberFromInt( bnd.stmt.ses.srv.env.ocierr, //OCIError *err, unsafe.Pointer(&value), //const void *inum, 4, //uword inum_length, C.OCI_NUMBER_SIGNED, //uword inum_s_flag, &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, nil, //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 (env *Environment) numberFromInt(value int64, dst unsafe.Pointer) error { if CTrace { ctrace("numberFromInt(%d)", value) } return env.CheckStatus( C.OCINumberFromInt(env.errorHandle, unsafe.Pointer(&value), 8, C.OCI_NUMBER_SIGNED, (*C.OCINumber)(dst)), "numberFromInt") }
func (bnd *bndInt16Slice) bind(values []int16, 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.OCINumberFromInt( bnd.stmt.ses.srv.env.ocierr, //OCIError *err, unsafe.Pointer(&values[n]), //const void *inum, 2, //uword inum_length, C.OCI_NUMBER_SIGNED, //uword inum_s_flag, &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 (bnd *bndInt32Ptr) bind(value *int32, position int, stmt *Stmt) error { bnd.stmt = stmt bnd.value = value if value == nil { bnd.isNull = C.sb2(-1) } else { r := C.OCINumberFromInt( bnd.stmt.ses.srv.env.ocierr, //OCIError *err, unsafe.Pointer(value), //const void *inum, 4, //uword inum_length, C.OCI_NUMBER_SIGNED, //uword inum_s_flag, &bnd.ociNumber) //OCINumber *number if r == C.OCI_ERROR { return bnd.stmt.ses.srv.env.ociError() } bnd.stmt.logF(_drv.cfg.Log.Stmt.Bind, "Int32Ptr.bind(%d) value=%d => number=%#v", position, *value, bnd.ociNumber) } 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 }