📄 sharpqueryschemaclass.cs
字号:
public override object Execute( int rows, SharpQuerySchemaClassCollection parameters )
{
return this.Connection.ExtractData( this, rows );
}
///<summary> return a <see cref="System.Windows.Forms.DataObject">DataObject</see>
///</summary>
public override DataObject DragObject
{
get
{
string SQLSelect = "SELECT ";
string SQLFrom = "FROM ";
SharpQuerySchemaClassCollection entitieslist = null;
SQLFrom += this.Name;
this.Refresh();
//we have only a table or view :o)
foreach( DictionaryEntry DicEntry in 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[]{','} );
SQLSelect += " ";
DataObject returnValue = new DataObject();
returnValue.SetData(typeof(string) , SQLSelect + SQLFrom );
return returnValue;
}
}
}
///<summary>
/// View class
///</summary>
public class SharpQueryView : AbstractSharpQuerySchemaClass
{
public override string NormalizedName
{
get
{
if ( (this.CatalogName != "") && (this.CatalogName != null) )
{
return this.CatalogName + "." + this.Name;
}
else
{
return CheckWhiteSpace(this.Connection.GetProperty( AbstractSharpQueryConnectionWrapper.SharpQueryPropertyEnum.DataSource ).ToString()) + "." + this.Name;
}
}
}
protected override void CreateEntitiesList()
{
base.CreateEntitiesList();
this.pEntities.Add("VIEWS_COLUMNS", new SharpQuerySchemaClassCollection() );
}
public SharpQueryView( IConnection connection, string catalogName, string schemaName, string ownerName, string name ) : base(connection, catalogName, schemaName, ownerName, name )
{
}
public override SharpQuerySchemaClassCollection GetSchemaColumns()
{
return this.pDataConnection.GetSchemaViewColumns( this );
}
protected override void OnRefresh()
{
this.Entities["VIEWS_COLUMNS"].AddRange( this.GetSchemaColumns() );
}
///<summary>
/// For a Table or a View extract data.
/// For a stocked procedure, execute it :o).
/// <param name="rows">Number of row to extract. if "0", extract all rows.</param>
/// <returns><see cref="System.Data.DataTable">DataTable</see>
/// or a <see cref="System.Data.DataSet">DataSet</see> </returns>
/// </summary>
public override object Execute( int rows, SharpQuerySchemaClassCollection parameters )
{
return this.Connection.ExtractData( this, rows );
}
///<summary> return a <see cref="System.Windows.Forms.DataObject">DataObject</see>
///</summary>
public override DataObject DragObject
{
get
{
string SQLSelect = "SELECT ";
string SQLFrom = "FROM ";
SharpQuerySchemaClassCollection entitieslist = null;
SQLFrom += this.Name;
this.Refresh();
//we have only a table or view :o)
foreach( DictionaryEntry DicEntry in 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[]{','} );
SQLSelect += " ";
DataObject returnValue = new DataObject();
returnValue.SetData(typeof(string) , SQLSelect + SQLFrom );
return returnValue;
}
}
}
///<summary>
/// Class for unsupported functions
///</summary>
public class SharpQueryNotSupported : AbstractSharpQuerySchemaClass
{
protected override void CreateEntitiesList()
{
}
public SharpQueryNotSupported( IConnection connection, string catalogName, string schemaName, string ownerName, string name ) : base(connection, catalogName, schemaName, ownerName, name )
{
StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));
this.pName += " " + stringParserService.Parse("${res:SharpQuery.Error.NotSuported}") + " " + connection.Provider;
}
protected override void OnRefresh()
{
//nothing !
}
///<summary>
/// For a Table or a View extract data.
/// For a stocked procedure, execute it :o).
/// <param name="rows">Number of row to extract. if "0", extract all rows.</param>
/// <returns><see cref="System.Data.DataTable">DataTable</see>
/// or a <see cref="System.Data.DataSet">DataSet</see> </returns>
/// </summary>
public override object Execute( int rows, SharpQuerySchemaClassCollection parameters )
{
//nothing
return null;
}
}
///<summary>
/// Class lis of Tables
///</summary>
public class SharpQueryTables : AbstractSharpQuerySchemaClass
{
protected override void CreateEntitiesList()
{
base.CreateEntitiesList();
this.pEntities.Add("TABLES", new SharpQuerySchemaClassCollection() );
}
public SharpQueryTables( IConnection connection, string catalogName, string schemaName, string ownerName, string name ) : base(connection, catalogName, schemaName, ownerName, name )
{
StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));
this.pName = stringParserService.Parse("${res:SharpQuery.Label.TablesRoot}");
}
protected override void OnRefresh()
{
this.Entities["TABLES"].AddRange( this.GetSchemaTables() );
}
///<summary>
/// For a Table or a View extract data.
/// For a stocked procedure, execute it :o).
/// <param name="rows">Number of row to extract. if "0", extract all rows.</param>
/// <returns><see cref="System.Data.DataTable">DataTable</see>
/// or a <see cref="System.Data.DataSet">DataSet</see> </returns>
/// </summary>
public override object Execute( int rows, SharpQuerySchemaClassCollection parameters )
{
//nothing
return null;
}
}
///<summary>
/// Class lis of Views
///</summary>
public class SharpQueryViews : AbstractSharpQuerySchemaClass
{
protected override void CreateEntitiesList()
{
base.CreateEntitiesList();
this.pEntities.Add("VIEWS", new SharpQuerySchemaClassCollection() );
}
public SharpQueryViews( IConnection connection, string catalogName, string schemaName, string ownerName, string name ) : base(connection, catalogName, schemaName, ownerName, name )
{
StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));
this.pName = stringParserService.Parse("${res:SharpQuery.Label.ViewsRoot}");
}
protected override void OnRefresh()
{
this.Entities["VIEWS"].AddRange( this.GetSchemaViews() );
}
///<summary>
/// For a Table or a View extract data.
/// For a stocked procedure, execute it :o).
/// <param name="rows">Number of row to extract. if "0", extract all rows.</param>
/// <returns><see cref="System.Data.DataTable">DataTable</see>
/// or a <see cref="System.Data.DataSet">DataSet</see> </returns>
/// </summary>
public override object Execute( int rows, SharpQuerySchemaClassCollection parameters )
{
//nothing
return null;
}
}
///<summary>
/// Class lis of Procedures
///</summary>
public class SharpQueryProcedures : AbstractSharpQuerySchemaClass
{
protected override void CreateEntitiesList()
{
base.CreateEntitiesList();
this.pEntities.Add("PROCEDURES", new SharpQuerySchemaClassCollection() );
}
public SharpQueryProcedures( IConnection connection, string catalogName, string schemaName, string ownerName, string name ) : base(connection, catalogName, schemaName, ownerName, name )
{
StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));
this.pName = stringParserService.Parse("${res:SharpQuery.Label.ProceduresRoot}");
}
protected override void OnRefresh()
{
this.Entities["PROCEDURES"].AddRange( this.GetSchemaProcedures() );
}
///<summary>
/// For a Table or a View extract data.
/// For a stocked procedure, execute it :o).
/// <param name="rows">Number of row to extract. if "0", extract all rows.</param>
/// <returns><see cref="System.Data.DataTable">DataTable</see>
/// or a <see cref="System.Data.DataSet">DataSet</see> </returns>
/// </summary>
public override object Execute( int rows, SharpQuerySchemaClassCollection parameters )
{
//nothing
return null;
}
}
///<summary>
/// Class lis of Schemas
///</summary>
public class SharpQuerySchema : AbstractSharpQuerySchemaClass
{
protected override void CreateEntitiesList()
{
base.CreateEntitiesList();
this.pEntities.Add("TABLES", new SharpQuerySchemaClassCollection( new ISchemaClass[] { new SharpQueryTables(this.pDataConnection, this.CatalogName, this.Name, "", "") } ) );
this.pEntities.Add("VIEWS", new SharpQuerySchemaClassCollection( new ISchemaClass[] { new SharpQueryViews(this.pDataConnection, this.CatalogName, this.Name, "", "") } ) );
this.pEntities.Add("PROCEDURES", new SharpQuerySchemaClassCollection( new ISchemaClass[] { new SharpQueryProcedures(this.pDataConnection, this.CatalogName, this.Name, "", "") } ) );
}
public SharpQuerySchema( IConnection connection, string catalogName, string schemaName, string ownerName, string name ) : base(connection, catalogName, schemaName, ownerName, name )
{
}
protected override void OnRefresh()
{
// Nothing !
}
///<summary>
/// For a Table or a View extract data.
/// For a stocked procedure, execute it :o).
/// <param name="rows">Number of row to extract. if "0", extract all rows.</param>
/// <returns><see cref="System.Data.DataTable">DataTable</see>
/// or a <see cref="System.Data.DataSet">DataSet</see> </returns>
/// </summary>
public override object Execute( int rows, SharpQuerySchemaClassCollection parameters )
{
//nothing
return null;
}
///<summary> return a <see cref="System.Windows.Forms.DataObject">DataObject</see>
///</summary>
public override DataObject DragObject
{
get
{
DataObject returnValue = new DataObject();
string extract = NormalizedName;
returnValue.SetData(typeof(string) , extract );
return returnValue;
}
}
}
///<summary>
/// Class for a catalog
///</summary>
public class SharpQueryCatalog : AbstractSharpQuerySchemaClass
{
protected override void CreateEntitiesList()
{
base.CreateEntitiesList();
this.pEntities.Add("SCHEMAS", new SharpQuerySchemaClassCollection() );
}
public SharpQueryCatalog( IConnection connection, string catalogName, string schemaName, string ownerName, string name ) : base(connection, catalogName, schemaName, ownerName, name )
{
}
protected override void OnRefresh()
{
this.Entities["SCHEMAS"].AddRange( this.GetSchemaSchemas() );
}
///<summary>
/// For a Table or a View extract data.
/// For a stocked procedure, execute it :o).
/// <param name="rows">Number of row to extract. if "0", extract all rows.</param>
/// <returns><see cref="System.Data.DataTable">DataTable</see>
/// or a <see cref="System.Data.DataSet">DataSet</see> </returns>
/// </summary>
public override object Execute( int rows, SharpQuerySchemaClassCollection parameters )
{
//nothing
return null;
}
///<summary> return a <see cref="System.Windows.Forms.DataObject">DataObject</see>
///</summary>
public override DataObject DragObject
{
get
{
DataObject returnValue = new DataObject();
string extract = NormalizedName;
returnValue.SetData(typeof(string) , extract );
return returnValue;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -