Skip to content

Commit 0b92376

Browse files
committed
prerelease 1.1
1 parent 78852cf commit 0b92376

10 files changed

+83
-106
lines changed

Connection.vb

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,22 @@
22
Imports MySql.Data.MySqlClient
33

44
Public Class Connection
5-
Inherits Databasic.Connection
6-
7-
Public Shared Shadows ClientName As String = "MySql.Data.MySqlClient"
8-
9-
Public Overrides Property Provider As DbConnection
10-
Get
11-
Return Me._provider
12-
End Get
13-
Set(value As DbConnection)
14-
Me._provider = value
15-
End Set
16-
End Property
17-
Private _provider As MySqlConnection
18-
19-
Public Overrides ReadOnly Property ProviderVersion As Version
20-
Get
21-
If Me._providerVersion Is Nothing Then
22-
Me._providerVersion = New Version(Me.Provider.ServerVersion)
23-
End If
24-
Return Me._providerVersion
25-
End Get
26-
End Property
27-
Private _providerVersion As Version = Nothing
28-
29-
Public Overrides Property StatementType As System.Type
30-
Get
31-
Return Me._statementType
32-
End Get
33-
Set(value As System.Type)
34-
Me._statementType = value
35-
End Set
36-
End Property
37-
Private _statementType As System.Type = GetType(Statement)
38-
39-
Public Overrides Property ResourceType As System.Type
40-
Get
41-
Return Me._resourceType
42-
End Get
43-
Set(value As System.Type)
44-
Me._resourceType = value
45-
End Set
46-
End Property
47-
Private _resourceType As System.Type = GetType(Resource)
48-
49-
Public Overrides Sub Open(dsn As String)
5+
Inherits Databasic.Connection
6+
7+
Public Overrides ReadOnly Property Provider As DbConnection
8+
Get
9+
Return Me._provider
10+
End Get
11+
End Property
12+
Private _provider As MySqlConnection
13+
14+
Public Overrides ReadOnly Property ProviderResource As System.Type = GetType(ProviderResource)
15+
16+
Public Overrides ReadOnly Property ClientName As String = "MySql.Data.MySqlClient"
17+
18+
Public Overrides ReadOnly Property Statement As System.Type = GetType(Statement)
19+
20+
Public Overrides Sub Open(dsn As String)
5021
Me._provider = New MySqlConnection(dsn)
5122
Me._provider.Open()
5223
AddHandler Me._provider.InfoMessage, AddressOf Connection.errorHandler

Databasic.MySql.nuspec

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata minClientVersion="2.6">
44
<id>Databasic.MySql</id>
5-
<version>1.0.0.0</version>
5+
<version>1.1.0.0</version>
66
<title>Databasic - MySql/MariaDb Package</title>
77
<authors>Tom Flidr</authors>
88
<owners>Tom Flidr</owners>
@@ -12,18 +12,16 @@
1212
<language>en-US</language>
1313
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1414
<description>
15-
Databasic - C#/VB.NET database utility
16-
- focusing on queries primarily based on pure SQL commands, no linq transations
17-
- arranging data into primitive types, typed active record classes, collections and more
18-
- allowing to run any nonselect queries
15+
C#/VB.NET database utility to write pure MySQL/MariaDB queries and load data into environment variables and instances.
1916
</description>
2017
<copyright>Copyright © 2017</copyright>
2118
<tags>sql mysql mariadb database query command select insert update delete dml tool utility</tags>
2219
<dependencies>
23-
<dependency id="System" version="4.0.0.0" />
20+
<!--dependency id="System" version="4.0.0.0" />
2421
<dependency id="System.Core" version="4.0.0.0" />
25-
<dependency id="System.Data" version="4.0.0.0" />
26-
<dependency id="Databasic" version="1.0.0.0" />
22+
<dependency id="System.Data" version="4.0.0.0" /-->
23+
<dependency id="MySql.Data" version="6.9.8.0" />
24+
<dependency id="Databasic.Core" version="1.1.0.0" />
2725
</dependencies>
2826
<releaseNotes>https://github.com/databasic-net/databasic/releases</releaseNotes>
2927
</metadata>

Databasic.MySql.vbproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
<HintPath>obj\MySql.Data.dll</HintPath>
4949
</Reference>
5050
<Reference Include="System" />
51-
<Reference Include="System.Data" />
5251
<Reference Include="System.Core" />
52+
<Reference Include="System.Data" />
5353
</ItemGroup>
5454
<ItemGroup>
5555
<Import Include="Microsoft.VisualBasic" />
@@ -78,7 +78,7 @@
7878
<DependentUpon>Settings.settings</DependentUpon>
7979
<DesignTimeSharedInput>True</DesignTimeSharedInput>
8080
</Compile>
81-
<Compile Include="Resource.vb" />
81+
<Compile Include="ProviderResource.vb" />
8282
<Compile Include="Statement.vb" />
8383
<Compile Include="Transaction.vb" />
8484
</ItemGroup>

My Project/AssemblyInfo.vb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Imports System.Runtime.InteropServices
2121
<Assembly: ComVisible(False)>
2222

2323
'The following GUID is for the ID of the typelib if this project is exposed to COM
24-
<Assembly: Guid("45e14f35-617d-4133-a637-4ab8ba2246d1")>
24+
<Assembly: Guid("45e14f35-617d-4133-a637-4ab8ba2246d1")>
2525

2626
' Version information for an assembly consists of the following four values:
2727
'
@@ -34,5 +34,5 @@ Imports System.Runtime.InteropServices
3434
' by using the '*' as shown below:
3535
' <Assembly: AssemblyVersion("1.0.*")>
3636

37-
<Assembly: AssemblyVersion("1.0.0.0")>
38-
<Assembly: AssemblyFileVersion("1.0.0.0")>
37+
<Assembly: AssemblyVersion("1.1.0.0")>
38+
<Assembly: AssemblyFileVersion("1.1.0.0")>

ProviderResource.vb

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Public Class ProviderResource
2+
Inherits Databasic.ProviderResource
3+
4+
Public Overrides Function GetTableColumns(table As String, connection As Databasic.Connection) As Dictionary(Of String, Boolean)
5+
Dim result As New Dictionary(Of String, Boolean)
6+
Dim rawData As Dictionary(Of String, String) = Databasic.Statement.Prepare("
7+
SELECT
8+
c.IS_NULLABLE,
9+
c.COLUMN_NAME
10+
FROM
11+
INFORMATION_SCHEMA.COLUMNS AS c
12+
WHERE
13+
c.TABLE_SCHEMA = @database AND
14+
c.TABLE_NAME = @table
15+
ORDER BY
16+
c.ORDINAL_POSITION
17+
", connection
18+
).FetchAll(New With {
19+
.database = connection.Provider.Database,
20+
.table = table
21+
}).ToDictionary(Of String, String)("COLUMN_NAME")
22+
Dim columnCouldBenull As Boolean
23+
For Each item In rawData
24+
columnCouldBenull = item.Value.ToUpper().IndexOf("NO") = -1
25+
result.Add(item.Key, columnCouldBenull)
26+
Next
27+
Return result
28+
End Function
29+
30+
Public Overrides Function GetLastInsertedId(ByRef transaction As Databasic.Transaction, Optional ByRef classMetaDescription As MetaDescription = Nothing) As Object
31+
Return Databasic.Statement.Prepare("SELECT LAST_INSERT_ID()", transaction).FetchOne().ToInstance(Of Object)()
32+
End Function
33+
34+
'Public Overrides Function GetAll(
35+
' connection As Databasic.Connection,
36+
' columns As String,
37+
' table As String,
38+
' Optional offset As Int64? = Nothing,
39+
' Optional limit As Int64? = Nothing,
40+
' Optional orderByStatement As String = ""
41+
' ) As Databasic.Statement
42+
' Dim sql = $"SELECT {columns} FROM {table}"
43+
' offset = If(offset, 0)
44+
' limit = If(limit, 0)
45+
' If limit > 0 Then
46+
' sql += If(orderByStatement.Length > 0, " ORDER BY " + orderByStatement, "") +
47+
' $" LIMIT {If(limit = 0, "18446744073709551615", limit.ToString())} OFFSET {offset}"
48+
' End If
49+
' Return Databasic.Statement.Prepare(sql, connection).FetchAll()
50+
'End Function
51+
52+
End Class

Resource.vb

Lines changed: 0 additions & 44 deletions
This file was deleted.

content/App.config.install.xdt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<clear xdt:Transform="InsertIfMissing" />
55
<add
66
name="Databasic.Example.MySql"
7-
connectionString="server=127.0.0.1;uid=USER_NAME;pwd=1234;database=PASSWORD;"
7+
connectionString="server=127.0.0.1;port=3306;uid=USER_NAME;pwd=PASSWORD;database=DATABASE;"
88
providerName="MySql.Data.MySqlClient"
99
xdt:Transform="InsertIfMissing"
1010
xdt:Locator="Match(name)" />

content/App.config.uninstall.xdt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<connectionStrings>
44
<add
55
name="Databasic.Example.MySql"
6-
connectionString="server=127.0.0.1;uid=USER_NAME;pwd=1234;database=PASSWORD;"
6+
connectionString="server=127.0.0.1;port=3306;uid=USER_NAME;pwd=PASSWORD;database=DATABASE;"
77
providerName="MySql.Data.MySqlClient"
88
xdt:Transform="Remove"
99
xdt:Locator="Match(name)" />

content/Web.config.install.xdt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<clear xdt:Transform="InsertIfMissing" />
55
<add
66
name="Databasic.Example.MySql"
7-
connectionString="server=127.0.0.1;uid=USER_NAME;pwd=1234;database=PASSWORD;"
7+
connectionString="server=127.0.0.1;port=3306;uid=USER_NAME;pwd=PASSWORD;database=DATABASE;"
88
providerName="MySql.Data.MySqlClient"
99
xdt:Transform="InsertIfMissing"
1010
xdt:Locator="Match(name)" />

content/Web.config.uninstall.xdt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<connectionStrings>
44
<add
55
name="Databasic.Example.MySql"
6-
connectionString="server=127.0.0.1;uid=USER_NAME;pwd=1234;database=PASSWORD;"
6+
connectionString="server=127.0.0.1;port=3306;uid=USER_NAME;pwd=PASSWORD;database=DATABASE;"
77
providerName="MySql.Data.MySqlClient"
88
xdt:Transform="Remove"
99
xdt:Locator="Match(name)" />

0 commit comments

Comments
 (0)