Beispiel #1
0
        public int ExecuteNonQuery(string strQuery, FbParameter paramArray,
                                   CommandType cmdType, out FbParameterCollection col)
        {
            int Li_RowCnt = 0;

            col = null;

            try
            {
                FbCommand cmd = new FbCommand(strQuery, Conn);
                cmd.CommandType = cmdType;

                if (paramArray != null)
                {
                    cmd.Parameters.Add(paramArray);
                }

                //if (Conn.State == ConnectionState.Closed)
                //{
                //    Conn.Open();
                //}

                Li_RowCnt = cmd.ExecuteNonQuery();
                col       = cmd.Parameters;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
            return(Li_RowCnt);
        }
    public FbParameterCollection AddBatchParameters()
    {
        var result = new FbParameterCollection();

        BatchParameters.Add(result);
        return(result);
    }
Beispiel #3
0
        public DataSet Fill(string strQuery, string StrAlias, DataSet dsDataSet,
                            FbParameter[] paramArray, CommandType cmdType, out FbParameterCollection paramCol)
        {
            paramCol = null;

            try
            {
                FbDataAdapter DA = new FbDataAdapter(strQuery, Conn);
                DA.SelectCommand.CommandType = cmdType;

                if (dsDataSet == null)
                {
                    dsDataSet = new DataSet();
                }

                if (paramArray != null)
                {
                    foreach (FbParameter param in paramArray)
                    {
                        DA.SelectCommand.Parameters.Add(param);
                    }
                }

                DA.Fill(dsDataSet);
                paramCol = DA.SelectCommand.Parameters;
            }
            catch
            {
                throw;
            }
            return(dsDataSet);
        }
Beispiel #4
0
        public DataSet Fill(string strQuery, string strAlias, DataSet dsDataSet,
                            FbParameter[] paramArray)
        {
            FbParameterCollection col = null;

            return(Fill(strQuery, strAlias, dsDataSet, paramArray, CommandType.Text, out col));
        }
Beispiel #5
0
        public void DNET635_ResetsParentOnClear()
        {
            var collection = new FbParameterCollection();
            var parameter  = collection.Add("test", 0);

            Assert.IsNotNull(parameter.Parent);
            collection.Clear();
            Assert.IsNull(parameter.Parent);
        }
Beispiel #6
0
        public List <Element> GetElementLangue(int cle_element)
        {
            FbConnection   connexion = new FbConnection(ChaineConnection());
            List <Element> listes    = new List <Element>();

            using (FbCommand commande = connexion.CreateCommand())
            {
                commande.CommandText = "GET_LANGUES_ELE";
                commande.CommandType = System.Data.CommandType.StoredProcedure;
                FbParameterCollection pc = commande.Parameters;
                pc.Add("CLE", FbDbType.Integer, 0).Value = cle_element;
                try
                {
                    connexion.Open();
                    FbDataReader reader = commande.ExecuteReader();
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            Element a = new Element();
                            a.CleElement = cle_element;
                            if (!(reader[1] == DBNull.Value))
                            {
                                a.CleLangue = (int)reader[1];
                            }
                            if (!(reader[2] == DBNull.Value))
                            {
                                a.Label = (string)reader[2];
                            }
                            if (!(reader[3] == DBNull.Value))
                            {
                                a.Description = (string)reader[3];
                            }
                            listes.Add(a);
                        }
                        connexion.Close();
                        return(listes);
                    }
                    connexion.Close();
                    return(null);
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.ToString());
                    connexion.Close();
                    return(null);
                }
            }
        }
Beispiel #7
0
        public void CheckFbParameterParentPropertyInvariant()
        {
            var collection = new FbParameterCollection();
            var parameter  = collection.Add("Name", FbDbType.Array);

            Assert.AreEqual(collection, parameter.Parent);
            Assert.Throws <ArgumentException>(() => collection.Add(parameter));
            Assert.Throws <ArgumentException>(() => collection.AddRange(new FbParameter[] { parameter }));

            collection.Remove(parameter);
            Assert.IsNull(parameter.Parent);

            Assert.Throws <ArgumentException>(() => collection.Remove(parameter));

            collection.Insert(0, parameter);
            Assert.AreEqual(collection, parameter.Parent);
            Assert.Throws <ArgumentException>(() => collection.Insert(0, parameter));
        }
Beispiel #8
0
        public void DNET532_CheckFlagForUsingOrdinalIgnoreCaseWithOuterChanges()
        {
            var collection = new FbParameterCollection();
            var parameter  = new FbParameter()
            {
                ParameterName = "test"
            };

            collection.Add(parameter);
            var dummy1 = collection.IndexOf("dummy");

            Assert.IsFalse(collection.HasParameterWithNonAsciiName);
            parameter.ParameterName = "řčšřčšřčš";
            var dummy2 = collection.IndexOf("dummy");

            Assert.IsTrue(parameter.IsUnicodeParameterName);
            Assert.IsTrue(collection.HasParameterWithNonAsciiName);
        }
Beispiel #9
0
        internal int DeleteElementCheck(int cle, int cleElement)
        {
            FbConnection connexion = new FbConnection(ChaineConnection());

            using (FbCommand commande = connexion.CreateCommand())
            {
                commande.CommandText = "DELETE_ELEMENT_CHECK";
                commande.CommandType = CommandType.StoredProcedure;
                FbParameterCollection pc = commande.Parameters;
                pc.Add("CLE", FbDbType.Integer, 0).Value          = cleElement;
                pc.Add("CLEDIMENSION", FbDbType.Integer, 0).Value = cle;
                try
                {
                    return(execution(commande, connexion));
                }
                catch (Exception ex)
                {
                    return(intExeption(connexion, ex));
                }
            }
        }
Beispiel #10
0
        public int TransactionQuery(string strQuery, FbParameter[] paramArray,
                                    CommandType cmdType, out FbParameterCollection col)
        {
            int       Li_RowCnt = 0;
            FbCommand cmd       = null;

            try
            {
                cmd             = new FbCommand(strQuery, Conn);
                cmd.CommandType = cmdType;

                if (paramArray != null)
                {
                    foreach (FbParameter param in paramArray)
                    {
                        cmd.Parameters.Add(param);
                    }
                }

                if (Trans == null)
                {
                    BeginTrans();
                }
                cmd.Transaction = Trans;

                Li_RowCnt = cmd.ExecuteNonQuery();
                col       = cmd.Parameters;


                cmd.Transaction.Commit();
            }
            catch (Exception)
            {
                cmd.Transaction.Rollback();

                Li_RowCnt = -1;
                throw;
            }
            return(Li_RowCnt);
        }
Beispiel #11
0
        internal List <ReferenceCheck> GetElementCheck(int cle)
        {
            FbConnection          connexion  = new FbConnection(ChaineConnection());
            List <ReferenceCheck> references = new List <ReferenceCheck>();

            using (FbCommand commande = connexion.CreateCommand())
            {
                commande.CommandText = "GET_ELEMENT_CHECK";
                commande.CommandType = CommandType.StoredProcedure;
                FbParameterCollection pc = commande.Parameters;
                pc.Add("CLE", FbDbType.Integer, 0).Value = cle;
                try
                {
                    connexion.Open();
                    FbDataReader reader = commande.ExecuteReader();
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            ReferenceCheck p = new ReferenceCheck();
                            p.Cle   = (int)reader[0];
                            p.Label = (string)reader[1];
                            p.Check = true;
                            references.Add(p);
                        }
                        connexion.Close();
                        return(references);
                    }
                    connexion.Close();
                    return(null);
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.ToString());
                    connexion.Close();
                    return(null);
                }
            }
        }
Beispiel #12
0
        public int  UpdateElement(int cleElement)
        {
            FbConnection connexion = new FbConnection(ChaineConnection());

            using (FbCommand commande = connexion.CreateCommand())
            {
                commande.CommandText = "UPDATE_ELEMENT";
                commande.CommandType = CommandType.StoredProcedure;
                FbParameterCollection pc = commande.Parameters;
                pc.Add("CLE", FbDbType.Integer, 0).Value = cleElement;
                //pc.Add("CLELANGUE", FbDbType.Integer, 0).Value = cleLangue;
                //pc.Add("LABEL", FbDbType.VarChar, 30).Value = label;
                //pc.Add("DESCRIPTION", FbDbType.VarChar, 900).Value = description;
                try
                {
                    return(execution(commande, connexion));
                }
                catch (Exception ex)
                {
                    return(intExeption(connexion, ex));
                }
            }
        }
Beispiel #13
0
        public int SetElement(string element)
        {
            FbConnection connexion = new FbConnection(ChaineConnection());

            using (FbCommand commande = connexion.CreateCommand())
            {
                commande.CommandText = "SET_ELEMENT";
                commande.CommandType = CommandType.StoredProcedure;
                FbParameterCollection pc = commande.Parameters;
                pc.Add("CLE", FbDbType.Integer, 0).Direction = ParameterDirection.Output;
                pc.Add("LABEL", FbDbType.VarChar, 30).Value  = element;

                try
                {
                    connexion.Open();
                    commande.ExecuteNonQuery();
                    int cle;
                    if (pc[0].Value is int)
                    {
                        cle = (int)pc[0].Value;
                        return(cle);
                    }
                    else
                    {
                        cle = -2;
                    }

                    connexion.Close();
                    return(cle);
                }
                catch (Exception ex)
                {
                    return(intExeption(connexion, ex));
                }
            }
        }
Beispiel #14
0
        public DataSet Fill(string strQuery, string strAlias)
        {
            FbParameterCollection col = null;

            return(Fill(strQuery, strAlias, null, null, CommandType.Text, out col));
        }
Beispiel #15
0
        public int ExecuteNonQuery(string strQuery, FbParameter paramArray, CommandType cmdType)
        {
            FbParameterCollection col = null;

            return(ExecuteNonQuery(strQuery, paramArray, cmdType, out col));
        }
Beispiel #16
0
        public int ExecuteNonQuery(string strQuery)
        {
            FbParameterCollection col = null;

            return(ExecuteNonQuery(strQuery, null, CommandType.Text, out col));
        }
Beispiel #17
0
        public int TransactionQuery(string strQuery, FbParameter[] paramArray)
        {
            FbParameterCollection col = null;

            return(TransactionQuery(strQuery, paramArray, CommandType.Text, out col));
        }
Beispiel #18
0
        public DataSet TransactionFill(string strQuery, string strAlias, DataSet dsDataSet, FbParameter[] paramArray, CommandType cmdType)
        {
            FbParameterCollection col = null;

            return(TransactionFill(strQuery, strAlias, dsDataSet, paramArray, cmdType, out col));
        }
Beispiel #19
0
        public DataSet TransactionFill(string strQuery)
        {
            FbParameterCollection col = null;

            return(TransactionFill(strQuery, null, null, null, CommandType.Text, out col));
        }