TAILIEUCHUNG - PHP Programming with PEARXML, Data, Dates, Web Services, and Web APIs - Part 2

Kiểu dữ liệu Để giải quyết vấn đề của các hệ thống cơ sở dữ liệu khác nhau hỗ trợ các loại lĩnh vực khác nhau, MDB2 đi kèm với thiết lập di động của riêng mình của các loại dữ liệu. Bạn có thể sử dụng MDB2 của các kiểu dữ liệu và có các gói phần mềm đảm bảo tính di động trên RDBMS khác nhau bằng cách lập bản đồ các loại cho những người mà cơ sở dữ liệu cơ bản hiểu. Các MDB2 kiểu dữ liệu và các giá trị mặc định của họ như sau:. | MDB2 Data Types To address the issue of different database systems supporting different field types MDB2 comes with its own portable set of data types. You can use MDB2 s data types and have the package ensure portability across different RDBMS by mapping those types to ones that the underlying database understands. The MDB2 data types and their default values are as follows valid_types array text boolean true integer 0 decimal float timestamp 1970-01-01 00 00 00 time 00 00 00 date 1970-01-01 clob blob More detailed information on the data types is available in the document you can find in the docs folder of your PEAR installation. You can also find this document on the Web in the PEAR CVS repository http pear MDB2 docs view co Setting Data Types In all the data retrieval methods that you just saw query fetch get you can specify the type of the results you expect and MDB2 will convert the values to the expected data type. For example the query method accepts an array of field data types as a second parameter. sql SELECT FROM people types array result mdb2- query sql types row result- fetchRow var_dump row Here the types array was blank so you ll get the default behavior no data type conversion and all the results will be strings. The output of this example is array 2 id string 1 1 name string 5 Eddie 18 Chapter 1 But you can specify that the first field in each record is of type integer and the second is text by setting the types array like this types array integer text In this case you ll get array 2 id int 1 name string 5 Eddie . When setting the types you can also use an associative array where the keys are the table fields. You can even skip some fields if you don t need to set the type for them. Some valid examples types array id integer name text types array name text types array integer Setting Data Types when Fetching Results If you didn t set the data types during a query call it s still not too

TỪ KHÓA 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.