array_ndims(array) - Get number of dimensions
(conn: &Connection)
| 143 | |
| 144 | /// array_ndims(array) - Get number of dimensions |
| 145 | fn register_array_ndims(conn: &Connection) -> Result<()> { |
| 146 | conn.create_scalar_function( |
| 147 | "array_ndims", |
| 148 | 1, |
| 149 | FunctionFlags::SQLITE_UTF8 | FunctionFlags::SQLITE_DETERMINISTIC, |
| 150 | |ctx| { |
| 151 | let array_json: String = ctx.get(0)?; |
| 152 | |
| 153 | match serde_json::from_str::<JsonValue>(&array_json) { |
| 154 | Ok(json) => Ok(Some(count_dimensions(&json))), |
| 155 | _ => Ok(None), |
| 156 | } |
| 157 | }, |
| 158 | )?; |
| 159 | |
| 160 | Ok(()) |
| 161 | } |
| 162 | |
| 163 | /// array_append(array, element) - Append element to array |
| 164 | fn register_array_append(conn: &Connection) -> Result<()> { |
no test coverage detected