on master help sign in
add client library documentation
commit74e5b3bdad5da9d25d7483d20d1a9874bc246e65 authorAgentM <agentm@themactionfaction.com> dateMon 5 Oct 2015, 18:05 (11 years ago) parent3040059
1 file changed+37
docs/projectm36_client_library.markdown+37
docs/projectm36_client_library.markdownnew file+37
@@ -0,0 +1,37 @@
1+# Project:M36 Client Library
2+
3+The Project:M36 client library is the preferred method for interacting with Project:M36 databases. It supports all features of the DBMS while other interfaces may not.
4+
5+The client supports both in-process and remote Project:M36 access.
6+
7+## Setup
8+
9+1. Import the library's symbols
10+```haskell
11+import ProjectM36.Client
12+```
13+2. Create a Connection with a ConnectionInfo in the Either monad
14+```haskell
15+conn <- connectProjectM36 (InProcessConnectionInfo NoPersistence)
16+```
17+
18+## Executing Expressions
19+
20+1. Execute relational expression queries
21+```haskell
22+result <- executeRelationalExpr conn (Union (RelationVariable "x") (RelationVariable "y"))
23+```
24+2. Execute database context expressions which modify the current, mutable database context
25+```haskell
26+maybeErr <- executeDatabaseContextExpr conn (Define "person" (attributesFromList [Attribute "name" StringAtomType, Attribute "age" IntAtomType, Attribute "id" StringAtomType]))
27+```
28+3. Execute a transaction graph expression
29+```haskell
30+maybeErr <- executeGraphExpr conn (JumpToHead "branch2")
31+```
32+
33+## Cleanup
34+
35+1. Close the connection
36+```haskell
37+close conn