Пример #1
0
        public bool ExcuteSchema()
        {
            string    Create_Query = "";
            DataTable Schema       = SBLL.GetSchema(Connection.getDataBaseName());

            for (int i = 0; i < Schema.Rows.Count; i++)
            {
                Create_Query += "CREATE TABLE";
                string Table = Schema.Rows[i]["Org_Table"].ToString();
                Create_Query += " " + Table;
                Create_Query += "(";
                Create_Query += Environment.NewLine;
                while (i < Schema.Rows.Count && Schema.Rows[i]["Org_Table"].ToString() == Table)
                {
                    Create_Query += Schema.Rows[i]["Attribute"].ToString();
                    Create_Query += " " + Schema.Rows[i]["DataType"].ToString();
                    if (Schema.Rows[i]["Is_Nullable"].ToString() == "NO")
                    {
                        Create_Query += " " + "NOT NULL";
                    }
                    else
                    {
                        Create_Query += " " + "NULL";
                    }
                    i++;
                    if (i < Schema.Rows.Count)
                    {
                        if (Schema.Rows[i]["Org_Table"].ToString() == Table)
                        {
                            Create_Query += ",";
                        }
                    }

                    Create_Query += Environment.NewLine;
                }
                i--;
                Create_Query += ");";
                Create_Query += Environment.NewLine + Environment.NewLine;
            }

            return(ABLL.ExcuteSchema(Create_Query));
        }
Пример #2
0
        public void MigrateData()
        {
            string    Attributes = "";
            DataTable Schema     = SBLL.GetSchema(Connection.getDataBaseName());

            for (int i = 0; i < Schema.Rows.Count; i++)
            {
                string Table = Schema.Rows[i]["Org_Table"].ToString();
                while (i < Schema.Rows.Count && Schema.Rows[i]["Org_Table"].ToString() == Table)
                {
                    Attributes += Schema.Rows[i]["Attribute"].ToString();
                    i++;

                    if (i < Schema.Rows.Count)
                    {
                        if (Schema.Rows[i]["Org_Table"].ToString() == Table)
                        {
                            Attributes += ",";
                        }
                    }
                }
                i--;
                DataTable Data = ExtractData(Attributes, Table);
                if (Data.Rows.Count > 0)
                {
                    if (CompressData(Data, Table))
                    {
                        UploadData(Data, Attributes, Table);
                        Attributes = "";
                    }
                }
            }
            string        directoryPath     = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\Compression\";
            DirectoryInfo directorySelected = new DirectoryInfo(directoryPath);

            Compress(directorySelected, directoryPath);
        }