| Database | Proc | Application | Created | Links |
| sybsystemprocs | sp_ijdbc_getxacoordinator | ![]() | 31 Aug 14 | Defects Dependencies |
1 2 /* 3 ** JDBC 2.0 extensions (JTA support) 4 ** 5 ** SybDatabaseMetaData.getXACoordinatorType() 6 ** 7 ** It is expected that this is an interim solution, and 8 ** a more robust implementation will be provided by ASE. 9 ** 10 ** returns a resultset of the form: 11 ** TxnStyle (indicating which transaction coordinator is being used. 12 ** 0 means none. 13 ** 14 ** RequiredRoles (indicates what role the user must have to use) 15 ** NULL means none. 16 ** 17 ** Status (a bitmask of capabilities that the coordinator provides) 18 ** 0x00000001 - set if user has necessary role 19 ** 0x00000002 - set if txns can migrate among connections 20 ** 0x00000004 - set if multiple connections can participate in same txn simultaneously 21 ** 22 */ 23 24 25 create procedure sp_ijdbc_getxacoordinator 26 as 27 28 declare @txnMode int 29 declare @role varchar(30) 30 declare @status int 31 declare @srv_version int 32 33 delete #tmp_getxacoordinator 34 35 select @srv_version = convert(int, value) from master.dbo.sysconfigures 36 where config = 122 37 38 /* For 12.0 and higher, jConnect expects to use DTM001. */ 39 /* DTM001 is defined as 2 in SybDataSource.RMTYPE_ASE_XA_DTM. */ 40 /* Users must have dtm_tm_role to use DTM. */ 41 /* Lastly, determine whether or not user has */ 42 /* dtm_tm_role when setting the status bits. */ 43 if (@srv_version >= 12000) 44 begin 45 /* verify that the 12.0 server is configured for XA using DTM */ 46 if ((select cur.value from master.dbo.syscurconfigs cur, master.dbo.sysconfigures conf 47 where conf.comment = 'enable DTM' and cur.config = conf.config) != 0) 48 begin 49 select @txnMode = 2, @role = 'dtm_tm_role' 50 end 51 else 52 begin 53 select @txnMode = 0, @role = 'dtm_tm_role' 54 end 55 56 /* now check for role permission */ 57 if (charindex('dtm_tm_role', show_role()) != 0) 58 begin 59 select @status = 7 60 end 61 else 62 begin 63 select @status = 6 64 end 65 end 66 else 67 /* pre 12.0 is currently not supported */ 68 begin 69 select @txnMode = 0, @role = NULL, @status = 0 70 end 71 72 /* return results and name the columns */ 73 74 insert #tmp_getxacoordinator 75 select TxnStyle = @txnMode, RequiredRole = @role, Status = @status 76 77
exec sp_procxmode 'sp_ijdbc_getxacoordinator', 'AnyMode' go Grant Execute on sp_ijdbc_getxacoordinator to public go
| DEFECTS | |
MINU 4 Unique Index with nullable columns master..sysconfigures | master..sysconfigures |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 36 |
TNOI 4 Table with no index master..syscurconfigs | master..syscurconfigs |
MGTP 3 Grant to public master..sysconfigures | |
MGTP 3 Grant to public master..syscurconfigs | |
MGTP 3 Grant to public sybsystemprocs..sp_ijdbc_getxacoordinator | |
MNER 3 No Error Check should check @@error after delete | 33 |
MNER 3 No Error Check should check @@error after insert | 74 |
MUCO 3 Useless Code Useless Brackets | 43 |
MUCO 3 Useless Code Useless Brackets | 46 |
MUCO 3 Useless Code Useless Brackets | 57 |
QAFM 3 Var Assignment from potentially many rows | 35 |
QNAJ 3 Not using ANSI Inner Join | 46 |
MSUB 2 Subquery Marker | 46 |
MTR1 2 Metrics: Comments Ratio Comments: 48% | 25 |
MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 5 = 4dec - 1exi + 2 | 25 |
MTR3 2 Metrics: Query Complexity Complexity: 27 | 25 |
PRED_QUERY_COLLECTION 2 {c=master..syscurconfigs, c2=master..sysconfigures} 0 | 46 |
| DEPENDENCIES |
| PROCS AND TABLES USED reads table master..sysconfigures (1) reads table master..syscurconfigs (1) writes table tempdb..#tmp_getxacoordinator (1) |