DatabaseProcApplicationCreatedLinks
sybsystemprocssp_jdbc_getisolationlevels  31 Aug 14Defects Dependencies

1     /** SECTION END: CLEANUP **/
2     
3     /**
4      * 

This procedure is used to determine which transaction isolation 5 * levels are supported by this ASE server. This proc is registered 6 * with the spt_mda table to be executed when the user calls: 7 * DatabaseMetaData.supportsTransactionIsolationLevel(int) . 8 * If the int specified is found in the row returned by this procedure, 9 * then that level is supported. The levels are indicated by using the 10 * integer mappings found in the java.sql.Connection interface. 11 *

14 * 16 *

This procedure accesses the @@version string, determines the 17 * version of ASE, and returns the appropriate levels. 18 *

WARNING: Should future versions of ASE support more transaction 19 * isolation levels (e.g., TRANSACTION_REPEATABLE_READ (4)), this proc 20 * must be modified. 21 */ 22 23 create procedure sp_jdbc_getisolationlevels as 24 25 declare 26 @startVersion int, /* index of version # in @@version */ 27 @versionNum varchar(20), /* whole version number (eg 11.5.1) */ 28 @versionFloat float, /* major & minor ver # (eg 11.5) */ 29 @minorVersion varchar(15), /* minor version (eg 5.1) */ 30 @earliestVersion float, /* this ver supports READ_UNCOMMITTED */ 31 @firstDecimal int, /* index of 1st decimal point */ 32 @secondDecimal int, /* index of 2nd decimal point */ 33 @endVersion int /* index of end of version number */ 34 35 /* server must be at least 10.1.x to support levels 8, 2, AND 1. */ 36 select @earliestVersion = 10.1 37 38 /* find where the version number is in this mess of characters */ 39 select @startVersion = patindex('%/[0-9]%.%[0-9]/%', @@version) + 1 40 41 /* could not find version number in expected format within @@version */ 42 if (@startVersion <= 1) 43 begin 44 select 0 /* returning TRANSACTION_NONE */ 45 return 2 46 end 47 48 select @versionNum = substring(@@version, @startVersion, 20) 49 50 /* Find the first decimal point in this version number */ 51 select @firstDecimal = charindex('.', @versionNum) 52 53 /* extract the minor version and any "sub-minor" version (eg 5.1) */ 54 select @minorVersion = substring(@versionNum, @firstDecimal + 1, 15) 55 56 /* Find the second decimal point in this version number */ 57 /* if none found, then "pretend" to have one at the end */ 58 /* of the version number (where the "/" is) */ 59 60 select @secondDecimal = charindex('.', @minorVersion) 61 select @endVersion = charindex('/', @minorVersion) 62 if ((@secondDecimal = 0) or (@endVersion < @secondDecimal)) 63 select @secondDecimal = @endVersion 64 65 /* Compute major and minor versions as a float (eg "11.5" --> 11.5F) */ 66 select @versionFloat = convert(float, substring(@versionNum, 1, 67 @secondDecimal + @firstDecimal - 1)) 68 69 if (@versionFloat >= @earliestVersion) 70 select 8, 2, 1 71 else 72 select 8, 2 73 74 return (0) 75



exec sp_procxmode 'sp_jdbc_getisolationlevels', 'AnyMode'
go

Grant Execute on sp_jdbc_getisolationlevels to public
go
RESULT SETS
sp_jdbc_getisolationlevels_rset_003
sp_jdbc_getisolationlevels_rset_002
sp_jdbc_getisolationlevels_rset_001

DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_jdbc_getisolationlevels  
 MUCO 3 Useless Code Useless Brackets 42
 MUCO 3 Useless Code Useless Brackets 62
 MUCO 3 Useless Code Useless Brackets 69
 MUCO 3 Useless Code Useless Brackets 74
 QCRS 3 Conditional Result Set 44
 QCRS 3 Conditional Result Set 70
 QCRS 3 Conditional Result Set 72
 QNAM 3 Select expression has no name 0 44
 QNAM 3 Select expression has no name 1 70
 QNAM 3 Select expression has no name 2 70
 QNAM 3 Select expression has no name 8 70
 QNAM 3 Select expression has no name 2 72
 QNAM 3 Select expression has no name 8 72
 MRST 2 Result Set Marker 44
 MRST 2 Result Set Marker 70
 MRST 2 Result Set Marker 72
 MTR1 2 Metrics: Comments Ratio Comments: 56% 23
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 4dec - 2exi + 2 23
 MTR3 2 Metrics: Query Complexity Complexity: 23 23

DEPENDENCIES