| 1 | /* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ |
| 2 | /* |
| 3 | Copyright(C) 2010 Tetsuro IKEDA |
| 4 | Copyright(C) 2010-2013 Kentoku SHIBA |
| 5 | Copyright(C) 2011-2017 Kouhei Sutou <kou@clear-code.com> |
| 6 | |
| 7 | This library is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU Lesser General Public |
| 9 | License as published by the Free Software Foundation; either |
| 10 | version 2.1 of the License, or (at your option) any later version. |
| 11 | |
| 12 | This library is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | Lesser General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU Lesser General Public |
| 18 | License along with this library; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #include <mrn_mysql.h> |
| 23 | #include <mrn_windows.hpp> |
| 24 | #include <mrn_table.hpp> |
| 25 | #include <mrn_macro.hpp> |
| 26 | #include <mrn_current_thread.hpp> |
| 27 | |
| 28 | MRN_BEGIN_DECLS |
| 29 | |
| 30 | MRN_API my_bool last_insert_grn_id_init(UDF_INIT *init, UDF_ARGS *args, char *message) |
| 31 | { |
| 32 | if (args->arg_count != 0) { |
| 33 | strcpy(message, "last_insert_grn_id must not have arguments" ); |
| 34 | return 1; |
| 35 | } |
| 36 | init->maybe_null = 0; |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | MRN_API longlong last_insert_grn_id(UDF_INIT *init, UDF_ARGS *args, char *is_null, char *error) |
| 41 | { |
| 42 | THD *thd = current_thd; |
| 43 | st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, false); |
| 44 | if (slot_data == NULL) { |
| 45 | return 0; |
| 46 | } |
| 47 | longlong last_insert_record_id = slot_data->last_insert_record_id; |
| 48 | return last_insert_record_id; |
| 49 | } |
| 50 | |
| 51 | MRN_API void last_insert_grn_id_deinit(UDF_INIT *init) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | MRN_END_DECLS |
| 56 | |