| 199 | } |
| 200 | |
| 201 | JNIEXPORT jlong NativeOpenTable(JNIEnv* env, jobject jobj, jlong jclient_ptr, jstring jtablename) { |
| 202 | tera::Client* client = reinterpret_cast<tera::Client*>(jclient_ptr); |
| 203 | tera::Table* table; |
| 204 | std::string tablename = reinterpret_cast<const char*>(env->GetStringUTFChars(jtablename, NULL)); |
| 205 | tera::ErrorCode error_code; |
| 206 | std::string msg; |
| 207 | if (client == NULL) { |
| 208 | msg = "tera client not initialized."; |
| 209 | SendErrorJ(env, jobj, msg); |
| 210 | return 0; |
| 211 | } |
| 212 | table = client->OpenTable(tablename, &error_code); |
| 213 | if (table == NULL) { |
| 214 | msg = "failed to open table, reason: " + error_code.GetReason(); |
| 215 | SendErrorJ(env, jobj, msg); |
| 216 | return 0; |
| 217 | } |
| 218 | jlong jtable = reinterpret_cast<uint64_t>(table); |
| 219 | return jtable; |
| 220 | } |
| 221 | |
| 222 | JNIEXPORT jstring |
| 223 | NativeGetTableDescriptor(JNIEnv* env, jobject jobj, jlong jclient_ptr, jstring jtablename) { |
nothing calls this directly
no test coverage detected