MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dba.h
1 /*
2  Copyright (C) 2003-2006 MySQL AB
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
100 /****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/
101 
102 #ifndef DBA_H
103 #define DBA_H
104 
105 /* --- Include files ---- */
106 
107 #include <ndb_global.h>
108 #include <defs/pcn_types.h>
109 
110 /* --- Types and definitions --- */
111 
115 typedef enum {
120  DBA_ERROR = -3,
135 } DBA_Error_t;
136 
141 typedef int DBA_ErrorCode_t;
142 
146 typedef enum {
150 
151 
156 typedef struct DBA_ColumnDesc {
157 
158  const char* Name;
160  Size_t Size;
161  Boolean_t IsKey;
164 
175 #define DBA_BINDING( ColName, Type, Struct, Field ) \
176  { ColName, Type, PCN_SIZE_OF( Struct, Field ), \
177  PCN_OFFSET_OF( Struct, Field ), 0, 0 }
178 
187 #define DBA_BINDING_PTR(Struct, Field, ColBindings, NbCBindings) \
188  { 0, DBA_CHAR, NbCBindings, PCN_OFFSET_OF( Struct, Field ), \
189  1, ColBindings }
190 
236  const char* Name;
238  Size_t Size;
241  Size_t Offset;
243  Boolean_t Ptr;
244  const struct DBA_ColumnBinding * SubBinding;
246 };
247 
252 
265 typedef struct DBA_Binding DBA_Binding_t;
266 
267 /* --- Exported functions --- */
268 
281 DBA_Error_t DBA_SetParameter(int ParameterId, int Value);
282 
289 DBA_Error_t DBA_GetParameter(int ParameterId, int * Value);
290 
297 
303 DBA_Error_t DBA_Close(void);
304 
311 
318 
325 const char * DBA_GetLatestErrorMsg();
326 
332 const char * DBA_GetErrorMsg(DBA_Error_t);
333 
339 const char * DBA_GetNdbErrorMsg(DBA_ErrorCode_t);
340 
350 DBA_CreateTable( const char* TableName, int NbColumns,
351  const DBA_ColumnDesc_t Columns[] );
352 
361 DBA_DropTable( const char* TableName );
362 
363 
370 Boolean_t
371 DBA_TableExists( const char* TableName );
372 
383 DBA_CreateBinding( const char* TableName,
384  int NbCol, const DBA_ColumnBinding_t ColsBinding[],
385  Size_t StructSz );
386 
396 
400 typedef long DBA_ReqId_t;
401 
407 #define DBA_INVALID_REQID 0
408 
421 typedef void (*DBA_AsyncCallbackFn_t)( DBA_ReqId_t ReqId,
422  DBA_Error_t Status,
423  DBA_ErrorCode_t ErrorCode );
435 DBA_InsertRows( const DBA_Binding_t* pBinding, const void * const pData[],
436  int NbRows,
437  DBA_AsyncCallbackFn_t CbFunc );
438 
450 DBA_ArrayInsertRows( const DBA_Binding_t* pBinding, const void * pData,
451  int NbRows,
452  DBA_AsyncCallbackFn_t CbFunc );
453 
465 DBA_UpdateRows( const DBA_Binding_t* pBinding, const void * const pData[],
466  int NbRows,
467  DBA_AsyncCallbackFn_t CbFunc );
468 
480 DBA_ArrayUpdateRows( const DBA_Binding_t* pBinding, const void * pData,
481  int NbRows,
482  DBA_AsyncCallbackFn_t CbFunc );
483 
494 DBA_DeleteRows( const DBA_Binding_t* pBinding, const void * const pData[],
495  int NbRows,
496  DBA_AsyncCallbackFn_t CbFunc );
497 
498 
509 DBA_ArrayDeleteRows( const DBA_Binding_t* pBinding, const void * pData,
510  int NbRows,
511  DBA_AsyncCallbackFn_t CbFunc );
512 
523 DBA_WriteRows( const DBA_Binding_t* pBinding, const void * const pData[],
524  int NbRows,
525  DBA_AsyncCallbackFn_t CbFunc );
526 
537 DBA_ArrayWriteRows( const DBA_Binding_t* pBinding, const void * pData,
538  int NbRows,
539  DBA_AsyncCallbackFn_t CbFunc );
540 
552 DBA_ReadRows( const DBA_Binding_t* pBinding, void * const pData[],
553  int NbRows,
554  DBA_AsyncCallbackFn_t CbFunc );
555 
567 DBA_ArrayReadRows( const DBA_Binding_t* pBinding, void * pData,
568  int NbRows,
569  DBA_AsyncCallbackFn_t CbFunc );
570 
571 /****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/
572 
586 DBA_MultiInsertRow(const DBA_Binding_t * const pBindings[],
587  const void * const pData[],
588  int NbBindings,
589  DBA_AsyncCallbackFn_t CbFunc );
590 
604 DBA_MultiUpdateRow(const DBA_Binding_t * const pBindings[],
605  const void * const pData[],
606  int NbBindings,
607  DBA_AsyncCallbackFn_t CbFunc );
608 
622 DBA_MultiWriteRow(const DBA_Binding_t * const pBindings[],
623  const void * const pData[],
624  int NbBindings,
625  DBA_AsyncCallbackFn_t CbFunc );
626 
640 DBA_MultiDeleteRow(const DBA_Binding_t * const pBindings[],
641  const void * const pData[],
642  int NbBindings,
643  DBA_AsyncCallbackFn_t CbFunc );
644 
658 DBA_MultiReadRow(const DBA_Binding_t * const pBindings[],
659  void * const pData[],
660  int NbBindings,
661  DBA_AsyncCallbackFn_t CbFunc );
662 
663 /****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/
664 
672 typedef struct DBA_BulkReadResultSet {
673  void * DataPtr;
676  Boolean_t RowFoundIndicator;
680 
695 DBA_BulkReadRows(const DBA_Binding_t * pBinding,
696  DBA_BulkReadResultSet_t pData[],
697  int NbRows,
698  DBA_AsyncCallbackFn_t CbFunc );
699 
724 DBA_BulkMultiReadRows(const DBA_Binding_t * const pBindings[],
725  DBA_BulkReadResultSet_t pData[],
726  int NbBindings,
727  int NbRows,
728  DBA_AsyncCallbackFn_t CbFunc );
729 
732 #endif