Updated for SML/NJ 110.46
[hcoop/smlsql.git] / sql_driver.sig
CommitLineData
f147efc8
AC
1(*
2 * SQL database interfaces for Standard ML
3 * Copyright (C) 2003 Adam Chlipala
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *)
19
20(* Signature to be implemented to make use of a new client *)
21
22signature SQL_DRIVER =
23sig
24 type conn
25 (* SQL client connection *)
26
27 exception Sql of string
28 (* All-purpose exception *)
29
30 val conn : string -> conn
31 (* Connect to a server based on a string of information *)
32 val close : conn -> unit
33 (* Close a connection *)
34 val dml : conn -> string -> string
35 (* Execute a DML command over a connection, returning a result message *)
36 val fold : conn -> (string list * 'a -> 'a) -> 'a -> string -> 'a
37 (* Behaves like List.foldl, applied over the result rows of a query *)
38
39 type timestamp = Time.time
40 exception Format of string
41
42 (* Conversions between SML values and their string representations from SQL queries *)
c7a46c0f 43 val isNull : string -> bool
f147efc8
AC
44 val intToSql : int -> string
45 val intFromSql : string -> int
46 val stringToSql : string -> string
47 val stringFromSql : string -> string
48 val timestampToSql : timestamp -> string
2f09ba1e 49 val timestampToSqlUnquoted : timestamp -> string
f147efc8
AC
50 val timestampFromSql : string -> timestamp
51 val realToSql : real -> string
52 val realFromSql : string -> real
53 val boolToSql : bool -> string
54 val boolFromSql : string -> bool
55end