| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify it under |
| 6 | the terms of the GNU General Public License as published by the Free Software |
| 7 | Foundation; version 2 of the License. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU General Public License along with |
| 14 | this program; if not, write to the Free Software Foundation, Inc., |
| 15 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA |
| 16 | |
| 17 | *****************************************************************************/ |
| 18 | |
| 19 | /******************************************************************//** |
| 20 | @file include/fts0priv.ic |
| 21 | Full text search internal header file |
| 22 | |
| 23 | Created 2011/11/12 Sunny Bains |
| 24 | ***********************************************************************/ |
| 25 | |
| 26 | /******************************************************************//** |
| 27 | Write the table id to the given buffer (including final NUL). Buffer must be |
| 28 | at least FTS_AUX_MIN_TABLE_ID_LENGTH bytes long. |
| 29 | @return number of bytes written */ |
| 30 | UNIV_INLINEcxx . . $ `storage/innobase/include/univ.i:168:9`! |
| 31 | int |
| 32 | fts_write_object_idcxx . . $ fts_write_object_id(2324ad226b7e9d8f).( |
| 33 | /*================*/ |
| 34 | ib_id_tcxx . . $ ib_id_t# id, /* in: a table/index id */ |
| 35 | char* str, /* in: buffer to write the id to */ |
| 36 | size_t str_size) /* in: size of buffer */ |
| 37 | { |
| 38 | return((int) snprintf(str, str_size, "%016llx", (ulonglongcxx . . $ ulonglong#) id)); |
| 39 | } |
| 40 | |
| 41 | /******************************************************************//** |
| 42 | Read the table id from the string generated by fts_write_object_id(). |
| 43 | @return TRUE if parse successful */ |
| 44 | UNIV_INLINEcxx . . $ `storage/innobase/include/univ.i:168:9`! |
| 45 | iboolcxx . . $ `storage/innobase/include/univ.i:355:9`! |
| 46 | fts_read_object_idcxx . . $ fts_read_object_id(eb2066c7e3b9159c).( |
| 47 | /*===============*/ |
| 48 | ib_id_tcxx . . $ ib_id_t#* id, /* out: an id */ |
| 49 | const char* str) /* in: buffer to read from */ |
| 50 | { |
| 51 | /* NOTE: this func doesn't care about whether current table |
| 52 | is set with HEX_NAME, the user of the id read here will check |
| 53 | if the id is HEX or DEC and do the right thing with it. */ |
| 54 | return(sscanf(str, UINT64PFxcxx . . $ `storage/innobase/include/univ.i:315:10`!, id) == 1); |
| 55 | } |