| 2132 | * Insert a row into a table ignoring errors, primarily to avoid an insert when it would conflict with an existing unique key entry. |
| 2133 | * |
| 2134 | * wpdb::insert_ignore( 'table', array( 'column' => 'foo', 'field' => 'bar' ) ) |
| 2135 | * wpdb::insert_ignore( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) ) |
| 2136 | * |
| 2137 | * @since 5.0.4 |
| 2138 | * @see wpdb::prepare() |
| 2139 | * @see wpdb::$field_types |
| 2140 | * @see wp_set_wpdb_vars() |
| 2141 | * |
| 2142 | * @param string $table Table name |
| 2143 | * @param array $data Data to insert (in column => value pairs). |
| 2144 | * Both $data columns and $data values should be "raw" (neither should be SQL escaped). |
| 2145 | * Sending a null value will cause the column to be set to NULL - the corresponding format is ignored in this case. |
| 2146 | * @param array|string $format Optional. An array of formats to be mapped to each of the value in $data. |
| 2147 | * If string, that format will be used for all of the values in $data. |
| 2148 | * A format is one of '%d', '%f', '%s' (integer, float, string). |
| 2149 | * If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types. |
| 2150 | * @return int|false The number of rows inserted, or false on error. This may be 0 so use identity operators (===, !==) to check for failure. |
| 2151 | */ |
| 2152 | public function insert_ignore( $table, $data, $format = null ) { |
| 2153 | return $this->_insert_replace_helper( $table, $data, $format, 'INSERT IGNORE' ); |
| 2154 | } |
| 2155 | |
| 2156 | |
| 2157 | /** |