Skip to content

Commit 5d9a81a

Browse files
authored
exportSql & importSql naming (#130)
1 parent ccad10c commit 5d9a81a

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/main/java/com/surrealdb/Surreal.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ private static native long upsertRecordIdRangeValue(long ptr, String table, long
147147

148148
private static native long run(long ptr, String name, long[] argsValuePtrs);
149149

150-
private static native boolean export(long ptr, String path);
150+
private static native boolean exportSql(long ptr, String path);
151151

152-
private static native boolean import_(long ptr, String path);
152+
private static native boolean importSql(long ptr, String path);
153153

154154
private static native long selectLive(long ptr, String table);
155155

@@ -246,8 +246,8 @@ public Value run(String name, java.lang.Object... args) {
246246
* @throws SurrealException
247247
* if export fails or backups are not supported
248248
*/
249-
public boolean export(String path) {
250-
return export(getPtr(), path);
249+
public boolean exportSql(String path) {
250+
return exportSql(getPtr(), path);
251251
}
252252

253253
/**
@@ -260,8 +260,8 @@ public boolean export(String path) {
260260
* @throws SurrealException
261261
* if import fails or backups are not supported
262262
*/
263-
public boolean import_(String path) {
264-
return import_(getPtr(), path);
263+
public boolean importSql(String path) {
264+
return importSql(getPtr(), path);
265265
}
266266

267267
/**

src/main/rust/surreal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ pub extern "system" fn Java_com_surrealdb_Surreal_selectLive<'local>(
529529
}
530530

531531
#[no_mangle]
532-
pub extern "system" fn Java_com_surrealdb_Surreal_export<'local>(
532+
pub extern "system" fn Java_com_surrealdb_Surreal_exportSql<'local>(
533533
mut env: JNIEnv<'local>,
534534
_class: JClass<'local>,
535535
ptr: jlong,
@@ -545,7 +545,7 @@ pub extern "system" fn Java_com_surrealdb_Surreal_export<'local>(
545545
}
546546

547547
#[no_mangle]
548-
pub extern "system" fn Java_com_surrealdb_Surreal_import_1<'local>(
548+
pub extern "system" fn Java_com_surrealdb_Surreal_importSql<'local>(
549549
mut env: JNIEnv<'local>,
550550
_class: JClass<'local>,
551551
ptr: jlong,

src/test/java/com/surrealdb/ExportImportTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.junit.jupiter.api.Test;
1111

1212
/**
13-
* Tests for {@link Surreal#export(String)} and {@link Surreal#import_(String)}.
13+
* Tests for {@link Surreal#exportSql(String)} and {@link Surreal#importSql(String)}.
1414
*/
1515
public class ExportImportTests {
1616

@@ -22,12 +22,12 @@ void exportAndImportRoundTrip() throws Exception {
2222
try (Surreal surreal = new Surreal()) {
2323
surreal.connect("memory").useNs("test").useDb("test");
2424
surreal.query("CREATE person:id SET name = 'Alice';");
25-
boolean exported = surreal.export(file.toString());
25+
boolean exported = surreal.exportSql(file.toString());
2626
assertTrue(exported);
2727
}
2828
try (Surreal surreal = new Surreal()) {
2929
surreal.connect("memory").useNs("test").useDb("test");
30-
boolean imported = surreal.import_(file.toString());
30+
boolean imported = surreal.importSql(file.toString());
3131
assertTrue(imported);
3232
Response response = surreal.query("SELECT * FROM person");
3333
Array rows = response.take(0).getArray();
@@ -46,7 +46,7 @@ void import_missingFile_returnsFalseOrThrows() {
4646
surreal.connect("memory").useNs("test").useDb("test");
4747
Path missing = Paths.get("nonexistent_" + System.nanoTime() + ".surql");
4848
try {
49-
boolean imported = surreal.import_(missing.toString());
49+
boolean imported = surreal.importSql(missing.toString());
5050
assertFalse(imported, "import of missing file should return false or throw");
5151
} catch (SurrealException e) {
5252
// expected when server throws instead of returning false

0 commit comments

Comments
 (0)