Diferenças
Aqui você vê as diferenças entre duas revisões dessa página.
| Próxima revisão | Revisão anterior | ||
| software:art-dev:drivers [2008/11/22 17:27] – criada pedro | software:art-dev:drivers [2008/11/25 11:24] (atual) – pedro | ||
|---|---|---|---|
| Linha 1: | Linha 1: | ||
| + | ====== Drivers ====== | ||
| =====SQLite Driver ===== | =====SQLite Driver ===== | ||
| Linha 7: | Linha 8: | ||
| * {{software: | * {{software: | ||
| + | * {{: | ||
| =====Postgre===== | =====Postgre===== | ||
| - | * all databasde operations (createDB, createLayer etc) are echoing messages such as: | + | |
| + | ====Echoing Messages==== | ||
| + | all databasde operations (createDB, createLayer etc) are echoing messages such as: | ||
| < | < | ||
| Linha 22: | Linha 26: | ||
| </ | </ | ||
| How to remove them? | 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 @' | ||
| + | |||
| + | 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 " | ||
| + | |||
| + | Ontem mexi um pouco no código do aRTconn.cpp, | ||
| + | |||
| + | Coloquei um pouco de informação aqui: | ||
| + | http:// | ||
| + | |||
| + | Henrique: Segue em anexo, uma versão DropUser e do AddPermission, | ||
| + | testar ainda. | ||
| + | < | ||
| + | SEXP aRTconn:: | ||
| + | { | ||
| + | string user = GET_STRING_ELEMENT(data, | ||
| + | /*Drop user no postgres nao tem o ' | ||
| + | *bool remote | ||
| + | *string host = GET_STRING_ELEMENT(data, | ||
| + | |||
| + | PrintSilent(" | ||
| + | TeDatabase* db = NewTeDatabase(); | ||
| + | |||
| + | if( !db -> connect(Host, | ||
| + | error(" | ||
| + | |||
| + | stringstream stream; | ||
| + | stream << "drop user " << user; | ||
| + | switch(Type) | ||
| + | { | ||
| + | case aRTmySQL: | ||
| + | if(!remote && host == "" | ||
| + | else if(host != "" | ||
| + | else | ||
| + | } | ||
| + | |||
| + | stream << ";"; | ||
| + | |||
| + | string sql = StreamToChar(stream); | ||
| + | |||
| + | // cout << sql << endl; | ||
| + | |||
| + | if( !db-> | ||
| + | { | ||
| + | string err = db-> | ||
| + | delete db; | ||
| + | error( err.c_str() ); | ||
| + | } | ||
| + | |||
| + | delete db; | ||
| + | PrintSilentYes; | ||
| + | return RNULL; | ||
| + | } | ||
| + | |||
| + | SEXP aRTconn:: | ||
| + | { | ||
| + | string user = GET_STRING_ELEMENT(data, | ||
| + | bool remote | ||
| + | string host = GET_STRING_ELEMENT(data, | ||
| + | string pass = GET_STRING_ELEMENT(data, | ||
| + | string database | ||
| + | string previlege = GET_STRING_ELEMENT(data, | ||
| + | |||
| + | PrintSilent(" | ||
| + | TeDatabase* db = NewTeDatabase(); | ||
| + | |||
| + | if( !db -> connect(Host, | ||
| + | error(" | ||
| + | |||
| + | stringstream stream; | ||
| + | |||
| + | switch(Type) | ||
| + | { | ||
| + | case aRTmysql: | ||
| + | stream << "GRANT " << | ||
| + | if(!remote && host == "" | ||
| + | else if(host != "" | ||
| + | else | ||
| + | if(pass != "" | ||
| + | stream << " IDENTIFIED BY \'" | ||
| + | case aRTpostgres: | ||
| + | stream << " | ||
| + | stream << "grant " << previlege << " ON DATABASE " << database << " TO " << user; | ||
| + | } | ||
| + | stream << ";"; | ||
| + | |||
| + | string sql = StreamToChar(stream); | ||
| + | |||
| + | // cout << sql << endl; | ||
| + | |||
| + | if( !db-> | ||
| + | { | ||
| + | string err = db-> | ||
| + | delete db; | ||
| + | error( err.c_str() ); | ||
| + | } | ||
| + | |||
| + | delete db; | ||
| + | PrintSilentYes; | ||
| + | return RNULL; | ||
| + | }</ | ||