Go to the source code of this file.
|
| #define | GRN_DB_OPEN_OR_CREATE(ctx, path, optarg, db) |
| |
| #define | GRN_DB_EACH_BEGIN_FLAGS(ctx, cursor, id, flags) GRN_TABLE_EACH_BEGIN_FLAGS(ctx, grn_ctx_db((ctx)), cursor, id, flags) |
| |
| #define | GRN_DB_EACH_BEGIN_BY_ID(ctx, cursor, id) |
| |
| #define | GRN_DB_EACH_BEGIN_BY_KEY(ctx, cursor, id) |
| |
| #define | GRN_DB_EACH_END(ctx, cursor) GRN_TABLE_EACH_END(ctx, cursor) |
| |
|
| GRN_API grn_obj * | grn_db_create (grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg) |
| | Create new database.
|
| |
| GRN_API grn_obj * | grn_db_open (grn_ctx *ctx, const char *path) |
| | Open the database.
|
| |
| GRN_API void | grn_db_touch (grn_ctx *ctx, grn_obj *db) |
| | Update the last modified time of db to the current time. The last modified time is used, for example, to verify whether the cache is valid or not.
|
| |
| GRN_API grn_rc | grn_db_recover (grn_ctx *ctx, grn_obj *db) |
| | Check the passed database and recover it if it is broken and it can be recovered.
|
| |
| GRN_API grn_rc | grn_db_unmap (grn_ctx *ctx, grn_obj *db) |
| | Unmaps all opened tables and columns in the passed database. Resources used by these opened tables and columns are freed. Normally, this API is needless. Because resources used by opened tables and columns are managed by OS automatically.
|
| |
| GRN_API uint32_t | grn_db_get_last_modified (grn_ctx *ctx, grn_obj *db) |
| |
| GRN_API bool | grn_db_is_dirty (grn_ctx *ctx, grn_obj *db) |
| |
| GRN_API grn_rc | grn_db_set_cache (grn_ctx *ctx, grn_obj *db, grn_cache *cache) |
| |
| GRN_API grn_cache * | grn_db_get_cache (grn_ctx *ctx, grn_obj *db) |
| |
◆ GRN_DB_EACH_BEGIN_BY_ID
| #define GRN_DB_EACH_BEGIN_BY_ID |
( |
|
ctx, |
|
|
|
cursor, |
|
|
|
id |
|
) |
| |
Value:
cursor, \
id, \
#define GRN_DB_EACH_BEGIN_FLAGS(ctx, cursor, id, flags)
Definition db.h:133
#define GRN_CURSOR_BY_ID
Definition table.h:280
#define GRN_CURSOR_ASCENDING
Definition table.h:273
◆ GRN_DB_EACH_BEGIN_BY_KEY
| #define GRN_DB_EACH_BEGIN_BY_KEY |
( |
|
ctx, |
|
|
|
cursor, |
|
|
|
id |
|
) |
| |
Value:
cursor, \
id, \
#define GRN_CURSOR_BY_KEY
Definition table.h:279
◆ GRN_DB_EACH_BEGIN_FLAGS
◆ GRN_DB_EACH_END
◆ GRN_DB_OPEN_OR_CREATE
| #define GRN_DB_OPEN_OR_CREATE |
( |
|
ctx, |
|
|
|
path, |
|
|
|
optarg, |
|
|
|
db |
|
) |
| |
Value:
GRN_API grn_obj * grn_db_open(grn_ctx *ctx, const char *path)
Open the database.
GRN_API grn_obj * grn_db_create(grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg)
Create new database.
◆ grn_db_create_optarg
◆ grn_db_create()
Create new database.
- Parameters
-
| ctx | The context object. |
| path | File path of the database. Temporary database if NULL is specified. |
| optarg | Currently, it is not used. It is just ignored. |
- Returns
- The database on success,
NULL on error.
◆ grn_db_get_cache()
◆ grn_db_get_last_modified()
◆ grn_db_is_dirty()
◆ grn_db_open()
Open the database.
- Parameters
-
| ctx | The context object. |
| path | File path of the database. |
- Returns
- The database on success,
NULL on error.
◆ grn_db_recover()
Check the passed database and recover it if it is broken and it can be recovered.
This API uses lock existence for checking whether the database is broken or not.
Here are recoverable cases:
- Index column is broken. The index column must have source column.
Here are unrecoverable cases:
- Object name management feature is broken.
- Table is broken.
- Data column is broken.
Object name management feature is used for managing table name, column name and so on. If the feature is broken, the database can't be recovered. Please re-create the database from backup.
Table and data column can be recovered manually by removing an existence lock and re-add data.
- Attention
- This is a dangerous API. You must not use this API when other thread or process opens the target database. If you use this API against shared database, the database may be broken.
- Since
- 4.0.9
- Parameters
-
| ctx | The context object. |
| db | The database to be recovered. |
- Returns
- GRN_SUCCESS on success, the appropriate grn_rc on error.
◆ grn_db_set_cache()
◆ grn_db_touch()
Update the last modified time of db to the current time. The last modified time is used, for example, to verify whether the cache is valid or not.
- Parameters
-
| ctx | The context object. |
| db | The database. |
◆ grn_db_unmap()
Unmaps all opened tables and columns in the passed database. Resources used by these opened tables and columns are freed. Normally, this API is needless. Because resources used by opened tables and columns are managed by OS automatically.
- Attention
- This is a thread unsafe API. You can't touch the database while this API is running.
- Since
- 5.0.7
- Parameters
-
| ctx | The context object. |
| db | The database to be unmaped. |
- Returns
- GRN_SUCCESS on success, the appropriate grn_rc on error.