///<summary> /// Extract Data from a Table or a View /// <param name="schema"> /// <see cref="SharpQuery.SchemaClass">SchemaClass</see> object. /// </param> /// <param name="rows"> /// Maximum number of row to extract. If is "0" then all rows are extracted. /// </param> /// <returns> return a <see cref="System.Data.DataTable">DataTable</see> ///or a <see cref="System.Data.DataSet">DataSet</see> object. /// </returns> /// </summary> public object ExtractData(ISchemaClass schema, int rows) { if (schema == null) { throw new System.ArgumentNullException("schema"); } string SQLSelect = this.SELECT + " "; string SQLFrom = this.FROM + " "; SharpQuerySchemaClassCollection entitieslist = null; SQLFrom += schema.Name; schema.Refresh(); //we have only a table or view :o) foreach (KeyValuePair <string, SharpQuerySchemaClassCollection> DicEntry in schema.Entities) { entitieslist = DicEntry.Value as SharpQuerySchemaClassCollection; break; } if (entitieslist == null) { throw new System.ArgumentNullException("entitieslist"); } foreach (ISchemaClass column in entitieslist) { SQLSelect += column.NormalizedName; SQLSelect += ","; } SQLSelect = SQLSelect.TrimEnd(new Char[] { ',' }); if (entitieslist.Count == 0) { SQLSelect += "*"; } SQLSelect += " "; return(this.ExecuteSQL(SQLSelect + SQLFrom, 0)); }
///<summary> /// Extract Data from a Table or a View /// <param name="schema"> /// <see cref="SharpQuery.SchemaClass">SchemaClass</see> object. /// </param> /// <param name="rows"> /// Maximum number of row to extract. If is "0" then all rows are extracted. /// </param> /// <returns> return a <see cref="System.Data.DataTable">DataTable</see> ///or a <see cref="System.Data.DataSet">DataSet</see> object. /// </returns> /// </summary> public object ExtractData(ISchemaClass schema, int rows) { if (schema == null) { throw new System.ArgumentNullException("schema"); } string SQLSelect = this.SELECT + " "; string SQLFrom = this.FROM + " "; SharpQuerySchemaClassCollection entitieslist = null; SQLFrom += schema.Name; schema.Refresh(); //we have only a table or view :o) foreach (KeyValuePair<string, SharpQuerySchemaClassCollection> DicEntry in schema.Entities) { entitieslist = DicEntry.Value as SharpQuerySchemaClassCollection; break; } if (entitieslist == null) { throw new System.ArgumentNullException("entitieslist"); } foreach (ISchemaClass column in entitieslist) { SQLSelect += column.NormalizedName; SQLSelect += ","; } SQLSelect = SQLSelect.TrimEnd(new Char[] { ',' }); if (entitieslist.Count == 0) { SQLSelect += "*"; } SQLSelect += " "; return this.ExecuteSQL(SQLSelect + SQLFrom, 0); }