# HG changeset patch # User František Kučera # Date 1518279091 -3600 # Node ID 813b44590d070c25d3fd79eddfa00dbbd594a2cf # Parent 2fbf53cf078208265cf64fba34eb49af83e3df58 jvm-jni-starter: --sql místo --sql-in + refaktoring diff -r 2fbf53cf0782 -r 813b44590d07 c++/jvm-jni-starter/jvm-jni-starter.cpp --- a/c++/jvm-jni-starter/jvm-jni-starter.cpp Sat Jan 20 21:44:45 2018 +0100 +++ b/c++/jvm-jni-starter/jvm-jni-starter.cpp Sat Feb 10 17:11:31 2018 +0100 @@ -75,16 +75,19 @@ //jstring arg = env->NewStringUTF("--list-databases"); //jarray args = env->NewObjectArray(1, env->FindClass("java/lang/String"), arg); - jobjectArray args = env->NewObjectArray(9, env->FindClass("java/lang/String"), NULL); - env->SetObjectArrayElement(args, 0, env->NewStringUTF("--db")); - env->SetObjectArrayElement(args, 1, env->NewStringUTF("loopback")); - env->SetObjectArrayElement(args, 2, env->NewStringUTF("--sql-in")); // vyžaduje (libovolná) data na standardním vstupu - env->SetObjectArrayElement(args, 3, env->NewStringUTF("--data")); - env->SetObjectArrayElement(args, 4, env->NewStringUTF("2")); - env->SetObjectArrayElement(args, 5, env->NewStringUTF("a")); - env->SetObjectArrayElement(args, 6, env->NewStringUTF("b")); - env->SetObjectArrayElement(args, 7, env->NewStringUTF("c")); - env->SetObjectArrayElement(args, 8, env->NewStringUTF("d")); + jobjectArray args = env->NewObjectArray(10, env->FindClass("java/lang/String"), NULL); + int a = 0; + env->SetObjectArrayElement(args, a++, env->NewStringUTF("--db")); + env->SetObjectArrayElement(args, a++, env->NewStringUTF("loopback")); + //env->SetObjectArrayElement(args, a++, env->NewStringUTF("--sql-in")); // vyžaduje (libovolná) data na standardním vstupu + env->SetObjectArrayElement(args, a++, env->NewStringUTF("--sql")); + env->SetObjectArrayElement(args, a++, env->NewStringUTF("…")); + env->SetObjectArrayElement(args, a++, env->NewStringUTF("--data")); + env->SetObjectArrayElement(args, a++, env->NewStringUTF("2")); + env->SetObjectArrayElement(args, a++, env->NewStringUTF("a")); + env->SetObjectArrayElement(args, a++, env->NewStringUTF("b")); + env->SetObjectArrayElement(args, a++, env->NewStringUTF("c")); + env->SetObjectArrayElement(args, a++, env->NewStringUTF("d")); for (int i = 0; i < 10; i++) {