Example #1
0
        private Insert Init(TableSchema.Table table)
        {
            if (table == null)
            {
                throw new SqlQueryException("Can't find the table schema - please specify the provider if there is more than one, or check the spelling");
            }

            if (SelectColumnList.Count == 0)
            {
                string columnList = table.GetDelimitedColumnList(",", false, true);
                SelectColumnList.AddRange(columnList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
                //SelectColumns = columnList;
            }
            else
            {
                bool          isFirst = true;
                StringBuilder sb      = new StringBuilder();
                foreach (string s in SelectColumnList)
                {
                    if (!isFirst)
                    {
                        sb.Append(",");
                    }
                    sb.Append(s);

                    isFirst = false;
                }
                //SelectColumns = sb.ToString();
            }

            if (Table == null)
            {
                Table = table;
            }

            provider = table.Provider;
            return(this);
        }