222 Part II . (Space web hosting) SQL Essentials The final
222 Part II . SQL Essentials The final string-related SELECT/WHERE function that I cover in this chapter is the LOAD_FILE function. You can use this function to tell MySQL to read in the contents of a given file as a string. Note that the contents of the file must be smaller than the MySQL variable max_allowed_packet. The syntax for the LOAD_FILE function calls for you to provide the full path and filename. The function will return NULL if you don t have permission to read the file from the operating system. Examples of successful and failed usage of the LOAD_FILEfunction look like this: SELECT LOAD_FILE( /home/suehring/testfile.txt ); SELECT LOAD_FILE( /etc/shadow ); The results of these examples appear in Figure 9-51. Note You must have the FILEprivilege before you can use the LOAD_FILE function. In addition, you must have appropriate permissions to work with the file itself. Figure 9-51: A successful and failed use of the LOAD_FILE function
In case you need quality webspace to host and run your web applications, try our personal web hosting services.