Пример #1
0
 /// <summary>
 /// Creates a table with a prefix and a name, deault columns name_id and name_name
 /// </summary>
 /// <param name="prefix">Prefix to prepend to the table name (not column names)</param>
 /// <param name="name">Table name to create and fill</param>
 /// <param name="add_default_columns">Option to add default _id and _name column</param>
 /// <param name="auto_fill">Option to auto create/fill table with data</param>
 public MySQLDataTable(DsnConnection dsn          = null
                       , string prefix            = null
                       , string name              = null
                       , bool add_default_columns = false
                       , bool trim_info           = false
                       , bool auto_fill           = false
                       , bool live_update_dsn     = false
                       , string fill_query        = null
                       )
 {
     this.connection = dsn;
     this.live       = live_update_dsn;
     this.TableName  = (name == null)? "" :name;
     this.Prefix     = (prefix == null) ? "" : prefix;
     Init();
     if (add_default_columns && name != null)
     {
         AddDefaultColumns(trim_info);
     }
     if (auto_fill)
     {
         if (this.FullTableName != "")
         {
             DsnSQLUtil.CreateDataTable(connection, this);
         }
         if (fill_query != null)
         {
             Fill(fill_query, 0);
         }
         else
         {
             Fill();
         }
     }
 }
Пример #2
0
 public RatedGameConfigurator(ScheduleDataSet schedule)
 {
     this.schedule = schedule;
     game_config   = new GameConfiguration(schedule);
     DsnSQLUtil.CreateDataTable(schedule.schedule_dsn, game_config);
     InitializeComponent();
 }
Пример #3
0
 /// <summary>
 /// Creates a table with the name, a auto increment column name_id, and a name column name_name
 /// </summary>
 /// <param name="name">Name of the table to create and fill</param>
 public MySQLDataTable(string name)
 {
     this.TableName = name;
     Init();
     AddDefaultColumns(false);
     DsnSQLUtil.CreateDataTable(connection, this);
     Fill();
 }
Пример #4
0
 /// <summary>
 /// Creates a table with a prefix and a name, deault columns name_id and name_name
 /// </summary>
 /// <param name="prefix">Prefix to prepend to the table name (not column names)</param>
 /// <param name="name">Table name to create and fill</param>
 public MySQLDataTable(string prefix, string name)
 {
     this.TableName = name;
     this.Prefix    = (prefix == null)?"":prefix;
     Init();
     AddDefaultColumns(false);
     DsnSQLUtil.CreateDataTable(connection, this);
     Fill();
 }
Пример #5
0
 /// <summary>
 /// Replaces the current connection with the passed connection, and invokes Fill.
 /// </summary>
 /// <param name="new_connection"></param>
 public void Reconnect(DsnConnection new_connection)
 {
     connection = new_connection;
     this.BeginLoadData();
     Clear();
     DsnSQLUtil.CreateDataTable(connection, this);
     Fill();
     this.EndLoadData();
 }
Пример #6
0
        public MySQLNameTable(string prefix, string name, DsnConnection dsn)
            : base(dsn, prefix, name)
        {
            DataColumn dc = this.Columns.Add(XDataTable.Name(this), typeof(string));

            dc.Unique = true;

            DsnSQLUtil.CreateDataTable(connection, this);
            Fill();
        }
Пример #7
0
        public MySQLNameTable(string prefix, string name, bool trim_info)
            : base(null, prefix, name, true, true)
        {
            DataColumn dc = this.Columns.Add(XDataTable.Name(this), typeof(string));

            dc.Unique = true;

            DsnSQLUtil.CreateDataTable(connection, this);
            Fill();
        }
Пример #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            DsnConnection source  = new DsnConnection(textBox1.Text);
            DsnConnection dest    = new DsnConnection(textBox2.Text);
            BingoTracking dataset = new BingoTracking();

            DsnSQLUtil.CreateDataTable(dest, dataset);
            DsnSQLUtil.FillDataSet(source, dataset);
            DsnSQLUtil.AppendToDatabase(dest, dataset);
            //DsnSQLUtil.
        }
Пример #9
0
 /// <summary>
 /// Creates a table with a prefix and a name, deault columns name_id and name_name
 /// </summary>
 /// <param name="prefix">Prefix to prepend to the table name (not column names)</param>
 /// <param name="name">Table name to create and fill</param>
 /// <param name="strip_info_on_id">True to remove trailing _info from tablename for id column</param>
 public MySQLDataTable(string name, bool auto_fill, bool strip_info_on_id)
 {
     this.TableName = name;
     Init();
     AddDefaultColumns(strip_info_on_id);
     if (auto_fill)
     {
         DsnSQLUtil.CreateDataTable(connection, this);
         Fill();
     }
 }
Пример #10
0
 /// <summary>
 /// Creates a table with a prefix and a name, deault columns name_id and name_name
 /// </summary>
 /// <param name="prefix">Prefix to prepend to the table name (not column names)</param>
 /// <param name="name">Table name to create and fill</param>
 /// <param name="add_default_columns">Option to add default _id and _name column</param>
 /// <param name="auto_fill">Option to auto create/fill table with data</param>
 public MySQLDataTable(string prefix, string name, bool trim_info, bool auto_fill)
 {
     this.TableName = name;
     this.Prefix    = (prefix == null) ? "" : prefix;
     Init();
     AddDefaultColumns(trim_info);
     if (auto_fill)
     {
         DsnSQLUtil.CreateDataTable(connection, this);
         Fill();
     }
 }
Пример #11
0
        public MySQLNameTable(bool auto_fill, string prefix, string name)
            : base(null, prefix, name, true, true)
        {
            DataColumn dc = this.Columns.Add(NameColumn, typeof(string));

            dc.Unique = true;
            if (auto_fill)
            {
                DsnSQLUtil.CreateDataTable(connection, this);
                Fill();
            }
        }
Пример #12
0
 public MySQLDataTable(DsnConnection dsn, DataTable table)
 {
     // copy table into myself...
     connection = dsn;
     TableName  = table.TableName;
     Prefix     = table.Prefix;
     foreach (DataColumn dc in table.Columns)
     {
         Columns.Add(dc);
     }
     DsnSQLUtil.CreateDataTable(connection, this);
 }
Пример #13
0
 public MySQLNameTable(DsnConnection dsn, string prefix, string name, bool trim_info, bool auto_fill, bool simple_name)
     : base(dsn, prefix, name, true, trim_info, false)
 {
     // otherwise non-simple will be added by base initilalizer.
     if (simple_name)
     {
         DataColumn dc = this.Columns.Add(simple_name ? "name" : XDataTable.Name(this), typeof(string));
         dc.Unique = true;
     }
     if (auto_fill)
     {
         DsnSQLUtil.CreateDataTable(connection, this);
         Fill();
     }
 }
Пример #14
0
 /// <summary>
 /// Replaces the current connection with the passed connection, and invokes Fill.
 /// </summary>
 /// <param name="new_connection"></param>
 /// <param name="fill">if set, will invoke Fill()</param>
 /// <param name="sync">if set, will sync to database (relation table, probably the current relations more accurate</param>
 public void Reconnect(DsnConnection new_connection, bool fill, bool sync)
 {
     connection = new_connection;
     DsnSQLUtil.CreateDataTable(connection, this);
     if (fill)
     {
         this.BeginLoadData();
         Clear();
         Fill();
         this.EndLoadData();
     }
     else if (sync)
     {
         SyncToDatabase(new_connection);
     }
 }
Пример #15
0
 public void SetConnection(DsnConnection dsn, bool auto_create)
 {
     if (connection == null)
     {
         connection = dsn;
         if (dsn != null)
         {
             if (auto_create)
             {
                 DsnSQLUtil.CreateDataTable(connection, this);
             }
         }
     }
     else
     {
         connection = dsn;
         if (auto_create)
         {
             DsnSQLUtil.CreateDataTable(connection, this);
         }
     }
 }
Пример #16
0
 /// <summary>
 /// Just a wrapper for Create() and Fill().
 /// </summary>
 public void LoadMySQLDataTable()
 {
     DsnSQLUtil.CreateDataTable(connection, this);
     Fill();
 }
Пример #17
0
 public static void Store(DsnConnection dsn)
 {
     DsnSQLUtil.CreateDataTable(dsn, storage);
     DsnSQLUtil.CommitChanges(dsn, storage);
 }