| 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 | |
| 30 | type value |
| 31 | (* One value in a query result *) |
| 32 | |
| 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 *) |
| 39 | val fold : conn -> (value list * 'a -> 'a) -> 'a -> string -> 'a |
| 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 *) |
| 46 | val isNull : value -> bool |
| 47 | val intToSql : int -> string |
| 48 | val intFromSql : value -> int |
| 49 | val stringToSql : string -> string |
| 50 | val stringFromSql : value -> string |
| 51 | val timestampToSql : timestamp -> string |
| 52 | val timestampToSqlUnquoted : timestamp -> string |
| 53 | val timestampFromSql : value -> timestamp |
| 54 | val realToSql : real -> string |
| 55 | val realFromSql : value -> real |
| 56 | val boolToSql : bool -> string |
| 57 | val boolFromSql : value -> bool |
| 58 | end |