Exemple #1
0
static PyObject *
pongo_close(PyObject *self, PyObject *args)
{
    PongoCollection *data;

    if (!PyArg_ParseTuple(args, "O:close", &data))
        return NULL;
    if (pongo_check(data))
        return NULL;

    dblock(data->ctx);
    pidcache_destroy(data->ctx);
    dbunlock(data->ctx);
    dbfile_close(data->ctx);
    Py_RETURN_NONE;
}
Exemple #2
0
int main(int argc, char **argv)
{
	int ret;
	struct hash_tree tree;

	init_filerec();
	init_hash_tree(&tree);

	if (parse_options(argc, argv)) {
		usage(argv[0]);
		return EINVAL;
	}

	if (init_csum_module(DEFAULT_HASH_STR))
		return ENOMEM;

	ret = dbfile_open(serialize_fname);
	if (ret)
		return ret;

	ret = dbfile_get_config(&disk_blocksize, &disk_hashes, &disk_files,
				&major, &minor);
	if (ret)
		return ret;

	blocksize = disk_blocksize;

	ret = prepare_statements();
	if (ret)
		return ret;

	print_file_info();

	if (num_to_print || print_all_hashes)
		print_by_size();

	if (print_file_list)
		print_filerecs();

	finalize_statements();

	dbfile_close();

	return ret;
}