コード例 #1
0
ファイル: DBConstraint.cs プロジェクト: Siern/EveJournal
        public string BuildQueryString(string FieldName)
        {
            if (QueryConstraints.None == m_Constraint)
            {
                return("");
            }

            string ret = FieldName + " " + m_ConstraintStrings[(ulong)m_Constraint] + " ";

            //if (typeof(Int32) == m_Value1.GetType())
            //    ret += ((Int32)m_Value1).ToString();
            //else if (typeof(long) == m_Value1.GetType())
            //    ret += ((long)m_Value1).ToString();
            //else if (typeof(Double) == m_Value1.GetType())
            //    ret += ((Double)m_Value1).ToString();
            //else if (typeof(Decimal) == m_Value1.GetType())
            //    ret += ((Decimal)m_Value1).ToString();
            //else if (typeof(Boolean) == m_Value1.GetType())
            //    ret += ((Boolean)m_Value1) ? 1 : 0;
            //else
            //    ret += "\"" + m_Value1.ToString() + "\"";
            ret += DBConvert.ToDBString(m_Value1);

            if (QueryConstraints.Between == m_Constraint)
            {
                ret += " AND ";
            }
            else
            {
                return(ret);
            }

            //if (typeof(Int32) == m_Value2.GetType())
            //    ret += ((Int32)m_Value2).ToString();
            //else if (typeof(long) == m_Value2.GetType())
            //    ret += ((long)m_Value2).ToString();
            //else if (typeof(Double) == m_Value2.GetType())
            //    ret += ((Double)m_Value2).ToString();
            //else if (typeof(Decimal) == m_Value2.GetType())
            //    ret += ((Decimal)m_Value2).ToString();
            //else if (typeof(Boolean) == m_Value2.GetType())
            //    ret += ((Boolean)m_Value2) ? 1 : 0;
            //else
            //    ret += "\"" + m_Value2.ToString() + "\"";
            ret += DBConvert.ToDBString(m_Value2);
            return(ret);
        }