Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit 1f14fd3

Browse files
author
Chris Board
committed
Fixed issue where certain MySQL Servers contain non numeric characters in the version number which caused a NumberFormatException. E.g. 5.7.22-log
Added global variable called "publishToMavenLocal" so you can publish it to a local maven repository for local testing and linking to your own app, until ready for committing to GitHub.
1 parent 8b4f5ea commit 1f14fd3

File tree

2 files changed

+54
-5
lines changed

2 files changed

+54
-5
lines changed

AndroidMySQLConnector/build.gradle

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,37 @@
1+
2+
13
buildscript {
4+
repositories {
5+
if (rootProject.ext.publishToMavenLocal) {
6+
7+
mavenLocal()
8+
}
9+
}
210
}
311

412
apply plugin: 'com.android.library'
5-
apply plugin: 'com.github.dcendents.android-maven'
13+
if (rootProject.ext.publishToMavenLocal)
14+
{
15+
apply plugin: 'maven-publish'
16+
}
17+
else
18+
{
19+
apply plugin: 'com.github.dcendents.android-maven'
20+
}
621

722
archivesBaseName="AndroidMySQLConnector"
8-
version '0.22'
23+
version '0.23'
924
group 'com.BoardiesITSolutions'
1025

26+
1127
android {
1228
compileSdkVersion 27
1329
defaultConfig {
1430
//applicationId "com.BoardiesITSolutions.AndroidMySQLConnector"
1531
minSdkVersion 19
1632
targetSdkVersion 27
17-
versionCode 8
18-
versionName "0.22"
33+
versionCode 9
34+
versionName "0.23"
1935
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
2036
}
2137
buildTypes {
@@ -29,15 +45,47 @@ android {
2945
abortOnError false
3046
}
3147

48+
49+
if (rootProject.ext.publishToMavenLocal) {
50+
android.libraryVariants
51+
52+
publishing {
53+
publications {
54+
maven(MavenPublication)
55+
{
56+
artifact getArtifactFullPath()
57+
}
58+
}
59+
}
60+
61+
libraryVariants.all { variant ->
62+
variant.outputs.all { output ->
63+
def outputFile = output.outputFile
64+
if (outputFile != null && outputFile.name.endsWith('.aar')) {
65+
def fileName = "${archivesBaseName}-${version}.aar"
66+
//output.outputFile = new File(outputFile.parent, fileName)
67+
outputFileName = fileName
68+
}
69+
}
70+
}
71+
}
72+
3273
repositories {
33-
mavenLocal()
74+
if (rootProject.ext.publishToMavenLocal)
75+
{
76+
mavenLocal()
77+
}
3478
jcenter()
3579
maven {
3680
url "https://maven.google.com"
3781
}
3882
}
3983
}
4084

85+
def getArtifactFullPath() {
86+
return ".//build/outputs/aar/${archivesBaseName}-${project.version}.aar"
87+
}
88+
4189
dependencies {
4290
implementation fileTree(dir: 'libs', include: ['*.jar'])
4391
implementation 'com.android.support:appcompat-v7:27.1.1'

AndroidMySQLConnector/src/main/java/com/BoardiesITSolutions/AndroidMySQLConnector/Connection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,7 @@ public Statement createStatement()
773773

774774
private void parseVersionNumber()
775775
{
776+
this.serverVersion = this.serverVersion.replaceAll("[^\\d.]", "");
776777
if ((this.serverVersion != null) && this.serverVersion.length() > 0)
777778
{
778779
String[] versions = this.serverVersion.split("\\.");

0 commit comments

Comments
 (0)