on master help sign in
don't show plans when in a schema- this could be improved
commitbea780ed3b6fae1d174c41105a60495d0aed0a52 authorAgentM <agentm@themactionfaction.com> dateSun 6 Nov 2016, 19:37 (10 years ago) parentd959956
2 files changed+16−7
src/lib/ProjectM36/Base.hs+1−1 src/lib/ProjectM36/Client.hs+15−6
src/lib/ProjectM36/Base.hs+1−1
@@ -272,7 +272,7 @@ data Schemas = Schemas DatabaseContext Subschemas
272272data Schema = Schema SchemaIsomorphs
273273 deriving (Generic, Binary)
274274
275−data SchemaIsomorph = IsoRestrict RelVarName RestrictionPredicateExpr (RelVarName, RelVarName) | --maps one relvar into two relvars (true, false), if the false name is Nothing, no relvar in schemaB is created. This is useful for renaming relation variables between schemas or hiding relvars altogether.
275+data SchemaIsomorph = IsoRestrict RelVarName RestrictionPredicateExpr (RelVarName, RelVarName) |
276276 IsoRename RelVarName RelVarName |
277277 IsoUnion (RelVarName, RelVarName) RestrictionPredicateExpr RelVarName --maps two relvars to one relvar
278278 -- IsoTypeConstructor in morphAttrExpr
src/lib/ProjectM36/Client.hs+15−6
@@ -184,6 +184,7 @@ notificationListener callback = do
184184 receiveWait [
185185 match (\(NotificationMessage eNots) -> do
186186 --say $ "NOTIFICATION: " ++ show eNots
187+ -- when notifications are thrown, they are not adjusted for the current schema which could be problematic, but we don't have access to the current session here
187188 liftIO $ mapM_ (uncurry callback) (M.toList eNots)
188189 )
189190 ]
@@ -426,9 +427,13 @@ executeDatabaseContextExpr sessionId (InProcessConnection _ _ sessions _ _) expr
426427 case eSession of
427428 Left err -> pure $ Just err
428429 Right (session, schema) -> do
429− case Schema.processDatabaseContextExprInSchema schema expr of
430+ let expr' = if schemaName session == defaultSchemaName then
431+ Right expr
432+ else
433+ Schema.processDatabaseContextExprInSchema schema expr
434+ case expr' of
430435 Left err -> pure (Just err)
431− Right expr' -> case runState (RE.evalContextExpr expr') (Sess.concreteDatabaseContext session) of
436+ Right expr'' -> case runState (RE.evalContextExpr expr'') (Sess.concreteDatabaseContext session) of
432437 (Just err,_) -> return $ Just err
433438 (Nothing, context') -> do
434439 let newDiscon = DisconnectedTransaction (Sess.parentId session) newSchemas
@@ -511,7 +516,7 @@ executeGraphExpr sessionId (InProcessConnection strat clientNodes sessions graph
511516 --update filesystem database, if necessary
512517 --this should really grab a lock at the beginning of the method to be threadsafe
513518 processPersistence strat newGraph
514− sendNotifications nodesToNotify notsToFire --TODO: schema mod
519+ sendNotifications nodesToNotify notsToFire
515520 return Nothing
516521executeGraphExpr sessionId conn@(RemoteProcessConnection _ _) graphExpr = remoteCall conn (ExecuteGraphExpr sessionId graphExpr)
517522
@@ -600,7 +605,7 @@ inclusionDependencies sessionId (InProcessConnection _ _ sessions _ _) = do
600605 atomically $ do
601606 eSession <- sessionAndSchema sessionId sessions
602607 case eSession of
603− Left err -> pure $ Left err --TODO: schema application
608+ Left err -> pure $ Left err
604609 Right (session, schema) -> do
605610 let context = Sess.concreteDatabaseContext session
606611 if schemaName session == defaultSchemaName then
@@ -616,8 +621,12 @@ planForDatabaseContextExpr sessionId (InProcessConnection _ _ sessions _ _) dbEx
616621 atomically $ do
617622 eSession <- sessionAndSchema sessionId sessions
618623 case eSession of
619− Left err -> pure $ Left err --TODO: schema application
620− Right (session, schema) -> pure $ evalState (applyStaticDatabaseOptimization dbExpr) (Sess.concreteDatabaseContext session)
624+ Left err -> pure $ Left err
625+ Right (session, _) -> if schemaName session == defaultSchemaName then
626+ pure $ evalState (applyStaticDatabaseOptimization dbExpr) (Sess.concreteDatabaseContext session)
627+ else -- don't show any optimization because the current optimization infrastructure relies on access to the base context- this probably underscores the need for each schema to have its own DatabaseContext, even if it is generated on-the-fly
628+ pure (Right dbExpr)
629+
621630planForDatabaseContextExpr sessionId conn@(RemoteProcessConnection _ _) dbExpr = remoteCall conn (RetrievePlanForDatabaseContextExpr sessionId dbExpr)
622631
623632-- | Return a relation which represents the current state of the global transaction graph. The attributes are