1 /************************************************************************************ 2 Copyright (C) 2017,2018 MariaDB Corporation AB 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 This library 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 GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public 15 License along with this library; if not see <http://www.gnu.org/licenses> 16 or write to the Free Software Foundation, Inc., 17 51 Franklin St., Fifth Floor, Boston, MA 02110, USA 18 *************************************************************************************/ 19 20 /* Code allowing to deploy MariaDB bulk operation functionality. 21 * i.e. adapting ODBC param arrays to MariaDB arrays */ 22 23 #ifndef _ma_bulk_h 24 #define _ma_bulk_h 25 26 #define MADB_DOING_BULK_OPER(_stmt) ((_stmt)->Bulk.ArraySize > 1) 27 28 /* Couple defined to make "switch"s look at least shorter, if not nicer */ 29 #define CHAR_BINARY_TYPES SQL_C_CHAR:\ 30 case SQL_C_BINARY:\ 31 case SQL_LONGVARBINARY:\ 32 case SQL_VARBINARY:\ 33 case SQL_VARCHAR:\ 34 case SQL_LONGVARCHAR 35 36 #define WCHAR_TYPES SQL_C_WCHAR:\ 37 case SQL_WVARCHAR:\ 38 case SQL_WLONGVARCHAR 39 40 #define DATETIME_TYPES SQL_C_TIMESTAMP:\ 41 case SQL_TYPE_TIMESTAMP:\ 42 case SQL_C_TIME:\ 43 case SQL_TYPE_TIME:\ 44 case SQL_C_INTERVAL_HOUR_TO_MINUTE:\ 45 case SQL_C_INTERVAL_HOUR_TO_SECOND:\ 46 case SQL_C_DATE:\ 47 case SQL_TYPE_DATE 48 49 char MADB_MapIndicatorValue(SQLLEN OdbcInd); 50 unsigned int MADB_UsedParamSets(MADB_Stmt *Stmt); 51 BOOL MADB_AppBufferCanBeUsed(SQLSMALLINT CType, SQLSMALLINT SqlType); 52 void MADB_CleanBulkOperData(MADB_Stmt *Stmt, unsigned int ParamOffset); 53 SQLRETURN MADB_InitBulkOperBuffers(MADB_Stmt *Stmt, MADB_DescRecord *CRec, void *DataPtr, SQLLEN *OctetLengthPtr, 54 SQLLEN *IndicatorPtr, SQLSMALLINT SqlType, MYSQL_BIND *MaBind); 55 SQLRETURN MADB_SetIndicatorValue(MADB_Stmt *Stmt, MYSQL_BIND *MaBind, unsigned int row, SQLLEN OdbcIndicator); 56 57 SQLRETURN MADB_ExecuteBulk(MADB_Stmt *Stmt, unsigned int ParamOffset); 58 59 #endif 60