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 "GdaJResultSet.h"
22 #include "jni-wrapper.h"
23 
24 JniWrapperMethod *GdaJResultSet__getInfos = NULL;
25 JniWrapperMethod *GdaJResultSet__declareColumnTypes = NULL;
26 JniWrapperMethod *GdaJResultSet__fillNextRow = NULL;
27 
28 JNIEXPORT void
29 JNICALL Java_GdaJResultSet_initIDs (JNIEnv *env, jclass klass)
30 {
31 	gsize i;
32 	typedef struct {
33 		const gchar       *name;
34 		const gchar       *sig;
35 		gboolean           is_static;
36 		JniWrapperMethod **symbol;
37 	} MethodSignature;
38 
39 	MethodSignature methods[] = {
40 		{"getInfos", "()LGdaJResultSetInfos;", FALSE, &GdaJResultSet__getInfos},
41 		{"declareColumnTypes" , "(J[B)V", FALSE, &GdaJResultSet__declareColumnTypes},
42 		{"fillNextRow", "(J)Z", FALSE, &GdaJResultSet__fillNextRow},
43 	};
44 
45 	for (i = 0; i < sizeof (methods) / sizeof (MethodSignature); i++) {
46 		MethodSignature *m = & (methods [i]);
47 		*(m->symbol) = jni_wrapper_method_create (env, klass, m->name, m->sig, m->is_static, NULL);
48 		if (!*(m->symbol))
49 			g_error ("Can't find method: %s.%s", "GdaJResultSet", m->name);
50 	}
51 }
52