Add parts to build the codeql database in steps and provide log for comparison

This commit is contained in:
Michael Hohn
2025-01-10 13:49:49 -08:00
committed by =Michael Hohn
parent 161a1d54f8
commit 5aadf85fb6
5 changed files with 2051 additions and 16 deletions

View File

@@ -1,47 +0,0 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
break!!!
public class AddUser {
public static Connection connect() {
Connection conn = null;
try {
String url = "jdbc:sqlite:users.sqlite";
conn = DriverManager.getConnection(url);
System.out.println("Connected...");
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return conn;
}
static String get_user_info() {
System.out.println("Enter name:");
return System.console().readLine();
}
static void write_info(int id, String info) {
try (Connection conn = connect()) {
String query = String.format("INSERT INTO users VALUES (%d, '%s')", id, info);
conn.createStatement().executeUpdate(query);
System.err.printf("Sent: %s", query);
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
static int get_new_id() {
return (int)(Math.random()*100000);
}
public static void main(String[] args) {
String info;
int id;
info = get_user_info();
id = get_new_id();
write_info(id, info);
}
}

13
session/simple.ql Normal file
View File

@@ -0,0 +1,13 @@
/**
* @name simple test
* @description simple test
* @kind problem
* @id cpp/simple
* @problem.severity warning
*/
import java
from Call read
where read.getCallee().getName() = "readLine"
select read, "Found readline"