1 /*
2 * Copyright (C) 2008 - 2011 Vivien Malerba <malerba@gnome-db.org>
3 * Copyright (C) 2010 David King <davidk@openismus.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #include "GdaJResultSetInfos.h"
22 #include "jni-wrapper.h"
23
24 JniWrapperField *GdaJResultSetInfos__ncols = NULL;
25 JniWrapperMethod *GdaJResultSetInfos__describeColumn = NULL;
26
27 JNIEXPORT void
28 JNICALL Java_GdaJResultSetInfos_initIDs (JNIEnv *env, jclass klass)
Java_GdaJResultSet_initIDs(JNIEnv * env,jclass klass)29 {
30 gsize i;
31 typedef struct {
32 const gchar *name;
33 const gchar *sig;
34 gboolean is_static;
35 JniWrapperField **symbol;
36 } FieldSignature;
37
38 FieldSignature fields[] = {
39 {"ncols", "I", FALSE, &GdaJResultSetInfos__ncols}
40 };
41
42 /* fields */
43 for (i = 0; i < sizeof (fields) / sizeof (FieldSignature); i++) {
44 FieldSignature *m = & (fields [i]);
45 *(m->symbol) = jni_wrapper_field_create (env, klass, m->name, m->sig, m->is_static, NULL);
46 if (!*(m->symbol))
47 g_error ("Can't find field: %s.%s", "GdaJResultSetInfos", m->name);
48 }
49
50 /* methods */
51 typedef struct {
52 const gchar *name;
53 const gchar *sig;
54 gboolean is_static;
55 JniWrapperMethod **symbol;
56 } MethodSignature;
57
58 MethodSignature methods[] = {
59 {"describeColumn", "(I)LGdaJColumnInfos;", FALSE, &GdaJResultSetInfos__describeColumn},
60 };
61
62 for (i = 0; i < sizeof (methods) / sizeof (MethodSignature); i++) {
63 MethodSignature *m = & (methods [i]);
64 *(m->symbol) = jni_wrapper_method_create (env, klass, m->name, m->sig, m->is_static, NULL);
65 if (!*(m->symbol))
66 g_error ("Can't find method: %s.%s", "GdaJResultSetInfos", m->name);
67 }
68 }
69