Changeset 34737 for trunk/src/wp-includes/wp-db.php
- Timestamp:
- 10/01/2015 05:36:15 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/wp-db.php
r34655 r34737 1780 1780 * @param array $data Data to insert (in column => value pairs). 1781 1781 * Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1782 * Sending a null value will cause the column to be set to NULL - the corresponding format is ignored in this case. 1782 1783 * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. 1783 1784 * If string, that format will be used for all of the values in $data. … … 1804 1805 * @param array $data Data to insert (in column => value pairs). 1805 1806 * Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1807 * Sending a null value will cause the column to be set to NULL - the corresponding format is ignored in this case. 1806 1808 * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. 1807 1809 * If string, that format will be used for all of the values in $data. … … 1828 1830 * @param array $data Data to insert (in column => value pairs). 1829 1831 * Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1832 * Sending a null value will cause the column to be set to NULL - the corresponding format is ignored in this case. 1830 1833 * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. 1831 1834 * If string, that format will be used for all of the values in $data. … … 1849 1852 $formats = $values = array(); 1850 1853 foreach ( $data as $value ) { 1854 if ( is_null( $value['value'] ) ) { 1855 $formats[] = 'NULL'; 1856 continue; 1857 } 1858 1851 1859 $formats[] = $value['format']; 1852 1860 $values[] = $value['value']; … … 1876 1884 * @param array $data Data to update (in column => value pairs). 1877 1885 * Both $data columns and $data values should be "raw" (neither should be SQL escaped). 1886 * Sending a null value will cause the column to be set to NULL - the corresponding 1887 * format is ignored in this case. 1878 1888 * @param array $where A named array of WHERE clauses (in column => value pairs). 1879 1889 * Multiple clauses will be joined with ANDs. 1880 1890 * Both $where columns and $where values should be "raw". 1891 * Sending a null value will create an IS NULL comparison - the corresponding format will be ignored in this case. 1881 1892 * @param array|string $format Optional. An array of formats to be mapped to each of the values in $data. 1882 1893 * If string, that format will be used for all of the values in $data. … … 1905 1916 $fields = $conditions = $values = array(); 1906 1917 foreach ( $data as $field => $value ) { 1918 if ( is_null( $value['value'] ) ) { 1919 $fields[] = "`$field` = NULL"; 1920 continue; 1921 } 1922 1907 1923 $fields[] = "`$field` = " . $value['format']; 1908 1924 $values[] = $value['value']; 1909 1925 } 1910 1926 foreach ( $where as $field => $value ) { 1927 if ( is_null( $value['value'] ) ) { 1928 $conditions[] = "`$field` IS NULL"; 1929 continue; 1930 } 1931 1911 1932 $conditions[] = "`$field` = " . $value['format']; 1912 1933 $values[] = $value['value']; … … 1937 1958 * Multiple clauses will be joined with ANDs. 1938 1959 * Both $where columns and $where values should be "raw". 1960 * Sending a null value will create an IS NULL comparison - the corresponding format will be ignored in this case. 1939 1961 * @param array|string $where_format Optional. An array of formats to be mapped to each of the values in $where. 1940 1962 * If string, that format will be used for all of the items in $where. … … 1955 1977 $conditions = $values = array(); 1956 1978 foreach ( $where as $field => $value ) { 1979 if ( is_null( $value['value'] ) ) { 1980 $conditions[] = "`$field` IS NULL"; 1981 continue; 1982 } 1983 1957 1984 $conditions[] = "`$field` = " . $value['format']; 1958 1985 $values[] = $value['value'];
Note: See TracChangeset
for help on using the changeset viewer.