Пример #1
0
/* dereference a pointer to a string */
value caml_oci_get_defined_string(value defs) {
  CAMLparam1(defs);
  oci_define_t d = Oci_defhandle_val(defs);
  
#ifdef DEBUG
  char dbuf[256]; snprintf(dbuf, 255, "caml_oci_get_defined_string: string=%s indicator=%d", (char*)d.ptr, d.ind); debug(dbuf);
#endif

  CAMLreturn(caml_copy_string(d.ptr));
}
Пример #2
0
value caml_oci_get_double(value handles, value defs) {
  CAMLparam2(handles, defs);
  oci_define_t d = Oci_defhandle_val(defs);
  oci_handles_t h = Oci_handles_val(handles);

  double r;

  sword x = OCINumberToReal(h.err, d.ptr, sizeof(double), &r);
  CHECK_OCI(x, h);

  CAMLreturn(caml_copy_double(r));
}
Пример #3
0
value caml_oci_get_int(value handles, value defs) {
  CAMLparam2(handles, defs);
  oci_define_t d = Oci_defhandle_val(defs);
  oci_handles_t h = Oci_handles_val(handles);

  int r;

  sword x = OCINumberToInt(h.err, d.ptr, sizeof(int), OCI_NUMBER_SIGNED, &r);
  CHECK_OCI(x, h);

#ifdef DEBUG
  char dbuf[256]; snprintf(dbuf, 255, "caml_oci_get_int: returning %d", r); debug(dbuf);
#endif

  CAMLreturn(Val_int(r));
}
Пример #4
0
/* dereference and return a datetime as epoch */
value caml_oci_get_date_as_double(value defs) {
  CAMLparam1(defs);
  oci_define_t d = Oci_defhandle_val(defs);

  CAMLreturn(caml_copy_double(ocidate_to_epoch(d.ptr)));
}
Пример #5
0
/* dereference a pointer to a string */
value caml_oci_get_defined_string(value defs) {
  CAMLparam1(defs);
  oci_define_t d = Oci_defhandle_val(defs);

    CAMLreturn(caml_copy_string(d.ptr));
}