public SharpQueryNodeViewRoot(AbstractSharpQuerySchemaClass databaseclass)
     : base(databaseclass)
 {
     this.ImageIndex         = 4;
     this.SelectedImageIndex = 4;
 }
 public SharpQueryNodeProcedureRoot(AbstractSharpQuerySchemaClass databaseclass)
     : base(databaseclass)
 {
     this.ImageIndex         = 5;
     this.SelectedImageIndex = 5;
 }
        ///<summary>
        /// Update <see cref="System.Data.DataRow">row</see>'s fields into the current opened database.
        /// <param name="row">a <see cref="System.Data.DataRow">row</see> </param>
        /// <param name="schema"> a <see cref="SharpQuery.SchemaClass.ISchema">schema</see> </param>
        /// <remarks> it use a transaction for each row, so it's a very long process
        /// if you should update something like 10 000 lines ;o). It's used only by the DataView.
        /// If you need a better way write a "BatchUpdate" function
        /// </remarks>
        ///</summary>
        public void UpDateRow(ISchemaClass schema, DataRow row)
        {
            if (schema == null)
            {
                throw new System.ArgumentNullException("schema");
            }

            if (row == null)
            {
                throw new System.ArgumentNullException("row");
            }

            string SQLUpdate = this.UPDATE + " ";
            string SQLWhere  = this.WHERE + " ";
            string SQLValues = this.SET + " ";

            SQLUpdate += schema.Name;
            SQLUpdate += " ";

            foreach (DataColumn column in row.Table.Columns)
            {
                if (column.ReadOnly == false &&
                    column.AutoIncrement == false
                    )
                {
                    SQLValues += schema.Name + "." + AbstractSharpQuerySchemaClass.CheckWhiteSpace(column.ColumnName);
                    SQLValues += "=";
                    if (column.DataType.Equals(System.Type.GetType("System.String")) ||
                        column.DataType.Equals(System.Type.GetType("System.Char"))
                        )
                    {
                        SQLValues += "'";
                    }
                    SQLValues += row[column.ColumnName];
                    if (column.DataType.Equals(System.Type.GetType("System.String")) ||
                        column.DataType.Equals(System.Type.GetType("System.Char"))
                        )
                    {
                        SQLValues += "'";
                    }

                    SQLValues += ",";
                }

                SQLWhere += SharpQuery.SchemaClass.AbstractSharpQuerySchemaClass.CheckWhiteSpace(column.ColumnName);
                SQLWhere += "=";
                if (column.DataType.Equals(System.Type.GetType("System.String")) ||
                    column.DataType.Equals(System.Type.GetType("System.Char"))
                    )
                {
                    SQLWhere += "'";
                }
                SQLWhere += row[column.ColumnName, DataRowVersion.Original];
                if (column.DataType.Equals(System.Type.GetType("System.String")) ||
                    column.DataType.Equals(System.Type.GetType("System.Char"))
                    )
                {
                    SQLWhere += "'";
                }

                if (row.Table.Columns.IndexOf(column) != (row.Table.Columns.Count - 1))
                {
                    SQLWhere += " " + this.AND + " ";
                }
            }

            SQLValues = SQLValues.TrimEnd(new Char[] { ',' });

            this.ExecuteSQL(SQLUpdate + SQLValues + SQLWhere, 0);
            row.AcceptChanges();
        }