| 1 | /***************************************************************************** | 
| 2 |  | 
| 3 | Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved. | 
| 4 | Copyright (c) 2017, 2018, MariaDB Corporation. | 
| 5 |  | 
| 6 | This program is free software; you can redistribute it and/or modify it under | 
| 7 | the terms of the GNU General Public License as published by the Free Software | 
| 8 | Foundation; version 2 of the License. | 
| 9 |  | 
| 10 | This program is distributed in the hope that it will be useful, but WITHOUT | 
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 
| 12 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | 
| 13 |  | 
| 14 | You should have received a copy of the GNU General Public License along with | 
| 15 | this program; if not, write to the Free Software Foundation, Inc., | 
| 16 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA | 
| 17 |  | 
| 18 | *****************************************************************************/ | 
| 19 |  | 
| 20 | /*******************************************************************//** | 
| 21 | @file include/ha_prototypes.h | 
| 22 | Prototypes for global functions in ha_innodb.cc that are called by | 
| 23 | InnoDB C code. | 
| 24 |  | 
| 25 | NOTE: This header is intended to insulate InnoDB from SQL names and functions. | 
| 26 | Do not include any headers other than univ.i into this unless they are very | 
| 27 | simple headers. | 
| 28 | ************************************************************************/ | 
| 29 |  | 
| 30 | #ifndef HA_INNODB_PROTOTYPES_H | 
| 31 | #define HA_INNODB_PROTOTYPES_H | 
| 32 |  | 
| 33 | #include "univ.i" | 
| 34 |  | 
| 35 | #ifndef UNIV_INNOCHECKSUM | 
| 36 |  | 
| 37 | /* Forward declarations */ | 
| 38 | class THD; | 
| 39 |  | 
| 40 | // JAN: TODO missing features: | 
| 41 | #undef MYSQL_FT_INIT_EXT | 
| 42 | #undef MYSQL_PFS | 
| 43 | #undef MYSQL_RENAME_INDEX | 
| 44 | #undef MYSQL_STORE_FTS_DOC_ID | 
| 45 |  | 
| 46 | /*******************************************************************//** | 
| 47 | Formats the raw data in "data" (in InnoDB on-disk format) that is of | 
| 48 | type DATA_(CHAR|VARCHAR|MYSQL|VARMYSQL) using "charset_coll" and writes | 
| 49 | the result to "buf". The result is converted to "system_charset_info". | 
| 50 | Not more than "buf_size" bytes are written to "buf". | 
| 51 | The result is always NUL-terminated (provided buf_size > 0) and the | 
| 52 | number of bytes that were written to "buf" is returned (including the | 
| 53 | terminating NUL). | 
| 54 | @return number of bytes that were written */ | 
| 55 | ulint | 
| 56 | innobase_raw_format( | 
| 57 | /*================*/ | 
| 58 | 	const char*	data,		/*!< in: raw data */ | 
| 59 | 	ulint		data_len,	/*!< in: raw data length | 
| 60 | 					in bytes */ | 
| 61 | 	ulint		charset_coll,	/*!< in: charset collation */ | 
| 62 | 	char*		buf,		/*!< out: output buffer */ | 
| 63 | 	ulint		buf_size);	/*!< in: output buffer size | 
| 64 | 					in bytes */ | 
| 65 |  | 
| 66 | /*****************************************************************//** | 
| 67 | Invalidates the MySQL query cache for the table. */ | 
| 68 | void | 
| 69 | innobase_invalidate_query_cache( | 
| 70 | /*============================*/ | 
| 71 | 	trx_t*		trx,		/*!< in: transaction which | 
| 72 | 					modifies the table */ | 
| 73 | 	const char*	full_name);	/*!< in: concatenation of | 
| 74 | 					database name, path separator, | 
| 75 | 					table name, null char NUL; | 
| 76 | 					NOTE that in Windows this is | 
| 77 | 					always in LOWER CASE! */ | 
| 78 |  | 
| 79 | /** Quote a standard SQL identifier like tablespace, index or column name. | 
| 80 | @param[in]	file	output stream | 
| 81 | @param[in]	trx	InnoDB transaction, or NULL | 
| 82 | @param[in]	id	identifier to quote */ | 
| 83 | void | 
| 84 | innobase_quote_identifier( | 
| 85 | 	FILE*		file, | 
| 86 | 	trx_t*		trx, | 
| 87 | 	const char*	id); | 
| 88 |  | 
| 89 | /** Quote an standard SQL identifier like tablespace, index or column name. | 
| 90 | Return the string as an std:string object. | 
| 91 | @param[in]	trx	InnoDB transaction, or NULL | 
| 92 | @param[in]	id	identifier to quote | 
| 93 | @return a std::string with id properly quoted. */ | 
| 94 | std::string | 
| 95 | innobase_quote_identifier( | 
| 96 | 	trx_t*		trx, | 
| 97 | 	const char*	id); | 
| 98 |  | 
| 99 | /*****************************************************************//** | 
| 100 | Convert a table name to the MySQL system_charset_info (UTF-8). | 
| 101 | @return pointer to the end of buf */ | 
| 102 | char* | 
| 103 | innobase_convert_name( | 
| 104 | /*==================*/ | 
| 105 | 	char*		buf,	/*!< out: buffer for converted identifier */ | 
| 106 | 	ulint		buflen,	/*!< in: length of buf, in bytes */ | 
| 107 | 	const char*	id,	/*!< in: table name to convert */ | 
| 108 | 	ulint		idlen,	/*!< in: length of id, in bytes */ | 
| 109 | 	THD*		thd);	/*!< in: MySQL connection thread, or NULL */ | 
| 110 |  | 
| 111 | /******************************************************************//** | 
| 112 | Returns true if the thread is the replication thread on the slave | 
| 113 | server. Used in srv_conc_enter_innodb() to determine if the thread | 
| 114 | should be allowed to enter InnoDB - the replication thread is treated | 
| 115 | differently than other threads. Also used in | 
| 116 | srv_conc_force_exit_innodb(). | 
| 117 | @return true if thd is the replication thread */ | 
| 118 | ibool | 
| 119 | thd_is_replication_slave_thread( | 
| 120 | /*============================*/ | 
| 121 | 	THD*	thd);	/*!< in: thread handle */ | 
| 122 |  | 
| 123 | /******************************************************************//** | 
| 124 | Returns true if the transaction this thread is processing has edited | 
| 125 | non-transactional tables. Used by the deadlock detector when deciding | 
| 126 | which transaction to rollback in case of a deadlock - we try to avoid | 
| 127 | rolling back transactions that have edited non-transactional tables. | 
| 128 | @return true if non-transactional tables have been edited */ | 
| 129 | ibool | 
| 130 | thd_has_edited_nontrans_tables( | 
| 131 | /*===========================*/ | 
| 132 | 	THD*	thd);	/*!< in: thread handle */ | 
| 133 |  | 
| 134 | /** | 
| 135 | Get high resolution timestamp for the current query start time. | 
| 136 |  | 
| 137 | @retval timestamp in microseconds precision | 
| 138 | */ | 
| 139 | unsigned long long thd_query_start_micro(const MYSQL_THD thd); | 
| 140 |  | 
| 141 | /*************************************************************//** | 
| 142 | Prints info of a THD object (== user session thread) to the given file. */ | 
| 143 | void | 
| 144 | innobase_mysql_print_thd( | 
| 145 | /*=====================*/ | 
| 146 | 	FILE*	f,		/*!< in: output stream */ | 
| 147 | 	THD*	thd,		/*!< in: pointer to a MySQL THD object */ | 
| 148 | 	uint	max_query_len);	/*!< in: max query length to print, or 0 to | 
| 149 | 				   use the default max length */ | 
| 150 |  | 
| 151 | /*****************************************************************//** | 
| 152 | Log code calls this whenever log has been written and/or flushed up | 
| 153 | to a new position. We use this to notify upper layer of a new commit | 
| 154 | checkpoint when necessary.*/ | 
| 155 | UNIV_INTERN | 
| 156 | void | 
| 157 | innobase_mysql_log_notify( | 
| 158 | /*======================*/ | 
| 159 | 	ib_uint64_t	flush_lsn);	/*!< in: LSN flushed to disk */ | 
| 160 |  | 
| 161 | /** Converts a MySQL type to an InnoDB type. Note that this function returns | 
| 162 | the 'mtype' of InnoDB. InnoDB differentiates between MySQL's old <= 4.1 | 
| 163 | VARCHAR and the new true VARCHAR in >= 5.0.3 by the 'prtype'. | 
| 164 | @param[out]	unsigned_flag		DATA_UNSIGNED if an 'unsigned type'; | 
| 165 | at least ENUM and SET, and unsigned integer types are 'unsigned types' | 
| 166 | @param[in]	f			MySQL Field | 
| 167 | @return DATA_BINARY, DATA_VARCHAR, ... */ | 
| 168 | ulint | 
| 169 | get_innobase_type_from_mysql_type( | 
| 170 | 	ulint*			unsigned_flag, | 
| 171 | 	const void*		field); | 
| 172 |  | 
| 173 | /******************************************************************//** | 
| 174 | Get the variable length bounds of the given character set. */ | 
| 175 | void | 
| 176 | innobase_get_cset_width( | 
| 177 | /*====================*/ | 
| 178 | 	ulint	cset,		/*!< in: MySQL charset-collation code */ | 
| 179 | 	ulint*	mbminlen,	/*!< out: minimum length of a char (in bytes) */ | 
| 180 | 	ulint*	mbmaxlen);	/*!< out: maximum length of a char (in bytes) */ | 
| 181 |  | 
| 182 | /******************************************************************//** | 
| 183 | Compares NUL-terminated UTF-8 strings case insensitively. | 
| 184 | @return 0 if a=b, <0 if a<b, >1 if a>b */ | 
| 185 | int | 
| 186 | innobase_strcasecmp( | 
| 187 | /*================*/ | 
| 188 | 	const char*	a,	/*!< in: first string to compare */ | 
| 189 | 	const char*	b);	/*!< in: second string to compare */ | 
| 190 |  | 
| 191 | /** Strip dir name from a full path name and return only the file name | 
| 192 | @param[in]	path_name	full path name | 
| 193 | @return file name or "null" if no file name */ | 
| 194 | const char* | 
| 195 | innobase_basename( | 
| 196 | 	const char*	path_name); | 
| 197 |  | 
| 198 | /******************************************************************//** | 
| 199 | Returns true if the thread is executing a SELECT statement. | 
| 200 | @return true if thd is executing SELECT */ | 
| 201 | ibool | 
| 202 | thd_is_select( | 
| 203 | /*==========*/ | 
| 204 | 	const THD*	thd);	/*!< in: thread handle */ | 
| 205 |  | 
| 206 | /******************************************************************//** | 
| 207 | Converts an identifier to a table name. */ | 
| 208 | void | 
| 209 | innobase_convert_from_table_id( | 
| 210 | /*===========================*/ | 
| 211 | 	CHARSET_INFO*	cs,	/*!< in: the 'from' character set */ | 
| 212 | 	char*		to,	/*!< out: converted identifier */ | 
| 213 | 	const char*	from,	/*!< in: identifier to convert */ | 
| 214 | 	ulint		len);	/*!< in: length of 'to', in bytes; should | 
| 215 | 				be at least 5 * strlen(to) + 1 */ | 
| 216 | /******************************************************************//** | 
| 217 | Converts an identifier to UTF-8. */ | 
| 218 | void | 
| 219 | innobase_convert_from_id( | 
| 220 | /*=====================*/ | 
| 221 | 	CHARSET_INFO*	cs,	/*!< in: the 'from' character set */ | 
| 222 | 	char*		to,	/*!< out: converted identifier */ | 
| 223 | 	const char*	from,	/*!< in: identifier to convert */ | 
| 224 | 	ulint		len);	/*!< in: length of 'to', in bytes; | 
| 225 | 				should be at least 3 * strlen(to) + 1 */ | 
| 226 | /******************************************************************//** | 
| 227 | Makes all characters in a NUL-terminated UTF-8 string lower case. */ | 
| 228 | void | 
| 229 | innobase_casedn_str( | 
| 230 | /*================*/ | 
| 231 | 	char*	a);	/*!< in/out: string to put in lower case */ | 
| 232 |  | 
| 233 | #ifdef WITH_WSREP | 
| 234 | UNIV_INTERN | 
| 235 | int | 
| 236 | wsrep_innobase_kill_one_trx(void * const thd_ptr, | 
| 237 |                             const trx_t * const bf_trx, | 
| 238 |                             trx_t *victim_trx, | 
| 239 |                             ibool signal); | 
| 240 | ulint wsrep_innobase_mysql_sort(int mysql_type, uint charset_number, | 
| 241 |                              unsigned char* str, unsigned int str_length, | 
| 242 |                              unsigned int buf_length); | 
| 243 | #endif /* WITH_WSREP */ | 
| 244 |  | 
| 245 | /**********************************************************************//** | 
| 246 | Determines the connection character set. | 
| 247 | @return connection character set */ | 
| 248 | CHARSET_INFO* | 
| 249 | innobase_get_charset( | 
| 250 | /*=================*/ | 
| 251 | 	THD*	thd);	/*!< in: MySQL thread handle */ | 
| 252 |  | 
| 253 | /** Determines the current SQL statement. | 
| 254 | Thread unsafe, can only be called from the thread owning the THD. | 
| 255 | @param[in]	thd	MySQL thread handle | 
| 256 | @param[out]	length	Length of the SQL statement | 
| 257 | @return			SQL statement string */ | 
| 258 | const char* | 
| 259 | innobase_get_stmt_unsafe( | 
| 260 | 	THD*	thd, | 
| 261 | 	size_t*	length); | 
| 262 |  | 
| 263 | /** Determines the current SQL statement. | 
| 264 | Thread safe, can be called from any thread as the string is copied | 
| 265 | into the provided buffer. | 
| 266 | @param[in]	thd	MySQL thread handle | 
| 267 | @param[out]	buf	Buffer containing SQL statement | 
| 268 | @param[in]	buflen	Length of provided buffer | 
| 269 | @return			Length of the SQL statement */ | 
| 270 | size_t | 
| 271 | innobase_get_stmt_safe( | 
| 272 | 	THD*	thd, | 
| 273 | 	char*	buf, | 
| 274 | 	size_t	buflen); | 
| 275 |  | 
| 276 | /******************************************************************//** | 
| 277 | This function is used to find the storage length in bytes of the first n | 
| 278 | characters for prefix indexes using a multibyte character set. The function | 
| 279 | finds charset information and returns length of prefix_len characters in the | 
| 280 | index field in bytes. | 
| 281 | @return number of bytes occupied by the first n characters */ | 
| 282 | ulint | 
| 283 | innobase_get_at_most_n_mbchars( | 
| 284 | /*===========================*/ | 
| 285 | 	ulint charset_id,	/*!< in: character set id */ | 
| 286 | 	ulint prefix_len,	/*!< in: prefix length in bytes of the index | 
| 287 | 				(this has to be divided by mbmaxlen to get the | 
| 288 | 				number of CHARACTERS n in the prefix) */ | 
| 289 | 	ulint data_len,		/*!< in: length of the string in bytes */ | 
| 290 | 	const char* str);	/*!< in: character string */ | 
| 291 |  | 
| 292 | /** Get status of innodb_tmpdir. | 
| 293 | @param[in]	thd	thread handle, or NULL to query | 
| 294 | 			the global innodb_tmpdir. | 
| 295 | @retval NULL if innodb_tmpdir="" */ | 
| 296 | UNIV_INTERN | 
| 297 | const char* | 
| 298 | thd_innodb_tmpdir( | 
| 299 | 	THD*	thd); | 
| 300 |  | 
| 301 | /******************************************************************//** | 
| 302 | Returns the lock wait timeout for the current connection. | 
| 303 | @return the lock wait timeout, in seconds */ | 
| 304 | ulong | 
| 305 | thd_lock_wait_timeout( | 
| 306 | /*==================*/ | 
| 307 | 	THD*	thd);	/*!< in: thread handle, or NULL to query | 
| 308 | 			the global innodb_lock_wait_timeout */ | 
| 309 | /** Get status of innodb_tmpdir. | 
| 310 | @param[in]	thd	thread handle, or NULL to query | 
| 311 | 			the global innodb_tmpdir. | 
| 312 | @retval NULL if innodb_tmpdir="" */ | 
| 313 | const char* | 
| 314 | thd_innodb_tmpdir( | 
| 315 | 	THD*	thd); | 
| 316 |  | 
| 317 | /**********************************************************************//** | 
| 318 | Get the current setting of the table_cache_size global parameter. We do | 
| 319 | a dirty read because for one there is no synchronization object and | 
| 320 | secondly there is little harm in doing so even if we get a torn read. | 
| 321 | @return SQL statement string */ | 
| 322 | ulint | 
| 323 | innobase_get_table_cache_size(void); | 
| 324 | /*===============================*/ | 
| 325 |  | 
| 326 | /**********************************************************************//** | 
| 327 | Get the current setting of the lower_case_table_names global parameter from | 
| 328 | mysqld.cc. We do a dirty read because for one there is no synchronization | 
| 329 | object and secondly there is little harm in doing so even if we get a torn | 
| 330 | read. | 
| 331 | @return value of lower_case_table_names */ | 
| 332 | ulint | 
| 333 | innobase_get_lower_case_table_names(void); | 
| 334 | /*=====================================*/ | 
| 335 |  | 
| 336 | /******************************************************************//** | 
| 337 | compare two character string case insensitively according to their charset. */ | 
| 338 | int | 
| 339 | innobase_fts_text_case_cmp( | 
| 340 | /*=======================*/ | 
| 341 | 	const void*	cs,		/*!< in: Character set */ | 
| 342 | 	const void*	p1,		/*!< in: key */ | 
| 343 | 	const void*	p2);		/*!< in: node */ | 
| 344 |  | 
| 345 | /******************************************************************//** | 
| 346 | Returns true if transaction should be flagged as read-only. | 
| 347 | @return true if the thd is marked as read-only */ | 
| 348 | bool | 
| 349 | thd_trx_is_read_only( | 
| 350 | /*=================*/ | 
| 351 | 	THD*	thd);	/*!< in/out: thread handle */ | 
| 352 |  | 
| 353 | /******************************************************************//** | 
| 354 | Check if the transaction is an auto-commit transaction. TRUE also | 
| 355 | implies that it is a SELECT (read-only) transaction. | 
| 356 | @return true if the transaction is an auto commit read-only transaction. */ | 
| 357 | ibool | 
| 358 | thd_trx_is_auto_commit( | 
| 359 | /*===================*/ | 
| 360 | 	THD*	thd);	/*!< in: thread handle, or NULL */ | 
| 361 |  | 
| 362 | /******************************************************************//** | 
| 363 | Get the thread start time. | 
| 364 | @return the thread start time in seconds since the epoch. */ | 
| 365 | ulint | 
| 366 | thd_start_time_in_secs( | 
| 367 | /*===================*/ | 
| 368 | 	THD*	thd);	/*!< in: thread handle, or NULL */ | 
| 369 |  | 
| 370 | /*****************************************************************//** | 
| 371 | A wrapper function of innobase_convert_name(), convert a table name | 
| 372 | to the MySQL system_charset_info (UTF-8) and quote it if needed. | 
| 373 | @return pointer to the end of buf */ | 
| 374 | void | 
| 375 | innobase_format_name( | 
| 376 | /*==================*/ | 
| 377 | 	char*		buf,	/*!< out: buffer for converted identifier */ | 
| 378 | 	ulint		buflen,	/*!< in: length of buf, in bytes */ | 
| 379 | 	const char*	name);	/*!< in: table name to format */ | 
| 380 |  | 
| 381 | /** Corresponds to Sql_condition:enum_warning_level. */ | 
| 382 | enum ib_log_level_t { | 
| 383 | 	IB_LOG_LEVEL_INFO, | 
| 384 | 	IB_LOG_LEVEL_WARN, | 
| 385 | 	IB_LOG_LEVEL_ERROR, | 
| 386 | 	IB_LOG_LEVEL_FATAL | 
| 387 | }; | 
| 388 |  | 
| 389 | /******************************************************************//** | 
| 390 | Use this when the args are first converted to a formatted string and then | 
| 391 | passed to the format string from errmsg-utf8.txt. The error message format | 
| 392 | must be: "Some string ... %s". | 
| 393 |  | 
| 394 | Push a warning message to the client, it is a wrapper around: | 
| 395 |  | 
| 396 | void push_warning_printf( | 
| 397 | 	THD *thd, Sql_condition::enum_warning_level level, | 
| 398 | 	uint code, const char *format, ...); | 
| 399 | */ | 
| 400 | void | 
| 401 | ib_errf( | 
| 402 | /*====*/ | 
| 403 | 	THD*		thd,		/*!< in/out: session */ | 
| 404 | 	ib_log_level_t	level,		/*!< in: warning level */ | 
| 405 | 	ib_uint32_t	code,		/*!< MySQL error code */ | 
| 406 | 	const char*	format,		/*!< printf format */ | 
| 407 | 	...)				/*!< Args */ | 
| 408 | 	MY_ATTRIBUTE((format(printf, 4, 5))); | 
| 409 |  | 
| 410 | /******************************************************************//** | 
| 411 | Use this when the args are passed to the format string from | 
| 412 | errmsg-utf8.txt directly as is. | 
| 413 |  | 
| 414 | Push a warning message to the client, it is a wrapper around: | 
| 415 |  | 
| 416 | void push_warning_printf( | 
| 417 | 	THD *thd, Sql_condition::enum_warning_level level, | 
| 418 | 	uint code, const char *format, ...); | 
| 419 | */ | 
| 420 | void | 
| 421 | ib_senderrf( | 
| 422 | /*========*/ | 
| 423 | 	THD*		thd,		/*!< in/out: session */ | 
| 424 | 	ib_log_level_t	level,		/*!< in: warning level */ | 
| 425 | 	ib_uint32_t	code,		/*!< MySQL error code */ | 
| 426 | 	...);				/*!< Args */ | 
| 427 |  | 
| 428 | extern const char* 	TROUBLESHOOTING_MSG; | 
| 429 | extern const char* 	TROUBLESHOOT_DATADICT_MSG; | 
| 430 | extern const char* 	BUG_REPORT_MSG; | 
| 431 | extern const char* 	FORCE_RECOVERY_MSG; | 
| 432 | extern const char*      ERROR_CREATING_MSG; | 
| 433 | extern const char*      OPERATING_SYSTEM_ERROR_MSG; | 
| 434 | extern const char*      FOREIGN_KEY_CONSTRAINTS_MSG; | 
| 435 | extern const char*      SET_TRANSACTION_MSG; | 
| 436 | extern const char*      INNODB_PARAMETERS_MSG; | 
| 437 |  | 
| 438 | /******************************************************************//** | 
| 439 | Returns the NUL terminated value of glob_hostname. | 
| 440 | @return pointer to glob_hostname. */ | 
| 441 | const char* | 
| 442 | server_get_hostname(); | 
| 443 | /*=================*/ | 
| 444 |  | 
| 445 | /*********************************************************************//** | 
| 446 | Compute the next autoinc value. | 
| 447 |  | 
| 448 | For MySQL replication the autoincrement values can be partitioned among | 
| 449 | the nodes. The offset is the start or origin of the autoincrement value | 
| 450 | for a particular node. For n nodes the increment will be n and the offset | 
| 451 | will be in the interval [1, n]. The formula tries to allocate the next | 
| 452 | value for a particular node. | 
| 453 |  | 
| 454 | Note: This function is also called with increment set to the number of | 
| 455 | values we want to reserve for multi-value inserts e.g., | 
| 456 |  | 
| 457 | 	INSERT INTO T VALUES(), (), (); | 
| 458 |  | 
| 459 | innobase_next_autoinc() will be called with increment set to 3 where | 
| 460 | autoinc_lock_mode != TRADITIONAL because we want to reserve 3 values for | 
| 461 | the multi-value INSERT above. | 
| 462 | @return the next value */ | 
| 463 | ulonglong | 
| 464 | innobase_next_autoinc( | 
| 465 | /*==================*/ | 
| 466 | 	ulonglong	current,	/*!< in: Current value */ | 
| 467 | 	ulonglong	need,		/*!< in: count of values needed */ | 
| 468 | 	ulonglong	step,		/*!< in: AUTOINC increment step */ | 
| 469 | 	ulonglong	offset,		/*!< in: AUTOINC offset */ | 
| 470 | 	ulonglong	max_value)	/*!< in: max value for type */ | 
| 471 | 	MY_ATTRIBUTE((pure, warn_unused_result)); | 
| 472 |  | 
| 473 | /********************************************************************** | 
| 474 | Converts an identifier from my_charset_filename to UTF-8 charset. */ | 
| 475 | uint | 
| 476 | innobase_convert_to_system_charset( | 
| 477 | /*===============================*/ | 
| 478 | 	char*           to,		/* out: converted identifier */ | 
| 479 | 	const char*     from,		/* in: identifier to convert */ | 
| 480 | 	ulint           len,		/* in: length of 'to', in bytes */ | 
| 481 | 	uint*		errors);	/* out: error return */ | 
| 482 | /********************************************************************** | 
| 483 | Check if the length of the identifier exceeds the maximum allowed. | 
| 484 | The input to this function is an identifier in charset my_charset_filename. | 
| 485 | return true when length of identifier is too long. */ | 
| 486 | my_bool | 
| 487 | innobase_check_identifier_length( | 
| 488 | /*=============================*/ | 
| 489 | 	const char*	id);	/* in: identifier to check.  it must belong | 
| 490 | 				to charset my_charset_filename */ | 
| 491 |  | 
| 492 | /********************************************************************** | 
| 493 | Converts an identifier from my_charset_filename to UTF-8 charset. */ | 
| 494 | uint | 
| 495 | innobase_convert_to_system_charset( | 
| 496 | /*===============================*/ | 
| 497 | 	char*		to,		/* out: converted identifier */ | 
| 498 | 	const char*	from,		/* in: identifier to convert */ | 
| 499 | 	ulint		len,		/* in: length of 'to', in bytes */ | 
| 500 | 	uint*		errors);	/* out: error return */ | 
| 501 |  | 
| 502 | /********************************************************************** | 
| 503 | Converts an identifier from my_charset_filename to UTF-8 charset. */ | 
| 504 | uint | 
| 505 | innobase_convert_to_filename_charset( | 
| 506 | /*=================================*/ | 
| 507 | 	char*		to,	/* out: converted identifier */ | 
| 508 | 	const char*	from,	/* in: identifier to convert */ | 
| 509 | 	ulint		len);	/* in: length of 'to', in bytes */ | 
| 510 |  | 
| 511 | /********************************************************************//** | 
| 512 | Helper function to push warnings from InnoDB internals to SQL-layer. */ | 
| 513 | UNIV_INTERN | 
| 514 | void | 
| 515 | ib_push_warning( | 
| 516 | 	trx_t*		trx,	/*!< in: trx */ | 
| 517 | 	dberr_t		error,	/*!< in: error code to push as warning */ | 
| 518 | 	const char	*format,/*!< in: warning message */ | 
| 519 | 	...); | 
| 520 |  | 
| 521 | /********************************************************************//** | 
| 522 | Helper function to push warnings from InnoDB internals to SQL-layer. */ | 
| 523 | UNIV_INTERN | 
| 524 | void | 
| 525 | ib_push_warning( | 
| 526 | 	void*		ithd,	/*!< in: thd */ | 
| 527 | 	dberr_t		error,	/*!< in: error code to push as warning */ | 
| 528 | 	const char	*format,/*!< in: warning message */ | 
| 529 | 	...); | 
| 530 |  | 
| 531 | /*****************************************************************//** | 
| 532 | Normalizes a table name string. A normalized name consists of the | 
| 533 | database name catenated to '/' and table name. An example: | 
| 534 | test/mytable. On Windows normalization puts both the database name and the | 
| 535 | table name always to lower case if "set_lower_case" is set to TRUE. */ | 
| 536 | void | 
| 537 | normalize_table_name_c_low( | 
| 538 | /*=======================*/ | 
| 539 | 	char*		norm_name,	/*!< out: normalized name as a | 
| 540 | 					null-terminated string */ | 
| 541 | 	const char*	name,		/*!< in: table name string */ | 
| 542 | 	ibool		set_lower_case); /*!< in: TRUE if we want to set | 
| 543 | 					name to lower case */ | 
| 544 | /*************************************************************//** | 
| 545 | InnoDB index push-down condition check defined in ha_innodb.cc | 
| 546 | @return ICP_NO_MATCH, ICP_MATCH, or ICP_OUT_OF_RANGE */ | 
| 547 |  | 
| 548 | #include <my_compare.h> | 
| 549 |  | 
| 550 | ICP_RESULT | 
| 551 | innobase_index_cond( | 
| 552 | /*================*/ | 
| 553 | 	void*	file)	/*!< in/out: pointer to ha_innobase */ | 
| 554 | 	MY_ATTRIBUTE((warn_unused_result)); | 
| 555 |  | 
| 556 | /******************************************************************//** | 
| 557 | Gets information on the durability property requested by thread. | 
| 558 | Used when writing either a prepare or commit record to the log | 
| 559 | buffer. | 
| 560 | @return the durability property. */ | 
| 561 |  | 
| 562 | #include <dur_prop.h> | 
| 563 |  | 
| 564 | enum durability_properties | 
| 565 | thd_requested_durability( | 
| 566 | /*=====================*/ | 
| 567 | 	const THD* thd)	/*!< in: thread handle */ | 
| 568 | 	MY_ATTRIBUTE((warn_unused_result)); | 
| 569 |  | 
| 570 | /** Update the system variable with the given value of the InnoDB | 
| 571 | buffer pool size. | 
| 572 | @param[in]	buf_pool_size	given value of buffer pool size.*/ | 
| 573 | void | 
| 574 | innodb_set_buf_pool_size(ulonglong buf_pool_size); | 
| 575 |  | 
| 576 | /** Create a MYSQL_THD for a background thread and mark it as such. | 
| 577 | @param name thread info for SHOW PROCESSLIST | 
| 578 | @return new MYSQL_THD */ | 
| 579 | MYSQL_THD | 
| 580 | innobase_create_background_thd(const char* name); | 
| 581 |  | 
| 582 | /** Destroy a background purge thread THD. | 
| 583 | @param[in]	thd	MYSQL_THD to destroy */ | 
| 584 | void | 
| 585 | innobase_destroy_background_thd(MYSQL_THD); | 
| 586 |  | 
| 587 | /** Close opened tables, free memory, delete items for a MYSQL_THD. | 
| 588 | @param[in]	thd	MYSQL_THD to reset */ | 
| 589 | void | 
| 590 | innobase_reset_background_thd(MYSQL_THD); | 
| 591 |  | 
| 592 | #endif /* !UNIV_INNOCHECKSUM */ | 
| 593 | #endif /* HA_INNODB_PROTOTYPES_H */ | 
| 594 |  |