Franken_.App_Code.DataPipe.GetNewID C# (CSharp) Method

GetNewID() public method

public GetNewID ( string TableName ) : string
TableName string
return string
        public string GetNewID(string TableName)
        {
            string NewID = "0";

            ExecuteCommand("update `keys` set keys_max = keys_max + 1 where keys_table = '" + TableName + "'");
            if (GetRows("select keys_max from `keys` where keys_table = '" + TableName + "'"))
            {
                NewID = Bucket.Rows[0][0].ToString();
            }

            return NewID;
        }

Usage Example

Example #1
0
        public void Save(bool IncludeChildren)
        {
            if (this.ID == "")
            {
                this.ID = db.GetNewID("glyphs");
                db.ExecuteCommand("insert into glyphs (glyph_id, glyph_font_id, glyph_unicode, glyph_frequency, glyph_x_offset, glyph_y_offset) values (" + this.ID + ", " + this.FontID + ", '" + db.FixString(this.Unicode) + "', " + this.Frequency + ", " + this.XOffset + ", " + this.YOffset + ")");
            }
            else
            {
                db.ExecuteCommand("update glyphs set glyph_font_id = " + this.FontID + ", " +
                                  "glyph_unicode = '" + db.FixString(this.Unicode) + "', " +
                                  "glyph_frequency = " + this.Frequency + ", " +
                                  "glyph_x_offset = " + this.XOffset + ", " +
                                  "glyph_y_offset = " + this.YOffset + " " +
                                  "where glyph_id = " + this.ID);

                if (this.Images != null && IncludeChildren)
                {
                    for (int x = 0; x < this.Images.Count; x++)
                    {
                        this.Images[x].Save();
                    }
                }
            }
        }
All Usage Examples Of Franken_.App_Code.DataPipe::GetNewID