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

Commit 82533e1

Browse files
author
Chris Board
committed
Fixed issue where crash would happen if no rows were returned
1 parent 8b6aaad commit 82533e1

File tree

6 files changed

+19
-5
lines changed

6 files changed

+19
-5
lines changed
0 Bytes
Binary file not shown.

.idea/caches/gradle_models.ser

4.2 KB
Binary file not shown.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AndroidMySQLConnector/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ else
2020
}
2121

2222
archivesBaseName="AndroidMySQLConnector"
23-
version '0.36'
23+
version '0.37'
2424
group 'com.BoardiesITSolutions'
2525

2626

@@ -30,8 +30,8 @@ android {
3030
//applicationId "com.BoardiesITSolutions.AndroidMySQLConnector"
3131
minSdkVersion 19
3232
targetSdkVersion 29
33-
versionCode 26
34-
versionName "0.36"
33+
versionCode 27
34+
versionName "0.37"
3535
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3636
}
3737
buildTypes {

AndroidMySQLConnector/src/main/java/com/BoardiesITSolutions/AndroidMySQLConnector/PacketManager/COM_QueryResponse.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,20 @@ private void processPacketData()
172172
}
173173
//We've got an EOF packet but there's actually more data so not a true EOF packet so shift 9 bytes
174174
this.mysqlConn.getMysqlIO().shiftCurrentBytePosition(9);
175+
176+
//Now that we've shifted past the EOF, see if this packet type is now an EOF as if there are no results you can
177+
//get two EOF packets together
178+
packetType = this.mysqlConn.getMysqlIO().readCurrentByteWithoutShift() & 0xff;
179+
if (Helpers.getMySQLPacketTypeFromIntWithoutShift(packetType) == Helpers.MYSQL_PACKET_TYPE.MYSQL_OK_PACKET ||
180+
Helpers.getMySQLPacketTypeFromIntWithoutShift(packetType) == Helpers.MYSQL_PACKET_TYPE.MYSQL_EOF_PACKET)
181+
{
182+
if ((this.mysqlConn.getMysqlIO().getSocketDataLength() - this.mysqlConn.getMysqlIO().getCurrentBytesRead()) < 9)
183+
{
184+
finishedProcessingColumns = true;
185+
row = null;
186+
break;
187+
}
188+
}
175189
}
176190
ColumnDefinition columnDefinition = columnDefinitions.get(currentColumn);
177191
int lengthOfValue = this.mysqlConn.getMysqlIO().getLenEncodedInt();

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
buildscript {
55

66
ext {
7-
publishToMavenLocal = false
7+
publishToMavenLocal = true
88
}
99

1010
repositories {

0 commit comments

Comments
 (0)