Exemple #1
0
struct o_storage * o_engine_get_storage(char * connection_url, char * username, char * password)
{
	enum o_url_type type;
	char *path;
	char * db_name;
	o_url_resolve_information(connection_url, &type, &path, &db_name);
	struct o_connection * conn = o_engine_get_connection(type, path, username);
	return o_connection_storage_open(conn, db_name, username, password);
}
void test_o_url_resolve_information()
{
	char *path;
	char *database;
	enum o_url_type type;
	o_url_resolve_information(TEST_URL, &type, &path, &database);
	assert_true(type == REMOTE, "Wrong url Type");
	assert_true(strcmp(path, "127.0.0.1:2424") == 0, "Wrong path ");
	assert_true(strcmp(database, "dbname") == 0, "Wrong database name");
	o_free(path);
	o_free(database);
}
Exemple #3
0
struct o_storage * o_engine_get_storage(char * connection_url, char * username, char * password)
{
	enum o_url_type type;
	char *path;
	char * db_name;
	o_url_resolve_information(connection_url, &type, &path, &db_name);
	struct o_storage_factory * conn = o_engine_get_factory(type, path);
	struct o_storage * storage = o_storage_factory_storage_open(conn, db_name, username, password);
	o_free(path);
	o_free(db_name);
	return storage;
}