mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
Modify according to suggestions
This commit is contained in:
@@ -35,9 +35,9 @@ class IbatisConfiguration extends RefType {
|
||||
*/
|
||||
class IbatisConfigurationGetVariablesMethod extends Method {
|
||||
IbatisConfigurationGetVariablesMethod() {
|
||||
getDeclaringType() instanceof IbatisConfiguration and
|
||||
hasName("getVariables") and
|
||||
getNumberOfParameters() = 0
|
||||
this.getDeclaringType() instanceof IbatisConfiguration and
|
||||
this.hasName("getVariables") and
|
||||
this.getNumberOfParameters() = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,114 +45,62 @@ class IbatisConfigurationGetVariablesMethod extends Method {
|
||||
* An annotation type that identifies Ibatis select.
|
||||
*/
|
||||
private class IbatisSelectAnnotationType extends AnnotationType {
|
||||
IbatisSelectAnnotationType() {
|
||||
this.hasQualifiedName("org.apache.ibatis.annotations", "Select") or
|
||||
this.getAnAnnotation().getType() instanceof IbatisSelectAnnotationType
|
||||
}
|
||||
IbatisSelectAnnotationType() { this.hasQualifiedName("org.apache.ibatis.annotations", "Select") }
|
||||
}
|
||||
|
||||
/**
|
||||
* An annotation type that identifies Ibatis delete.
|
||||
*/
|
||||
private class IbatisDeleteAnnotationType extends AnnotationType {
|
||||
IbatisDeleteAnnotationType() {
|
||||
this.hasQualifiedName("org.apache.ibatis.annotations", "Delete") or
|
||||
this.getAnAnnotation().getType() instanceof IbatisDeleteAnnotationType
|
||||
}
|
||||
IbatisDeleteAnnotationType() { this.hasQualifiedName("org.apache.ibatis.annotations", "Delete") }
|
||||
}
|
||||
|
||||
/**
|
||||
* An annotation type that identifies Ibatis insert.
|
||||
*/
|
||||
private class IbatisInsertAnnotationType extends AnnotationType {
|
||||
IbatisInsertAnnotationType() {
|
||||
this.hasQualifiedName("org.apache.ibatis.annotations", "Insert") or
|
||||
this.getAnAnnotation().getType() instanceof IbatisInsertAnnotationType
|
||||
}
|
||||
IbatisInsertAnnotationType() { this.hasQualifiedName("org.apache.ibatis.annotations", "Insert") }
|
||||
}
|
||||
|
||||
/**
|
||||
* An annotation type that identifies Ibatis update.
|
||||
*/
|
||||
private class IbatisUpdateAnnotationType extends AnnotationType {
|
||||
IbatisUpdateAnnotationType() {
|
||||
this.hasQualifiedName("org.apache.ibatis.annotations", "Update") or
|
||||
this.getAnAnnotation().getType() instanceof IbatisUpdateAnnotationType
|
||||
}
|
||||
IbatisUpdateAnnotationType() { this.hasQualifiedName("org.apache.ibatis.annotations", "Update") }
|
||||
}
|
||||
|
||||
/**
|
||||
* Ibatis sql operation annotation.
|
||||
*/
|
||||
abstract class IbatisSqlOperationAnnotation extends Annotation {
|
||||
abstract string getSqlValue();
|
||||
}
|
||||
class IbatisSqlOperationAnnotation extends Annotation {
|
||||
IbatisSqlOperationAnnotation() {
|
||||
this.getType() instanceof IbatisSelectAnnotationType or
|
||||
this.getType() instanceof IbatisDeleteAnnotationType or
|
||||
this.getType() instanceof IbatisInsertAnnotationType or
|
||||
this.getType() instanceof IbatisUpdateAnnotationType
|
||||
}
|
||||
|
||||
/**
|
||||
* A `@org.apache.ibatis.annotations.Select` annotation.
|
||||
*/
|
||||
private class IbatisSelectAnnotation extends IbatisSqlOperationAnnotation {
|
||||
IbatisSelectAnnotation() { this.getType() instanceof IbatisSelectAnnotationType }
|
||||
|
||||
string getSelectValue() {
|
||||
/**
|
||||
* Get the SQL statement string.
|
||||
*/
|
||||
string getSqlValue() {
|
||||
result = this.getValue("value").(CompileTimeConstantExpr).getStringValue() or
|
||||
result =
|
||||
this.getValue("value").(ArrayInit).getInit(_).(CompileTimeConstantExpr).getStringValue()
|
||||
}
|
||||
|
||||
override string getSqlValue() { result = getSelectValue() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A `@org.apache.ibatis.annotations.Delete` annotation.
|
||||
* Methods annotated with `@org.apache.ibatis.annotations.Select` or `@org.apache.ibatis.annotations.Delete`
|
||||
* or `@org.apache.ibatis.annotations.Update` or `@org.apache.ibatis.annotations.Insert`.
|
||||
*/
|
||||
private class IbatisDeleteAnnotation extends IbatisSqlOperationAnnotation {
|
||||
IbatisDeleteAnnotation() { this.getType() instanceof IbatisDeleteAnnotationType }
|
||||
|
||||
string getDeleteValue() {
|
||||
result = this.getValue("value").(CompileTimeConstantExpr).getStringValue() or
|
||||
result =
|
||||
this.getValue("value").(ArrayInit).getInit(_).(CompileTimeConstantExpr).getStringValue()
|
||||
}
|
||||
|
||||
override string getSqlValue() { result = getDeleteValue() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A `@org.apache.ibatis.annotations.Insert` annotation.
|
||||
*/
|
||||
private class IbatisInsertAnnotation extends IbatisSqlOperationAnnotation {
|
||||
IbatisInsertAnnotation() { this.getType() instanceof IbatisInsertAnnotationType }
|
||||
|
||||
string getInsertValue() {
|
||||
result = this.getValue("value").(CompileTimeConstantExpr).getStringValue() or
|
||||
result =
|
||||
this.getValue("value").(ArrayInit).getInit(_).(CompileTimeConstantExpr).getStringValue()
|
||||
}
|
||||
|
||||
override string getSqlValue() { result = getInsertValue() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A `@org.apache.ibatis.annotations.Update` annotation.
|
||||
*/
|
||||
private class IbatisUpdateAnnotation extends IbatisSqlOperationAnnotation {
|
||||
IbatisUpdateAnnotation() { this.getType() instanceof IbatisUpdateAnnotationType }
|
||||
|
||||
string getUpdateValue() {
|
||||
result = this.getValue("value").(CompileTimeConstantExpr).getStringValue() or
|
||||
result =
|
||||
this.getValue("value").(ArrayInit).getInit(_).(CompileTimeConstantExpr).getStringValue()
|
||||
}
|
||||
|
||||
override string getSqlValue() { result = getUpdateValue() }
|
||||
}
|
||||
|
||||
// Mybatis uses sql operation to annotate the method of interacting with the database.
|
||||
class MybatisSqlOperationAnnotationMethod extends Method {
|
||||
MybatisSqlOperationAnnotationMethod() {
|
||||
exists(IbatisSqlOperationAnnotation isoa |
|
||||
this.getAnAnnotation() = isoa
|
||||
)
|
||||
class MyBatisSqlOperationAnnotationMethod extends Method {
|
||||
MyBatisSqlOperationAnnotationMethod() {
|
||||
this.getAnAnnotation() instanceof IbatisSqlOperationAnnotation
|
||||
}
|
||||
}
|
||||
|
||||
/** The interface `org.apache.ibatis.annotations.Param`. */
|
||||
class TypeParam extends Interface {
|
||||
TypeParam() { this.hasQualifiedName("org.apache.ibatis.annotations", "Param") }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user