mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser.
This commit is contained in:
@@ -25,15 +25,8 @@ import java.io.Closeable;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.net.URL;
|
||||
import java.sql.Connection;
|
||||
import java.sql.*;
|
||||
import java.sql.Date;
|
||||
import java.sql.Driver;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Types;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -117,6 +110,30 @@ public final class JdbcUtils implements JdbcConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static void close(Blob x) {
|
||||
if (x == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
x.free();
|
||||
} catch (Exception e) {
|
||||
LOG.debug("close error", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void close(Clob x) {
|
||||
if (x == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
x.free();
|
||||
} catch (Exception e) {
|
||||
LOG.debug("close error", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void printResultSet(ResultSet rs) throws SQLException {
|
||||
printResultSet(rs, System.out);
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public class Utils {
|
||||
if (className == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
return Class.forName(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
@@ -236,7 +236,7 @@ public class Utils {
|
||||
/**
|
||||
* murmur hash 2.0, The murmur hash is a relatively fast hash function from http://murmurhash.googlepages.com/ for
|
||||
* platforms with efficient multiplication.
|
||||
*
|
||||
*
|
||||
* @author Viliam Holub
|
||||
*/
|
||||
public static long murmurhash2_64(final byte[] data, int length, int seed) {
|
||||
@@ -250,13 +250,13 @@ public class Utils {
|
||||
for (int i = 0; i < length8; i++) {
|
||||
final int i8 = i * 8;
|
||||
long k = ((long) data[i8 + 0] & 0xff) //
|
||||
+ (((long) data[i8 + 1] & 0xff) << 8) //
|
||||
+ (((long) data[i8 + 2] & 0xff) << 16)//
|
||||
+ (((long) data[i8 + 3] & 0xff) << 24) //
|
||||
+ (((long) data[i8 + 4] & 0xff) << 32)//
|
||||
+ (((long) data[i8 + 5] & 0xff) << 40)//
|
||||
+ (((long) data[i8 + 6] & 0xff) << 48) //
|
||||
+ (((long) data[i8 + 7] & 0xff) << 56);
|
||||
+ (((long) data[i8 + 1] & 0xff) << 8) //
|
||||
+ (((long) data[i8 + 2] & 0xff) << 16)//
|
||||
+ (((long) data[i8 + 3] & 0xff) << 24) //
|
||||
+ (((long) data[i8 + 4] & 0xff) << 32)//
|
||||
+ (((long) data[i8 + 5] & 0xff) << 40)//
|
||||
+ (((long) data[i8 + 6] & 0xff) << 48) //
|
||||
+ (((long) data[i8 + 7] & 0xff) << 56);
|
||||
|
||||
k *= m;
|
||||
k ^= k >>> r;
|
||||
|
||||
Reference in New Issue
Block a user