CHAPTER 22 SQLITE This example returns: Array (Web hosting providers)
CHAPTER 22 SQLITE This example returns: Array ( [empid] => integer [name] => varchar(25) [title] => varchar(25) ) Working with Binary Data SQLite is capable of storing binary information in a table, such as a GIF or JPEG image, a PDF document, or a Microsoft Word document. However, unless you treat this data carefully, errors in both storage and communication could arise. Several functions are available for carrying out the tasks necessary for managing this data, one of which is introduced in this section. The other two relevant functions are introduced in the next section. sqlite_escape_string() string sqlite_escape_string (string item) Some characters or character sequences have special meaning to a database, and therefore they must be treated with special care when trying to insert them into a table. For example, SQLite expects that single quotes signal the delimitation of a string. However, because this character is often used within data that you might want to include in a table column, a means is required for tricking the database server into ignoring single quotes on these occasions. This is commonly referred to as escaping these special characters, often done by prefacing the special character with some other character, a single quote (’) for example. Although you can do this manually, a function is available that will do the job for you. The sqlite_escape_string() function escapes any single quotes and other binary-unsafe characters intended for insertion in an SQLite table found in item. Let s use this function to escape an otherwise invalid query string: This returns: As they always say, this is ‘’an'’ example. If the string contains a NULL character or begins with 0×01, circumstances that have special meaning when working with binary data, sqlite_escape_string() will take the steps necessary to properly encode the information so that it can be safely stored and later retrieved.
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.