Đang chuẩn bị liên kết để tải về tài liệu:
OBJECT-ORIENTED PHP Concepts, Techniques, and Code- P18

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

OBJECT-ORIENTED PHP Concepts, Techniques, and Code- P18:A number of years ago, before I started using PHP, I created dynamic web pages using C. This really wasn’t too different from some of the other options available at the time, though it seems almost unthinkable now. Creating a dynamic page meant outputting HTML from your script and recompiling that script if any changes needed to be made. | Utility Methods By overriding all the query methods of the SQLiteDatabase class we ensure that any failed query throws an exception. This done we needn t worry about error trapping whenever we perform a query. The remaining methods of our derived class are utility methods aimed at helping verify data posted from a form. These methods give us an opportunity to explore some of the ways to retrieve metadata from an SQLite database. Find those methods in Listing 15-8. Get all table names in database public function getTableNames if isset this- tablenames this- setTablenames return this- tablenames Retrieve field names types for specified table public function getFields tablename if isset this- tablenames this- setTablenames if in_array tablename this- tablenames throw new SQLiteException Table tablename not in database. fieldnames array sql PRAGMA table_info tablename result this- unbufferedQuery sql no error - bad pragma ignored get name and data type as defined upon creation foreach result as row fieldnames row name row type return fieldnames private methods private method - initializes table names array private function OsetTableNames sql SELECT name . FROM sqlite_master . WHERE type table . OR type view result this- unbufferedQuery sql foreach result as row this- tablenames row name Listing 15-8 Metadata methods Extending SQLite 151 The two methods that make use of metadata are setTableNames and getFieldNames. Let s examine O the method setTableNames in Listing 15-8. This method makes use of the table sqlite_master a table that defines the schema for the database. By querying sqlite_master we can retrieve the names of all the tables and views in the database. The type field defines the kind of resource in our case a table or view. This method retrieves the names of all the tables and views and stores them in an array. Ideally this method would be called once from the constructor but the constructor for an SQLite database is declared final so it may not be .

TÀI LIỆU LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.