PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y 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, 25,ene. 2021 14:13 - 1 respuesta
Miembro registrado
4.549 mensajes
Publicado el 25,enero 2021 - 14:13
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/
Miembro registrado
4.549 mensajes
Publicado el 15,marzo 2021 - 23:49
// 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/