| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <array> | 9 #include <array> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 if (checkForBadKeyword(data, size)) | 41 if (checkForBadKeyword(data, size)) |
| 42 return 0; | 42 return 0; |
| 43 | 43 |
| 44 sqlite3* db; | 44 sqlite3* db; |
| 45 int return_code = sqlite3_open_v2( | 45 int return_code = sqlite3_open_v2( |
| 46 "db.db", | 46 "db.db", |
| 47 &db, | 47 &db, |
| 48 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MEMORY, 0); | 48 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MEMORY, 0); |
| 49 | 49 |
| 50 | |
| 51 if (SQLITE_OK != return_code) | 50 if (SQLITE_OK != return_code) |
| 52 return 0; | 51 return 0; |
| 53 | 52 |
| 54 // Use first byte as random selector for other parameters. | 53 // Use first byte as random selector for other parameters. |
| 55 int selector = data[0]; | 54 int selector = data[0]; |
| 56 | 55 |
| 57 // To cover both cases when progress_handler is used and isn't used. | 56 // To cover both cases when progress_handler is used and isn't used. |
| 58 if (selector & 1) | 57 if (selector & 1) |
| 59 sqlite3_progress_handler(db, 4, &Progress, NULL); | 58 sqlite3_progress_handler(db, 4, &Progress, NULL); |
| 60 else | 59 else |
| (...skipping 11 matching lines...) Expand all Loading... |
| 72 if (sqlite3_step(statement) != SQLITE_ROW) | 71 if (sqlite3_step(statement) != SQLITE_ROW) |
| 73 break; | 72 break; |
| 74 } | 73 } |
| 75 | 74 |
| 76 sqlite3_finalize(statement); | 75 sqlite3_finalize(statement); |
| 77 } | 76 } |
| 78 | 77 |
| 79 sqlite3_close(db); | 78 sqlite3_close(db); |
| 80 return 0; | 79 return 0; |
| 81 } | 80 } |
| OLD | NEW |