PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 25 → Wx - Alterar Schema do Postgresql de acordo com o usuario ou empresa
Wx - Alterar Schema do Postgresql de acordo com o usuario ou empresa
Iniciado por Boller, jan., 25 2021 2:13 PM - 1 resposta
Membro registado
3.651 mensagems
Popularité : +175 (223 votes)
Publicado em janeiro, 25 2021 - 2:13 PM
Bom dia a todos





Procedure alterarschemma(meuschemma)

sTabelas is string = HListFile(MyConnection1)
sTabelasanalise is string = HListFile()
schema_tabela is string
i is int

HClose("*")
FOR EACH STRING s OF sTabelas SEPARATED by CR
sNometabela is string = ExtractString(s,1,".",FromEnd)
s_nomShema is string = ExtractString(s,1,".",FromBeginning)

IF Contains(sTabelasanalise,sNometabela,WholeWord) THEN
schema_tabela=meuschemma+"."+sNometabela
i++
IF NOT HChangeName(sNometabela,schema_tabela) THEN
Info("Erro "+sNometabela+" --> "+meuschemma+"."+sNometabela)
RESULT(False)
END
IF NOT HChangeConnection(schema_tabela,MyConnection1) THEN
Error(HErrorInfo(hErrMessage))
RESULT(False)
END
END

END

HOpen("*")

RESULT(True)



passe o schemma que deseja

a rotina faz o resto

tudo 100% com funções nativas


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membro registado
3.651 mensagems
Popularité : +175 (223 votes)
Publicado em março, 15 2021 - 11:49 PM
// Summary: <specify the procedure action>
// Syntax:
//[ <Result> = ] alterarschemma (<meuschemma>)
//
// Parameters:
// meuschemma: <specify the role of meuschemma>

Procedure alterarschemma(meuschemma)

sTabelas is string = HListFile (MyConnection1)
sTabelasanalize is string = HListFile ()
schema_tabela is string
i is int

HClose ("*")


FOR EACH STRING S OF sTabelas SEPARATED by CR

sNometabela is string = ExtractString (S, 1, ".", FromEnd)
sShemaName is string = ExtractString (S, 1, ".", FromBeginning)

IF Contains (sTabelasanalize, sNometabela, WholeWord) THEN
schema_tabela = meuschemma + "." + sNometabela
i ++
IF NOT HChangeName(sNometabela, schema_tabela) THEN

END
Error("Erro" + sNometabela + "->" + meuschemma + "."+ sNometabela)
RESULT (False)
END
IF NOT HChangeConnection (schema_tabela, MyConnection1)
Error(HErrorInfo (hErrMessage))
RESULT (False)
END
END

HOpen ("*")

RESULT (True)


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/