Commit | Line | Data |
---|---|---|
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 | ||
22 | signature SQL_DRIVER = | |
23 | sig | |
24 | type conn | |
25 | (* SQL client connection *) | |
26 | ||
27 | exception Sql of string | |
28 | (* All-purpose exception *) | |
29 | ||
d08450a7 AC |
30 | type value |
31 | (* One value in a query result *) | |
32 | ||
f147efc8 AC |
33 | val conn : string -> conn |
34 | (* Connect to a server based on a string of information *) | |
35 | val close : conn -> unit | |
36 | (* Close a connection *) | |
37 | val dml : conn -> string -> string | |
38 | (* Execute a DML command over a connection, returning a result message *) | |
d08450a7 | 39 | val fold : conn -> (value list * 'a -> 'a) -> 'a -> string -> 'a |
f147efc8 AC |
40 | (* Behaves like List.foldl, applied over the result rows of a query *) |
41 | ||
42 | type timestamp = Time.time | |
43 | exception Format of string | |
44 | ||
45 | (* Conversions between SML values and their string representations from SQL queries *) | |
d08450a7 | 46 | val isNull : value -> bool |
f147efc8 | 47 | val intToSql : int -> string |
d08450a7 | 48 | val intFromSql : value -> int |
f147efc8 | 49 | val stringToSql : string -> string |
d08450a7 | 50 | val stringFromSql : value -> string |
f147efc8 | 51 | val timestampToSql : timestamp -> string |
2f09ba1e | 52 | val timestampToSqlUnquoted : timestamp -> string |
d08450a7 | 53 | val timestampFromSql : value -> timestamp |
f147efc8 | 54 | val realToSql : real -> string |
d08450a7 | 55 | val realFromSql : value -> real |
f147efc8 | 56 | val boolToSql : bool -> string |
d08450a7 | 57 | val boolFromSql : value -> bool |
f147efc8 | 58 | end |