internal OrionUpdateQuery(OrionDatabase parentOrionDatabase, String tableName, String whereClause, params String[] fieldNames)
            : base(parentOrionDatabase)
        {
            StringBuilder strQueryString, strSet;

            strQueryString = new StringBuilder("UPDATE " + tableName);
            strSet         = new StringBuilder(" SET ");

            foreach (String strFieldNameTemp in fieldNames)
            {
                strSet.Append(strFieldNameTemp + "=");
                strSet.Append(this.ParentOrionDatabase.ParameterCharacter + strFieldNameTemp + ",");
            }

            strQueryString.Append(strSet.ToString().Trim(','));
            if (String.IsNullOrWhiteSpace(whereClause) == false)
            {
                whereClause = OrionQuery.TrimWhereClause(whereClause);
                strQueryString.Append(" WHERE " + whereClause);
            }
            this.QueryString = strQueryString.ToString();

            this.QueryType = QueryTypes.Update;

            this.m_xCommand = this.ParentOrionDatabase.CreateCommand(this.QueryString);

            foreach (String strFieldNameTemp in fieldNames)
            {
                this.AddParameter(strFieldNameTemp, null);
            }
        }// OrionUpdateQuery()
Example #2
0
        internal OrionDeleteQuery(OrionDatabase parentXDatabase, String tableName, String whereClause)
            : base(parentXDatabase)
        {
            StringBuilder strQueryString;


            strQueryString = new StringBuilder("DELETE FROM " + tableName);

            if (String.IsNullOrWhiteSpace(whereClause) == false)
            {
                whereClause = OrionQuery.TrimWhereClause(whereClause);
                strQueryString.Append(" WHERE " + whereClause);
            }
            this.QueryString = strQueryString.ToString();

            this.QueryType = QueryTypes.Delete;

            this.m_xCommand = this.ParentOrionDatabase.CreateCommand(this.QueryString);
        }// OrionDeleteQuery()
        internal OrionRowCountQuery(OrionDatabase parentXDatabase, String tableName, String whereClause = null)
            : base(parentXDatabase)
        {
            StringBuilder strQueryString;

            this.QueryType = QueryTypes.RowCount;

            strQueryString = new StringBuilder("SELECT COUNT(*) FROM " + tableName);

            if (String.IsNullOrWhiteSpace(whereClause) == false)
            {
                whereClause = OrionQuery.TrimWhereClause(whereClause);
                strQueryString.Append(" WHERE " + whereClause);
            }
            this.QueryString = strQueryString.ToString();

            if (this.xDataAdapter == null)
            {
                this.xDataAdapter = this.ParentOrionDatabase.CreateDataAdapter(this.QueryString);
            }
            this.xDataAdapter.MissingMappingAction      = MissingMappingAction.Passthrough;
            this.xDataAdapter.SelectCommand.Transaction = this.ParentOrionDatabase.Transaction;
        }// OrionRowCountQuery