Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 8 Jahren, 5 Monaten
Letzter Beitrag:
vor 8 Jahren, 5 Monaten
Beteiligte Autoren:
Louis Verbraak, Stefan Bentvelsen, Novica.Njagojevic

[WD12] Create a database

Startbeitrag von Louis Verbraak am 09.02.2010 08:10

Hello to you all,

Can anybody tell me if it is possible (and if so, how) to create a database on the HFCS during runtime.

Antworten:

Hi Louis,

yes, that is possible. See the following piece of code:



// Creating a new database by opening the connection
IF HOpenConnection(gsConnection, EDT_USER, EDT_PASSWD, EDT_DBSERVER, sDatabase, hAccessHFClientServer) THEN
gbConnectionOK=True
IF HChangeConnection("*",gsConnection) THEN
IF HChangeDir("*","..\"+sDatabase) THEN
ExecuteProcess(TABLE_Databases,trtInit)
CreateFilesLinks(sDatabase) // Algemene bestanden !
CreateUsers(sDatabase)
oAlgProc:InfoM(Replace("De database > is aangemaakt !",">",sDatabase))
ELSE
oAlgProc:ErrorM(ErrorInfo())
END
ELSE
oAlgProc:ErrorM(ErrorInfo())
END
ELSE
oAlgProc:ErrorM(ErrorInfo())
END



von Stefan Bentvelsen - am 09.02.2010 08:17
Hello Stefan,

Thanks so far, but can you give me the code of the routines 'CreateFilesLinks' and 'CreateUsers'.

Thanks in advance.

von Louis Verbraak - am 09.02.2010 08:55
Just open the connection to the database and you have created it.


von Novica.Njagojevic - am 09.02.2010 09:33
Hello Novica,

Thanks for your answer. Now I found what I did wrong: I use HDescribeConnection with the "DB_EXIST" parameter.

von Louis Verbraak - am 09.02.2010 09:52
Hi Louis,

I understand that the creation of your database works, but for your information some code snippets of procedure CreateFileLinks():


sHlp=ExtractString(gsAlgBestanden,firstRank,",") // in gsAlgBestanden staan alleen hoofdletters ...
WHILE sHlpEOT
IF NOT sHlp IN ("LOTEMP","IHTEMP") THEN // Deze print-bestanden buiten beschouwing laten !
oHF:hfHChangeDir(sHlp,".\")
END
sHlp=ExtractString(gsAlgBestanden,nextRank,",")
END

sHlp=ExtractString(gsAlgBestanden,firstRank,",") // in gsAlgBestanden staan alleen hoofdletters ...
WHILE sHlpEOT
IF NOT sHlp IN ("LOTEMP","IHTEMP") THEN // Deze print-bestanden buiten beschouwing laten !
oHF:hfHCreationIfNotFound(sHlp) // Om te zorgen dat de .REP-file wordt bijgewerkt !
oHF:hfHClose(sHlp)
END
sHlp=ExtractString(gsAlgBestanden,nextRank,",")
END


In procedure CreateUsers() the rights of the group (in this case '3Borg') and after that the rights of the differtent users in our software wil be set. For the group the following code is executed:


IF NOT HModifyDatabaseRights(gsConnection,"3Borg groep",hRightsInsert+hRightsLock+hRightsChangeRights+ ...
hRightsChangeLink+hRightsChangeOwner+hRightsConnection+ ...
hRightsEncryptedConnection+hRightsCreateFile+ ...
hRightsManageDuplicate+hRightsManageIntegrity+ ...
hRightsRead+hRightsMaintenance+hRightsAutoModif+ ...
hRightsUpdate+hRightsDelete+hRightsDeleteFile, ...
hAllowed,pDatabase) THEN
Error(ErrorInfo())
END
IF NOT HModifyDatabaseRights(gsConnection,"3Borg groep",hRightsDeleteDB,hForbidden,pDatabase) THEN
Error(ErrorInfo())
END



von Stefan Bentvelsen - am 09.02.2010 10:19
Hello Stefan,

Thanks for your feedback.

von Louis Verbraak - am 09.02.2010 11:33
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.