1 /*
2   Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
3 
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License, version 2.0,
6   as published by the Free Software Foundation.
7 
8   This program is also distributed with certain software (including
9   but not limited to OpenSSL) that is licensed under separate terms,
10   as designated in a particular file or component or in included license
11   documentation.  The authors of MySQL hereby grant you an additional
12   permission to link the program and your derivative works with the
13   separately licensed software that they have included with MySQL.
14 
15   This program is distributed in the hope that it will be useful,
16   but WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   GNU General Public License, version 2.0, for more details.
19 
20   You should have received a copy of the GNU General Public License
21   along with this program; if not, write to the Free Software
22   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
23 */
24 /*
25  * Ndb.java
26  */
27 
28 package com.mysql.ndbjtie.ndbapi;
29 
30 import java.nio.ByteBuffer;
31 
32 import com.mysql.jtie.Wrapper;
33 import com.mysql.jtie.ArrayWrapper;
34 
35 public class Ndb extends Wrapper implements NdbConst
36 {
getAutoIncrementValue(NdbDictionary.TableConst aTable, long[] ret, int cacheSize, long step, long start)37     public final native int getAutoIncrementValue(NdbDictionary.TableConst aTable, long[] ret, int cacheSize, long step, long start);
getDatabaseName()38     public final native String/*_const char *_*/ getDatabaseName() /*_const_*/;
getDatabaseSchemaName()39     public final native String/*_const char *_*/ getDatabaseSchemaName() /*_const_*/;
getDictionary()40     public final native NdbDictionary.Dictionary/*_NdbDictionary.Dictionary *_*/ getDictionary() /*_const_*/;
getNdbError()41     public final native NdbErrorConst/*_const NdbError &_*/ getNdbError() /*_const_*/;
getNdbErrorDetail(NdbErrorConst err, ByteBuffer buff, int buffLen)42     public final native String/*_const char *_*/ getNdbErrorDetail(NdbErrorConst/*_const NdbError &_*/ err, ByteBuffer /*_char *_*/ buff, int/*_Uint32_*/ buffLen) /*_const_*/;
create(Ndb_cluster_connection ndb_cluster_connection, String aCatalogName , String aSchemaName )43     static public final native Ndb create(Ndb_cluster_connection/*_Ndb_cluster_connection *_*/ ndb_cluster_connection, String/*_const char *_*/ aCatalogName /*_= ""_*/, String/*_const char *_*/ aSchemaName /*_= "def"_*/);
delete(Ndb p0)44     static public final native void delete(Ndb p0);
setDatabaseName(String aDatabaseName)45     public final native int setDatabaseName(String/*_const char *_*/ aDatabaseName);
setDatabaseSchemaName(String aDatabaseSchemaName)46     public final native int setDatabaseSchemaName(String/*_const char *_*/ aDatabaseSchemaName);
init(int maxNoOfTransactions )47     public final native int init(int maxNoOfTransactions /*_= 4_*/);
createEventOperation(String eventName)48     public final native NdbEventOperation/*_NdbEventOperation *_*/ createEventOperation(String/*_const char *_*/ eventName);
dropEventOperation(NdbEventOperation eventOp)49     public final native int dropEventOperation(NdbEventOperation/*_NdbEventOperation *_*/ eventOp);
pollEvents(int aMillisecondNumber, long[] latestGCI )50     public final native int pollEvents(int aMillisecondNumber, long[]/*_Uint64 *_*/ latestGCI /*_= 0_*/);
nextEvent()51     public final native NdbEventOperation/*_NdbEventOperation *_*/ nextEvent();
isConsistent(long[] gci)52     public final native boolean isConsistent(long[]/*_Uint64 &_*/ gci);
isConsistentGCI(long gci)53     public final native boolean isConsistentGCI(long/*_Uint64_*/ gci);
getGCIEventOperations(int[] iter, int[] event_types)54     public final native NdbEventOperationConst/*_const NdbEventOperation *_*/ getGCIEventOperations(int[]/*_Uint32 *_*/ iter, int[]/*_Uint32 *_*/ event_types);
startTransaction(NdbDictionary.TableConst table , ByteBuffer keyData , int keyLen )55     public final native NdbTransaction/*_NdbTransaction *_*/ startTransaction(NdbDictionary.TableConst/*_const NdbDictionary.Table *_*/ table /*_= 0_*/, ByteBuffer/*_const char *_*/ keyData /*_= 0_*/, int/*_Uint32_*/ keyLen /*_= 0_*/);
56     static public interface Key_part_ptrConstArray extends ArrayWrapper< Key_part_ptrConst >
57     {
58     }
59     static public class Key_part_ptrArray extends Wrapper implements Key_part_ptrConstArray
60     {
create(int length)61         static public native Key_part_ptrArray create(int length);
delete(Key_part_ptrArray e)62         static public native void delete(Key_part_ptrArray e);
at(int i)63         public native Key_part_ptr at(int i);
64     }
65     public interface /*_struct_*/ Key_part_ptrConst
66     {
67         // MMM! support <out:BB> or check if needed: ByteBuffer/*_const void *_*/ ptr();
len()68         int/*_unsigned_*/ len();
69     }
70     static public class /*_struct_*/ Key_part_ptr extends Wrapper implements Key_part_ptrConst
71     {
72         // MMM! support <out:BB> or check if needed: public final native ByteBuffer/*_const void *_*/ ptr();
len()73         public final native int/*_unsigned_*/ len();
ptr(ByteBuffer p0)74         public final native void ptr(ByteBuffer/*_const void *_*/ p0);
len(int p0)75         public final native void len(int/*_unsigned_*/ p0);
create()76         static public final native Key_part_ptr create();
delete(Key_part_ptr p0)77         static public final native void delete(Key_part_ptr p0);
78     }
79     public interface /*_struct_*/ PartitionSpecConst
80     {
81         public interface /*_enum_*/ SpecType
82         {
83             int PS_NONE = 0,
84                 PS_USER_DEFINED = 1,
85                 PS_DISTR_KEY_PART_PTR = 2,
86                 PS_DISTR_KEY_RECORD = 3;
87         }
type()88         int/*_SpecType_*/ type() /*_const_*/;
89     }
90     static public class /*_struct_*/ PartitionSpec extends Wrapper implements PartitionSpecConst
91     {
size()92         static public final native int/*_Uint32_*/ size();
type()93         public final native int/*_SpecType_*/ type() /*_const_*/;
94         // MMM! support mapping <union> or check if needed
95         //union {
96         //    struct {
97         //        Uint32 partitionId;
98         //    } UserDefined;
99         //    struct {
100         //        const Key_part_ptr* tableKeyParts;
101         //        void* xfrmbuf;
102         //        Uint32 xfrmbuflen;
103         //    } KeyPartPtr;
104         //    struct {
105         //        const NdbRecord* keyRecord;
106         //        const char* keyRow;
107         //        void* xfrmbuf;
108         //        Uint32 xfrmbuflen;
109         //    } KeyRecord;
110         //};
111     }
startTransaction(NdbDictionary.TableConst table, Key_part_ptrConstArray keyData, ByteBuffer xfrmbuf , int xfrmbuflen )112     public final native NdbTransaction/*_NdbTransaction *_*/ startTransaction(NdbDictionary.TableConst/*_const NdbDictionary.Table *_*/ table, Key_part_ptrConstArray/*_const Key_part_ptr *_*/ keyData, ByteBuffer/*_void *_*/ xfrmbuf /*_= 0_*/, int/*_Uint32_*/ xfrmbuflen /*_= 0_*/);
startTransaction(NdbDictionary.TableConst table, int partitionId)113     public final native NdbTransaction/*_NdbTransaction *_*/ startTransaction(NdbDictionary.TableConst/*_const NdbDictionary.Table *_*/ table, int/*_Uint32_*/ partitionId);
computeHash(int[] hashvalueptr, NdbDictionary.TableConst p0, Key_part_ptrConstArray keyData, ByteBuffer xfrmbuf , int xfrmbuflen )114     static public final native int computeHash(int[]/*_Uint32 *_*/ hashvalueptr, NdbDictionary.TableConst/*_const NdbDictionary.Table *_*/ p0, Key_part_ptrConstArray/*_const Key_part_ptr *_*/ keyData, ByteBuffer/*_void *_*/ xfrmbuf /*_= 0_*/, int/*_Uint32_*/ xfrmbuflen /*_= 0_*/);
closeTransaction(NdbTransaction p0)115     public final native void closeTransaction(NdbTransaction/*_NdbTransaction *_*/ p0);
getNdbError(int errorCode)116     public final native NdbErrorConst/*_const NdbError &_*/ getNdbError(int errorCode);
117 }
118