Exemplo n.º 1
0
        public DataTable ExecuteQuery(IDbCommand cmd, string rdbName)
        {
            IPersistenceProvider rdb = null;

            if (rdbName == "")
            {
                rdb = GetDatabase().GetCopy();
            }
            else
            {
                rdb = GetDatabase(rdbName).GetCopy();
            }

            try
            {
                rdb.Open();
                DataTable dt = rdb.AsDataTable(cmd);
                return(dt);
            }
            catch (Exception ex)
            {
                this.ErrorHandle(ex, null, cmd.CommandText.ToString());
            }
            finally
            {
                rdb.Close();
            }
            return(null);
        }
Exemplo n.º 2
0
        public bool BeginTransaction(Transaction transaction)
        {
            transaction.Databases.Clear();
            IPersistenceProvider rdb = null;

            rdb = GetDatabase().GetCopy();
            transaction.Databases.Add(rdb.Name, rdb);
            rdb.Open();
            rdb.BeginTransaction();
            return(true);
        }
Exemplo n.º 3
0
        internal IPersistenceProvider GetPersistenceProvider(Transaction transaction, string dbName)
        {
            IPersistenceProvider rdb = (IPersistenceProvider)transaction.Databases[dbName];

            if (rdb == null)
            {
                rdb = GetDatabase(dbName).GetCopy();
                transaction.Databases.Add(dbName, rdb);
                rdb.Open();
                rdb.BeginTransaction();
            }
            return(rdb);
        }
Exemplo n.º 4
0
        public void SaveObject(PersistentObject obj)
        {
            ClassMap             cm  = this.GetClassMap(obj.GetClassName());
            IPersistenceProvider rdb = cm.PersistenceProvider.GetCopy();

            try
            {
                rdb.Open();
                SaveObjectPrivate(obj, cm, rdb);
            }
            catch (Exception ex)
            {
                ErrorHandle(ex, obj);
            }
            finally
            {
                rdb.Close();
            }
        }
Exemplo n.º 5
0
        public int Execute(IDbCommand cmd, string rdbName)
        {
            IPersistenceProvider rdb = null;

            if (rdbName == "")
            {
                rdb = GetDatabase().GetCopy();
            }
            else
            {
                rdb = GetDatabase(rdbName).GetCopy();
            }

            rdb.Open();
            int intReturn = rdb.DoCommand(cmd);

            rdb.Close();
            return(intReturn);
        }
Exemplo n.º 6
0
        public bool RetrieveObject(PersistentObject obj)
        {
            ClassMap             clsMap = GetClassMap(obj.GetClassName());
            IPersistenceProvider rdb    = clsMap.PersistenceProvider.GetCopy();
            bool blnResult = true;

            try
            {
                rdb.Open();
                blnResult = RetrieveObjectPrivate(obj, clsMap, rdb);
            }
            catch (Exception ex)
            {
                ErrorHandle(ex, obj);
            }
            finally
            {
                rdb.Close();
            }
            return(blnResult);
        }
Exemplo n.º 7
0
        public void DeleteObject(PersistentObject obj)
        {
            ClassMap             clsMap = GetClassMap(obj.GetClassName());
            IDbCommand           cmd    = clsMap.GetDeleteSqlFor(obj);
            IPersistenceProvider rdb    = clsMap.PersistenceProvider.GetCopy();

            try
            {
                rdb.Open();
                if (rdb.DoCommand(clsMap.GetDeleteSqlFor(obj)) > 0)
                {
                    obj.IsPersistent = false;
                }
            }
            catch (Exception ex)
            {
                this.ErrorHandle(ex, obj);
            }
            finally
            {
                rdb.Close();
            }
        }