on master help sign in
WIP :showexpr now schema-aware
800dceaAgentM
src/lib/ProjectM36/Client.hs+6−4
@@ -404,12 +404,14 @@ setCurrentSchemaName sessionId conn@(RemoteProcessConnection _ _) sname = remote
404-- | Execute a relational expression in the context of the session and connection. Relational expressions are queries and therefore cannot alter the database.
404-- | Execute a relational expression in the context of the session and connection. Relational expressions are queries and therefore cannot alter the database.
405executeRelationalExpr :: SessionId -> Connection -> RelationalExpr -> IO (Either RelationalError Relation)
405executeRelationalExpr :: SessionId -> Connection -> RelationalExpr -> IO (Either RelationalError Relation)
406executeRelationalExpr sessionId (InProcessConnection _ _ sessions _ _) expr = excEither $ atomically $ do
406executeRelationalExpr sessionId (InProcessConnection _ _ sessions _ _) expr = excEither $ atomically $ do
407− eSession <- sessionForSessionId sessionId sessions
407+ eSession <- sessionAndSchema sessionId sessions
408 case eSession of
408 case eSession of
409 Left err -> pure $ Left err
409 Left err -> pure $ Left err
410+ Right (session, schema) -> case Schema.processRelationalExprInSchema schema expr of
411+ Left err -> pure (Left err)
410− Right session -> case evalState (RE.evalRelationalExpr expr) (Sess.concreteDatabaseContext session) of
412+ Right expr' -> case evalState (RE.evalRelationalExpr expr') (Sess.concreteDatabaseContext session) of
411− Left err -> pure (Left err)
413+ Left err -> pure (Left err)
412− Right rel -> pure (force (Right rel)) -- this is necessary so that any undefined/error exceptions are spit out here
414+ Right rel -> pure (force (Right rel)) -- this is necessary so that any undefined/error exceptions are spit out here
413executeRelationalExpr sessionId conn@(RemoteProcessConnection _ _) relExpr = remoteCall conn (ExecuteRelationalExpr sessionId relExpr)
415executeRelationalExpr sessionId conn@(RemoteProcessConnection _ _) relExpr = remoteCall conn (ExecuteRelationalExpr sessionId relExpr)
414
416
415-- | Execute a database context expression in the context of the session and connection. Database expressions modify the current session's disconnected transaction but cannot modify the transaction graph.
417-- | Execute a database context expression in the context of the session and connection. Database expressions modify the current session's disconnected transaction but cannot modify the transaction graph.