Não foi possível enviar o arquivo. Será algum problema com as permissões?

Tabela de conteúdos

Drivers

Drivers

SQLite Driver

  • Aborted due to syntax constraints. It does not support all the SQL commands TerraLib needs (left join, right join).
  • Discussions about the implementation of a TerraLib driver for SQLite.

Connection Through ODBC

  • ODBC strategy plans for an access to the TL data base using ODBC aiming a common solution for Linux and Windows
  • apresentação do TeJDBC

Postgre

Echoing Messages

all databasde operations (createDB, createLayer etc) are echoing messages such as:

> th = createTheme(lpolygons, "poligons", vi="view")
> NOTA:  CREATE TABLE / PRIMARY KEY criará índice implícito
> "te_collection_2_pkey" na tabela "te_collection_2"
> NOTA:  CREATE TABLE criará sequência implícita
> "te_collection_2_aux_unique_id_seq" para coluna serial
> "te_collection_2_aux.unique_id"
> NOTA:  CREATE TABLE / PRIMARY KEY criará índice implícito
> "te_collection_2_aux_pkey" na tabela "te_collection_2_aux"
How to remove them?

Permissions

Henrique: drop user acho que vai funcionar sem problemas, o conceito do addUser é que é diferente do MySQL, uma vez que é necessário ter o usuário criado pelo CREATE USER antes de usar o GRAN ALL, outro detalhe disto é que no GRANT ALL do pg é que ele aparentemente não aceita o @'localhost', @'%', etc…

O getPermission não vai funcionar porque está vinculado à tabelas do MySQL se não me engano, no pg não tem todas as informa~ções de usuario que tem no MySQL, podem ser visualizadas com "SELECT * FROM pg_user".

Ontem mexi um pouco no código do aRTconn.cpp, mas ainda falta algumas coisas.

Coloquei um pouco de informação aqui: http://www.leg.ufpr.br/doku.php/dicas:postgres

Henrique: Segue em anexo, uma versão DropUser e do AddPermission, não tive como testar ainda.

SEXP aRTconn::DropUser(SEXP data)
{
	string user      = GET_STRING_ELEMENT(data, "user"     );
	/*Drop user no postgres nao tem o '@localhost', etc..
	 *bool remote      = GET_BOOL_ELEMENT  (data, "remote"   );
	 *string host      = GET_STRING_ELEMENT(data, "host"     );*/

	PrintSilent("Dropping user \'%s\' ... ", user.c_str());
	TeDatabase* db = NewTeDatabase();

	if( !db -> connect(Host, User, Password, "", Port))
		error("Could not connect\n");

	stringstream stream;
	stream << "drop user " << user;
  switch(Type)
	{
		case aRTmySQL:
			if(!remote && host == "") stream << "@localhost";
			else if(host != "")       stream << "@" << host;
	 		else                      stream << "@\'%\'";
	}

	stream << ";";

	string sql = StreamToChar(stream);

//	cout << sql << endl;

	if( !db->execute(sql) )
	{
		string err = db->errorMessage();
		delete db;
		error( err.c_str() );
	}

	delete db;
    PrintSilentYes;
	return RNULL;
}

SEXP aRTconn::AddPermission(SEXP data)  // only works in MySQL!
{
	string user      = GET_STRING_ELEMENT(data, "user"     );
	bool remote      = GET_BOOL_ELEMENT  (data, "remote"   );
	string host      = GET_STRING_ELEMENT(data, "host"     );
	string pass      = GET_STRING_ELEMENT(data, "pass"     );
	string database  = GET_STRING_ELEMENT(data, "database" );
	string previlege = GET_STRING_ELEMENT(data, "previlege");

	PrintSilent("Adding permissions to user \'%s\' ... ", user.c_str());
	TeDatabase* db = NewTeDatabase();

	if( !db -> connect(Host, User, Password, "", Port))
		error("Could not connect\n");

	stringstream stream;

	switch(Type)
	{
		case aRTmysql:
			stream << "GRANT " <<previlege << " ON " << database << " TO " << user;
			if(!remote && host == "") stream << "@localhost";
			else if(host != "")       stream << "@" << host;
			else                      stream << "@\'%\'";
			if(pass != "")
				stream << " IDENTIFIED BY \'" << pass << "\'";
		case aRTpostgres:
			stream << "CREATE USER " << user << ";";
			stream << "grant " << previlege << " ON DATABASE " << database << " TO " << user;
	}
	stream << ";";

	string sql = StreamToChar(stream);

//	cout << sql << endl;

	if( !db->execute(sql) )
	{
		string err = db->errorMessage();
		delete db;
		error( err.c_str() );
	}

	delete db;
    PrintSilentYes;
	return RNULL;
}


QR Code
QR Code software:art-dev:drivers (generated for current page)