#include <item_strfunc.h>
Inheritance diagram for Item_load_file:


Public Member Functions | |
| Item_load_file (Item *a) | |
| String * | val_str (String *) |
| const char * | func_name () const |
| void | fix_length_and_dec () |
Private Attributes | |
| String | tmp_value |
Definition at line 643 of file item_strfunc.h.
| Item_load_file::Item_load_file | ( | Item * | a | ) | [inline] |
| void Item_load_file::fix_length_and_dec | ( | ) | [inline, virtual] |
Implements Item_result_field.
Definition at line 650 of file item_strfunc.h.
References Item::collation, DERIVATION_COERCIBLE, MAX_BLOB_WIDTH, Item::max_length, Item::maybe_null, my_charset_bin, and DTCollation::set().
00651 { 00652 collation.set(&my_charset_bin, DERIVATION_COERCIBLE); 00653 maybe_null=1; 00654 max_length=MAX_BLOB_WIDTH; 00655 }
Here is the call graph for this function:

| const char* Item_load_file::func_name | ( | ) | const [inline, virtual] |
Implements Item_func.
Definition at line 649 of file item_strfunc.h.
Referenced by val_str().
Here is the caller graph for this function:

Implements Item.
Definition at line 2603 of file item_strfunc.cc.
References String::alloc(), Item_func::args, String::c_ptr(), current_thd, DBUG_ASSERT, DBUG_ENTER, DBUG_RETURN, ER, ER_WARN_ALLOWED_PACKET_OVERFLOWED, err, FILE_ACL, Item::fixed, fn_format(), FN_REFLEN, func_name(), String::length(), my_close(), MY_NABP, my_open(), my_read, MY_RELATIVE_PATH, my_stat(), MY_STAT, MY_UNPACK_FILENAME, MYF, mysql_real_data_home, Item::null_value, path, String::ptr(), push_warning_printf(), S_IROTH, tmp_value, and MYSQL_ERROR::WARN_LEVEL_WARN.
02604 { 02605 DBUG_ASSERT(fixed == 1); 02606 String *file_name; 02607 File file; 02608 MY_STAT stat_info; 02609 char path[FN_REFLEN]; 02610 DBUG_ENTER("load_file"); 02611 02612 if (!(file_name= args[0]->val_str(str)) 02613 #ifndef NO_EMBEDDED_ACCESS_CHECKS 02614 || !(current_thd->security_ctx->master_access & FILE_ACL) 02615 #endif 02616 ) 02617 goto err; 02618 02619 (void) fn_format(path, file_name->c_ptr(), mysql_real_data_home, "", 02620 MY_RELATIVE_PATH | MY_UNPACK_FILENAME); 02621 02622 if (!my_stat(path, &stat_info, MYF(0))) 02623 goto err; 02624 02625 if (!(stat_info.st_mode & S_IROTH)) 02626 { 02627 /* my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), file_name->c_ptr()); */ 02628 goto err; 02629 } 02630 if (stat_info.st_size > (long) current_thd->variables.max_allowed_packet) 02631 { 02632 push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, 02633 ER_WARN_ALLOWED_PACKET_OVERFLOWED, 02634 ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), 02635 func_name(), current_thd->variables.max_allowed_packet); 02636 goto err; 02637 } 02638 if (tmp_value.alloc(stat_info.st_size)) 02639 goto err; 02640 if ((file = my_open(file_name->c_ptr(), O_RDONLY, MYF(0))) < 0) 02641 goto err; 02642 if (my_read(file, (byte*) tmp_value.ptr(), stat_info.st_size, MYF(MY_NABP))) 02643 { 02644 my_close(file, MYF(0)); 02645 goto err; 02646 } 02647 tmp_value.length(stat_info.st_size); 02648 my_close(file, MYF(0)); 02649 null_value = 0; 02650 DBUG_RETURN(&tmp_value); 02651 02652 err: 02653 null_value = 1; 02654 DBUG_RETURN(0); 02655 }
Here is the call graph for this function:

String Item_load_file::tmp_value [private] |
1.4.7

