Пример #1
0
 public override void RemovedConnection(string connkey)
 {
     if (connkey != m_conn.GetConnKey())
     {
         return;
     }
     Disconnected(null);
     //IAsyncResult res = m_conn.BeginClose(Async.CreateInvokeCallback(RealNode.Invoker, (AsyncCallback)Disconnected));
     //ProcessRegister.AddBackgroundTask("s_disconnect");
     //if (res.CompletedSynchronously) Disconnected(res);
 }
Пример #2
0
        private TableAnalyser GetLoadedConstraints(TableStructure table)
        {
            {
                var res = (TableAnalyser)AnalyserCache.GetTableAnalyser("constraints");
                if (res != null)
                {
                    return(res);
                }
                res = (TableAnalyser)AnalyserCache.GetTableAnalyser("constraints:" + table.FullName.ToString());
                if (res != null)
                {
                    return(res);
                }
            }
            InformationSchema ins = InformationSchema.LoadSchemaOnce(GetDbConn, m_conn.GetConnKey());

            if (m_members.TableFilter != null && m_members.TableFilter.Count == 1)
            {
                // load constraint for one table
                TableAnalyser     ta     = new TableAnalyser();
                ConstraintsLoader loader = new ConstraintsLoader(GetDbConn(), ins, ta, table.FullName, m_members.TableMembers & GetConstraintLoadMode(), GetDbNameCondition());
                loader.Run();
                AnalyserCache.PutTableAnalyser("constraints:" + table.FullName.ToString(), ta);
                return(ta);
            }
            else
            {
                // load constraints for all tables
                TableAnalyser     ta     = new TableAnalyser();
                ConstraintsLoader loader = new ConstraintsLoader(GetDbConn(), ins, ta, null, m_members.TableMembers & GetConstraintLoadMode(), GetDbNameCondition());
                loader.Run();
                AnalyserCache.PutTableAnalyser("constraints", ta);
                return(ta);
            }
        }
Пример #3
0
 public IDatabaseSource MergeToConnection(IPhysicalConnection conn)
 {
     if (conn.GetConnKey() != m_conn.GetConnKey())
     {
         throw new InternalError("DAE-00193 Cannot merge connections with different groups");
     }
     return(new DataArchiveReader((DataArchiveConnection)conn));
 }
Пример #4
0
        //public void CreateConstraints(IEnumerable<IConstraint> constraints)
        //{
        //    foreach (IConstraint cnt in constraints)
        //    {
        //        m_table.Constraints.Add(Constraint.CreateCopy(cnt));
        //    }
        //}

        public ITableSource MergeToConnection(IPhysicalConnection conn)
        {
            if (conn.GetConnKey() != m_conn.GetConnKey())
            {
                throw new InternalError("DAE-00018 Cannot merge connections with different groups");
            }
            return(new DataArchiveTable(Database.MergeToConnection(conn), (DataArchiveConnection)conn, m_table));
        }
Пример #5
0
        //public static void EnsureValid(this IPhysicalConnection conn)
        //{
        //    if (conn.Dialect != null && conn.SystemConnection != null)
        //    {
        //        string ping = conn.Dialect.GeneratePing();
        //        try
        //        {
        //            conn.SystemConnection.ExecuteNonQuery(ping);
        //        }
        //        catch
        //        {
        //            try
        //            {
        //                conn.ReconnectIfBroken();
        //            }
        //        }
        //    }
        //}

        public static void SafeChangeConnection <T>(ref T m_conn, IPhysicalConnection value)
            where T : IPhysicalConnection
        {
            if (m_conn.GetConnKey() != value.GetConnKey())
            {
                throw new InternalError("DAE-00011 Invalid connection, connection key differs");
            }
            m_conn = (T)value;
        }
Пример #6
0
        public IServerSource MergeToConnection(IPhysicalConnection conn)
        {
            if (conn.GetConnKey() != m_conn.GetConnKey())
            {
                throw new InternalError("DAE-00030 Cannot merge connections with different keys");
            }
            GenericServerSource res = new GenericServerSource(conn);

            return(res);
        }
Пример #7
0
        public ITableSource MergeToConnection(IPhysicalConnection conn)
        {
            if (conn.GetConnKey() != m_conn.GetConnKey())
            {
                throw new InternalError("DAE-00371 Cannot merge connections with different groups");
            }
            IDatabaseSource resdb = null;

            if (Database != null)
            {
                resdb = Database.MergeToConnection(conn);
            }
            var res = new GenericViewAsTableSource(resdb, conn, m_dbname, m_schema, m_viewname);

            return(res);
        }
Пример #8
0
        public IDatabaseSource MergeToConnection(IPhysicalConnection conn)
        {
            if (conn.GetConnKey() != m_conn.GetConnKey())
            {
                throw new InternalError("DAE-00031 Cannot merge connections with different groups");
            }
            IServerSource ressrv = null;

            if (Server != null)
            {
                ressrv = Server.MergeToConnection(conn);
            }
            GenericDatabaseSource res = new GenericDatabaseSource(ressrv, conn, m_dbname);

            return(res);
        }