1 | #Region "Microsoft.VisualBasic::f119dee79c9d64600934665b9aac74c3, Microsoft.VisualBasic.Core\ComponentModel\DataSource\SchemaMaps\SQL.vb" |
2 | |
3 | ' Author: |
4 | ' |
5 | ' asuka (amethyst.asuka@gcmodeller.org) |
6 | ' xie (genetics@smrucc.org) |
7 | ' xieguigang (xie.guigang@live.com) |
8 | ' |
9 | ' Copyright (c) 2018 GPL3 Licensed |
10 | ' |
11 | ' |
12 | ' GNU GENERAL PUBLIC LICENSE (GPL3) |
13 | ' |
14 | ' |
15 | ' This program is free software: you can redistribute it and/or modify |
16 | ' it under the terms of the GNU General Public License as published by |
17 | ' the Free Software Foundation, either version 3 of the License, or |
18 | ' (at your option) any later version. |
19 | ' |
20 | ' This program is distributed in the hope that it will be useful, |
21 | ' but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23 | ' GNU General Public License for more details. |
24 | ' |
25 | ' You should have received a copy of the GNU General Public License |
26 | ' along with this program. If not, see <http://www.gnu.org/licenses/>. |
27 | |
28 | |
29 | |
30 | ' /********************************************************************************/ |
31 | |
32 | ' Summaries: |
33 | |
34 | ' Class SQLTable |
35 | ' |
36 | ' Function: Clone, Copy, ToString |
37 | ' |
38 | ' |
39 | ' /********************************************************************************/ |
40 | |
41 | #End Region |
42 | |
43 | Imports System.Runtime.CompilerServices |
44 | |
45 | Namespace ComponentModel.DataSourceModel.SchemaMaps |
46 | |
47 | ''' <summary> |
48 | ''' A generic abstract model of a SQL table. |
49 | ''' (SQL之中的一个数据表的抽象描述接口) |
50 | ''' </summary> |
51 | Public MustInherit Class SQLTable |
52 | Implements ICloneable |
53 | |
54 | ''' <summary> |
55 | ''' INSERT INTO table_name (field1, field2,...) VALUES (value1, value2,....) |
56 | ''' </summary> |
57 | ''' <returns></returns> |
58 | ''' <remarks>http://www.w3school.com.cn/sql/sql_insert.asp</remarks> |
59 | Public MustOverride Function GetInsertSQL() As String |
60 | ''' <summary> |
61 | ''' UPDATE table_name SET field = <new value> WHERE field = <value> |
62 | ''' </summary> |
63 | ''' <returns></returns> |
64 | ''' <remarks>http://www.w3school.com.cn/sql/sql_update.asp</remarks> |
65 | Public MustOverride Function GetUpdateSQL() As String |
66 | ''' <summary> |
67 | ''' DELETE FROM table_name WHERE field = value; |
68 | ''' </summary> |
69 | ''' <returns></returns> |
70 | ''' <remarks></remarks> |
71 | Public MustOverride Function GetDeleteSQL() As String |
72 | |
73 | ''' <summary> |
74 | ''' Display the INSERT INTO sql from function <see cref="GetInsertSQL"/>. |
75 | ''' </summary> |
76 | ''' <returns></returns> |
77 | ''' |
78 | <MethodImpl(MethodImplOptions.AggressiveInlining)> |
79 | Public Overrides Function ToString() As String |
80 | Return GetInsertSQL() |
81 | End Function |
82 | |
83 | ''' <summary> |
84 | ''' Clones the property values. |
85 | ''' (由于这个<see cref="SQLTable"/>对象的所有属性都是简单的基本类型,所以能够很容易 |
86 | ''' 的复制这些属性,从而很容易的复制数据表之中的一个行对象) |
87 | ''' </summary> |
88 | ''' <returns></returns> |
89 | ''' |
90 | <MethodImpl(MethodImplOptions.AggressiveInlining)> |
91 | Private Function Clone() As Object Implements ICloneable.Clone |
92 | Return MyClass.MemberwiseClone |
93 | End Function |
94 | |
95 | ''' <summary> |
96 | ''' MemberwiseClone |
97 | ''' </summary> |
98 | ''' <returns></returns> |
99 | ''' |
100 | <MethodImpl(MethodImplOptions.AggressiveInlining)> |
101 | Public Function Copy() As SQLTable |
102 | Return DirectCast(MyClass.MemberwiseClone, SQLTable) |
103 | End Function |
104 | End Class |
105 | End Namespace |