jvm-jni-starter: --sql místo --sql-in + refaktoring
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sat, 10 Feb 2018 17:11:31 +0100
changeset 56813b44590d07
parent 55 2fbf53cf0782
child 57 1b21c78d8706
jvm-jni-starter: --sql místo --sql-in + refaktoring
c++/jvm-jni-starter/jvm-jni-starter.cpp
     1.1 --- a/c++/jvm-jni-starter/jvm-jni-starter.cpp	Sat Jan 20 21:44:45 2018 +0100
     1.2 +++ b/c++/jvm-jni-starter/jvm-jni-starter.cpp	Sat Feb 10 17:11:31 2018 +0100
     1.3 @@ -75,16 +75,19 @@
     1.4  			//jstring arg = env->NewStringUTF("--list-databases");
     1.5  			//jarray args = env->NewObjectArray(1, env->FindClass("java/lang/String"), arg);
     1.6  
     1.7 -			jobjectArray args = env->NewObjectArray(9, env->FindClass("java/lang/String"), NULL);
     1.8 -			env->SetObjectArrayElement(args, 0, env->NewStringUTF("--db"));
     1.9 -			env->SetObjectArrayElement(args, 1, env->NewStringUTF("loopback"));
    1.10 -			env->SetObjectArrayElement(args, 2, env->NewStringUTF("--sql-in")); // vyžaduje (libovolná) data na standardním vstupu
    1.11 -			env->SetObjectArrayElement(args, 3, env->NewStringUTF("--data"));
    1.12 -			env->SetObjectArrayElement(args, 4, env->NewStringUTF("2"));
    1.13 -			env->SetObjectArrayElement(args, 5, env->NewStringUTF("a"));
    1.14 -			env->SetObjectArrayElement(args, 6, env->NewStringUTF("b"));
    1.15 -			env->SetObjectArrayElement(args, 7, env->NewStringUTF("c"));
    1.16 -			env->SetObjectArrayElement(args, 8, env->NewStringUTF("d"));
    1.17 +			jobjectArray args = env->NewObjectArray(10, env->FindClass("java/lang/String"), NULL);
    1.18 +			int a = 0;
    1.19 +			env->SetObjectArrayElement(args, a++, env->NewStringUTF("--db"));
    1.20 +			env->SetObjectArrayElement(args, a++, env->NewStringUTF("loopback"));
    1.21 +			//env->SetObjectArrayElement(args, a++, env->NewStringUTF("--sql-in")); // vyžaduje (libovolná) data na standardním vstupu
    1.22 +			env->SetObjectArrayElement(args, a++, env->NewStringUTF("--sql"));
    1.23 +			env->SetObjectArrayElement(args, a++, env->NewStringUTF("…"));
    1.24 +			env->SetObjectArrayElement(args, a++, env->NewStringUTF("--data"));
    1.25 +			env->SetObjectArrayElement(args, a++, env->NewStringUTF("2"));
    1.26 +			env->SetObjectArrayElement(args, a++, env->NewStringUTF("a"));
    1.27 +			env->SetObjectArrayElement(args, a++, env->NewStringUTF("b"));
    1.28 +			env->SetObjectArrayElement(args, a++, env->NewStringUTF("c"));
    1.29 +			env->SetObjectArrayElement(args, a++, env->NewStringUTF("d"));
    1.30  
    1.31  
    1.32  			for (int i = 0; i < 10; i++) {