mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
MySqlExceptionSorter support oceanbase
This commit is contained in:
@@ -58,6 +58,10 @@ public class MySqlExceptionSorter implements ExceptionSorter {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (errorCode >= -10000 && errorCode <= -9000) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.alibaba.druid.bvt.pool.vendor;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.pool.vendor.MySqlExceptionSorter;
|
||||
|
||||
|
||||
public class MySqlExceptionSorterTest extends TestCase {
|
||||
public void test_true() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("", "", 1040)));
|
||||
}
|
||||
|
||||
public void test_true_1() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("", "", 1042)));
|
||||
}
|
||||
|
||||
public void test_true_2() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("", "08xx", 0)));
|
||||
}
|
||||
|
||||
public void test_false_2() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
Assert.assertFalse(sorter.isExceptionFatal(new SQLException("", null, 0)));
|
||||
}
|
||||
|
||||
public void test_false() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
Assert.assertFalse(sorter.isExceptionFatal(new SQLException("", "", -10001)));
|
||||
}
|
||||
|
||||
public void test_false_1() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
Assert.assertFalse(sorter.isExceptionFatal(new SQLException("", "", -8000)));
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.alibaba.druid.bvt.pool.vendor;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.pool.vendor.MySqlExceptionSorter;
|
||||
|
||||
|
||||
public class MySqlExceptionSorterTest_oceanbase extends TestCase {
|
||||
public void test_true() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("", "", -9000)));
|
||||
}
|
||||
|
||||
public void test_true_1() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
Assert.assertTrue(sorter.isExceptionFatal(new SQLException("", "", -10000)));
|
||||
}
|
||||
|
||||
public void test_false() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
Assert.assertFalse(sorter.isExceptionFatal(new SQLException("", "", -10001)));
|
||||
}
|
||||
|
||||
public void test_false_1() throws Exception {
|
||||
MySqlExceptionSorter sorter = new MySqlExceptionSorter();
|
||||
Assert.assertFalse(sorter.isExceptionFatal(new SQLException("", "", -8000)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user