-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement Value::TryInto and Reference::TryInto for class vec
- Loading branch information
1 parent
87a8b73
commit d5924fe
Showing
8 changed files
with
210 additions
and
11 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
import java.sql.ResultSet; | ||
import java.sql.Statement; | ||
|
||
public class JDBC { | ||
public static void main(String ... args) throws Exception { | ||
Class.forName("org.h2.Driver"); | ||
String url = "jdbc:h2:~/test"; | ||
String user = "sa"; | ||
String password = ""; | ||
|
||
try (Connection connection = DriverManager.getConnection(url, user, password); | ||
Statement statement = connection.createStatement(); | ||
ResultSet resultSet = statement.executeQuery("SELECT H2VERSION()")) { | ||
|
||
if (resultSet.next()) { | ||
String version = resultSet.getString(1); | ||
System.out.println("H2 Database Version: " + version); | ||
} | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use ristretto_classloader::ClassPath; | ||
use ristretto_vm::{ConfigurationBuilder, VM}; | ||
use std::path::PathBuf; | ||
|
||
#[tokio::test] | ||
async fn test_jdbc() -> ristretto_vm::Result<()> { | ||
let cargo_manifest = PathBuf::from(env!("CARGO_MANIFEST_DIR")); | ||
let classes_directory = cargo_manifest.join("..").join("classes"); | ||
let class_path_entries = [ | ||
classes_directory.to_string_lossy().to_string(), | ||
"https://repo1.maven.org/maven2/com/h2database/h2/2.3.232/h2-2.3.232.jar".to_string(), | ||
] | ||
.join(":"); | ||
let class_path = ClassPath::from(&class_path_entries); | ||
let configuration = ConfigurationBuilder::new() | ||
.class_path(class_path) | ||
.main_class("JDBC") | ||
.build()?; | ||
let _vm = VM::new(configuration).await?; | ||
let _arguments: Vec<&str> = Vec::new(); | ||
// Temporarily disable this test because it requires the invokedynamic instruction. | ||
// let result = vm.invoke_main(arguments).await?; | ||
Ok(()) | ||
} |