Skip to content

Instantly share code, notes, and snippets.

@andreas
Created December 20, 2016 10:29
Show Gist options
  • Select an option

  • Save andreas/0e580b19df542f1dbe1ee2676a2c6768 to your computer and use it in GitHub Desktop.

Select an option

Save andreas/0e580b19df542f1dbe1ee2676a2c6768 to your computer and use it in GitHub Desktop.

Revisions

  1. andreas created this gist Dec 20, 2016.
    209 changes: 209 additions & 0 deletions ocaml-mariadb-osx.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,209 @@
    diff --git bindings/ffi_bindings.ml bindings/ffi_bindings.ml
    index 8a8cc5c..58725d7 100644
    --- bindings/ffi_bindings.ml
    +++ bindings/ffi_bindings.ml
    @@ -44,16 +44,10 @@ module Types (F: Cstubs.Types.TYPE) = struct
    let connect_attr_delete = constant "MYSQL_OPT_CONNECT_ATTR_DELETE" int
    let server_public_key = constant "MYSQL_SERVER_PUBLIC_KEY" int
    let enable_cleartext_plugin = constant "MYSQL_ENABLE_CLEARTEXT_PLUGIN" int
    - let can_handle_expired_passwords =
    - constant "MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS" int
    let nonblock = constant "MYSQL_OPT_NONBLOCK" int
    - let use_thread_specific_memory =
    - constant "MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY" int
    end

    module Flags = struct
    - let can_handle_expired_passwords =
    - constant "CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS" int
    let compress = constant "CLIENT_COMPRESS" int
    let found_rows = constant "CLIENT_FOUND_ROWS" int
    let ignore_sigpipe = constant "CLIENT_IGNORE_SIGPIPE" int
    diff --git lib/blocking.ml lib/blocking.ml
    index bc69003..5500b1a 100644
    --- lib/blocking.ml
    +++ lib/blocking.ml
    @@ -14,7 +14,6 @@ type error = Common.error
    type 'a result = ('a, error) Pervasives.result

    type flag = Common.flag =
    - | Client_can_handle_expired_passwords
    | Compress
    | Found_rows
    | Ignore_sigpipe
    @@ -68,8 +67,6 @@ type client_option = Common.client_option =
    | Connect_attr_delete of string
    | Server_public_key of string
    | Enable_cleartext_plugin of bool
    - | Can_handle_expired_passwords of bool
    - | Use_thread_specific_memory of bool

    type server_option = Common.server_option =
    | Multi_statements of bool
    diff --git lib/common.ml lib/common.ml
    index 4b1d1b2..848c330 100644
    --- lib/common.ml
    +++ lib/common.ml
    @@ -12,7 +12,6 @@ type 'm t = B.mysql constraint 'm = [< mode]
    type 'm mariadb = 'm t

    type flag =
    - | Client_can_handle_expired_passwords
    | Compress
    | Found_rows
    | Ignore_sigpipe
    @@ -66,8 +65,6 @@ type client_option =
    | Connect_attr_delete of string
    | Server_public_key of string
    | Enable_cleartext_plugin of bool
    - | Can_handle_expired_passwords of bool
    - | Use_thread_specific_memory of bool

    type server_option =
    | Multi_statements of bool
    @@ -169,17 +166,13 @@ let set_client_option mariadb opt =
    | Server_public_key key ->
    `Opt (T.Options.server_public_key, voidp_of_string key)
    | Enable_cleartext_plugin b ->
    - `Opt (T.Options.enable_cleartext_plugin, voidp_of_bool b)
    - | Can_handle_expired_passwords b ->
    - `Opt (T.Options.can_handle_expired_passwords, voidp_of_bool b)
    - | Use_thread_specific_memory b ->
    - `Opt (T.Options.use_thread_specific_memory, voidp_of_bool b) in
    + `Opt (T.Options.enable_cleartext_plugin, voidp_of_bool b) in
    match opt with
    | `Opt (opt, arg) -> B.mysql_options mariadb opt arg
    | `Opt4 (opt, arg1, arg2) -> B.mysql_options4 mariadb opt arg1 arg2

    let int_of_flag = function
    - | Client_can_handle_expired_passwords -> T.Flags.can_handle_expired_passwords
    + | Remember_options -> T.Flags.remember_options
    | Compress -> T.Flags.compress
    | Found_rows -> T.Flags.found_rows
    | Ignore_sigpipe -> T.Flags.ignore_sigpipe
    @@ -191,7 +184,6 @@ let int_of_flag = function
    | No_schema -> T.Flags.no_schema
    | Odbc -> T.Flags.odbc
    | Ssl -> T.Flags.ssl
    - | Remember_options -> T.Flags.remember_options

    let int_of_flags =
    List.fold_left (fun acc flag -> acc lor int_of_flag flag) 0
    diff --git lib/mariadb.ml lib/mariadb.ml
    index 92a766a..9941f11 100644
    --- lib/mariadb.ml
    +++ lib/mariadb.ml
    @@ -87,7 +87,6 @@ module type S = sig
    type t

    type flag =
    - | Client_can_handle_expired_passwords
    | Compress
    | Found_rows
    | Ignore_sigpipe
    @@ -141,8 +140,6 @@ module type S = sig
    | Connect_attr_delete of string
    | Server_public_key of string
    | Enable_cleartext_plugin of bool
    - | Can_handle_expired_passwords of bool
    - | Use_thread_specific_memory of bool

    type server_option =
    | Multi_statements of bool
    diff --git lib/mariadb.mli lib/mariadb.mli
    index 12c36c7..3adc871 100644
    --- lib/mariadb.mli
    +++ lib/mariadb.mli
    @@ -162,7 +162,6 @@ module type S = sig
    (** The type of database handles. *)

    type flag =
    - | Client_can_handle_expired_passwords
    | Compress
    | Found_rows
    | Ignore_sigpipe
    @@ -216,8 +215,6 @@ module type S = sig
    | Connect_attr_delete of string
    | Server_public_key of string
    | Enable_cleartext_plugin of bool
    - | Can_handle_expired_passwords of bool
    - | Use_thread_specific_memory of bool

    type server_option =
    | Multi_statements of bool
    @@ -428,7 +425,6 @@ module Nonblocking : sig
    type t

    type flag =
    - | Client_can_handle_expired_passwords
    | Compress
    | Found_rows
    | Ignore_sigpipe
    @@ -482,8 +478,6 @@ module Nonblocking : sig
    | Connect_attr_delete of string
    | Server_public_key of string
    | Enable_cleartext_plugin of bool
    - | Can_handle_expired_passwords of bool
    - | Use_thread_specific_memory of bool

    type server_option =
    | Multi_statements of bool
    diff --git lib/nonblocking.ml lib/nonblocking.ml
    index ace6ca0..cd12ff6 100644
    --- lib/nonblocking.ml
    +++ lib/nonblocking.ml
    @@ -407,7 +407,6 @@ module type S = sig
    type t

    type flag =
    - | Client_can_handle_expired_passwords
    | Compress
    | Found_rows
    | Ignore_sigpipe
    @@ -461,8 +460,6 @@ module type S = sig
    | Connect_attr_delete of string
    | Server_public_key of string
    | Enable_cleartext_plugin of bool
    - | Can_handle_expired_passwords of bool
    - | Use_thread_specific_memory of bool

    type server_option =
    | Multi_statements of bool
    @@ -499,7 +496,6 @@ module Make (W : Wait) : S with type 'a future = 'a W.IO.future = struct
    let (>>|) fut f = fut >>= fun x -> return (f x)

    type flag = Common.flag =
    - | Client_can_handle_expired_passwords
    | Compress
    | Found_rows
    | Ignore_sigpipe
    @@ -553,8 +549,6 @@ module Make (W : Wait) : S with type 'a future = 'a W.IO.future = struct
    | Connect_attr_delete of string
    | Server_public_key of string
    | Enable_cleartext_plugin of bool
    - | Can_handle_expired_passwords of bool
    - | Use_thread_specific_memory of bool

    type server_option = Common.server_option =
    | Multi_statements of bool
    diff --git stubgen/ffi_stubgen.ml stubgen/ffi_stubgen.ml
    index 8af8eb2..f90d917 100644
    --- stubgen/ffi_stubgen.ml
    +++ stubgen/ffi_stubgen.ml
    @@ -13,6 +13,6 @@ let _ =
    Cstubs.write_ml
    Format.std_formatter ~prefix (module Ffi_bindings.Bindings)
    | false, true ->
    - print_endline "#include <mysql/mysql.h>";
    + print_endline "#include <mariadb/mysql.h>";
    Cstubs.write_c
    Format.std_formatter ~prefix (module Ffi_bindings.Bindings)
    diff --git stubgen/ffi_types_stubgen.ml stubgen/ffi_types_stubgen.ml
    index 5b40abc..620d135 100644
    --- stubgen/ffi_types_stubgen.ml
    +++ stubgen/ffi_types_stubgen.ml
    @@ -1,3 +1,3 @@
    let () =
    - print_endline "#include <mysql/mysql.h>";
    + print_endline "#include <mariadb/mysql.h>";
    Cstubs.Types.write_c Format.std_formatter (module Ffi_bindings.Types)