77REM ***** BASIC *****
88option explicit
99
10- global const sDatabase_Name= " aladin"
11- Global const iDatenAnlegen= " 1 "
10+ global const sDatabase_Name=" aladin"
11+ Global const bDatenAnlegen=TRUE
1212
1313Dim oStatement as Object
1414Dim sSQL as String,sSQL1 as String,sSQL2 as String
@@ -110,6 +110,7 @@ Sub SQL_Zugriffsrechte()
110110 Dim vStatus as Variant
111111 Dim sHost as String
112112 Dim sUserName as String
113+ Dim sUserHost as String
113114 Dim sPassword as String
114115 Dim iCountDb as Integer
115116 Dim iCountUser as Integer
@@ -143,6 +144,8 @@ nochmalusers:
143144 End if
144145 End if
145146
147+ sUserHost=sUserName & "' @'" & sHost
148+
146149nochmalpass:
147150 sPassword=InputBox(" Geben Sie bitte das Passwort ein für den Users "& sUserName &" !" ,sTitle)
148151 if sPassword = "" then
@@ -170,27 +173,32 @@ nochmalpass:
170173 While oRecord2.next()
171174 iCountUser=oRecord2.getInt(1)
172175 Wend
173-
174176
175- if iCountDb=0 then
176- sSQL=" insert into db "& _
177- " (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,"& _
178- " Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv) values "& _
179- " ('"& sHost &"' ,'"& sDatabase_Name &"' ,'"& sUserName &"' ,' Y' ,' Y' ,' Y' ,' Y' ,' N' ,' N' ,' N' ,' N' ,' N' ,' Y' )"
180- SQL_execute_mysql(sSQL)
181- End if
182- If iCountUser=0 then
183- sSQL=" insert into user "& _
184- " (Host,User,Password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,"& _
185- " Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,ssl_type,ssl_cipher,x509_issuer,x509_subject) values "& _
186- " ('"& sHost &"' ,'"& sUserName &"' ,password('"& sPassword &"' ),' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,'' ,'' ,'' ,'' )"
187- SQL_execute_mysql(sSQL)
188- else
189- sSQL=" update user set Password=password('"& sPassword &"' )"& _
190- " where Host='"& sHost &"'"& _
191- " and User='"& sUserName &"'"
177+ If iCountUser=0 then
178+ ' sSQL=" insert into user "& _
179+ ' " (Host,User,Password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,"& _
180+ ' " Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,ssl_type,ssl_cipher,x509_issuer,x509_subject) values "& _
181+ ' " ('"& sHost &"' ,'"& sUserName &"' ,password('"& sPassword &"' ),' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,' N' ,'' ,'' ,'' ,'' )"
182+ sSQL=" CREATE USER '"& sUserHost &"' IDENTIFIED BY '"& sPassword &"'"
183+ SQL_execute_mysql(sSQL)
184+ else
185+ ' sSQL=" update user set Password=password('"& sPassword &"' )"& _
186+ ' " where Host='"& sHost &"'"& _
187+ ' " and User='"& sUserName &"'"
188+ sSQL=" ALTER USER '"& sUserHost &"' IDENTIFIED BY '"& sPassword &"'"
189+ SQL_execute_mysql(sSQL)
190+ End if
191+ if iCountDb=0 then
192+ ' sSQL=" insert into db "& _
193+ ' " (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,"& _
194+ ' " Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv) values "& _
195+ ' " ('"& sHost &"' ,'"& sDatabase_Name &"' ,'"& sUserName &"' ,' Y' ,' Y' ,' Y' ,' Y' ,' N' ,' N' ,' N' ,' N' ,' N' ,' Y' )"
196+ sSQL=" GRANT ALL PRIVILEGES ON "& sDatabase_Name &" .* TO '"& sUserHost &"' IDENTIFIED BY '"& sPassword &"'"
197+ SQL_execute_mysql(sSQL)
198+ End if
199+
200+ sSQL=" FLUSH PRIVILEGES"
192201 SQL_execute_mysql(sSQL)
193- End if
194202
195203End Sub
196204
@@ -216,7 +224,7 @@ Sub SQL_create_Start()
216224 if iUserAnzahl < 1 then
217225 SetUserAnzahl()
218226 End if
219- if iDatenAnlegen=1 then
227+ if bDatenAnlegen then
220228 For iCount = 1 to iUserAnzahl
221229 sSQL=" insert into Start(Startoption,Startlock) values (0,0)"
222230 SQL_execute_mysql(sSQL)
@@ -336,8 +344,8 @@ End if
336344 Case 40
337345 sFormular=" Frei"
338346 End Select
339- if iDatenAnlegen=1 then
340- sSQL= " insert into Steuerung (ClientID,Formular,GruppenID,HauptgruppenID) "& _
347+ if bDatenAnlegen then
348+ sSQL= " insert into steuerung (ClientID,Formular,GruppenID,HauptgruppenID) "& _
341349 " values("& (iCount*iClientAnzahl)-iClientAnzahl+iCountTable &" ,'"& sFormular &"' ,0,0)"
342350 SQL_execute_mysql(sSQL)
343351 End if
@@ -384,7 +392,7 @@ Sub SQL_create_Document_Typ()
384392 case 11
385393 sValue = " (' Nummer:' ,' Kontaktnummer:' ,' Firmennummer:' ,null,null,null,null,null,0)"
386394 End select
387- if iDatenAnlegen=1 then
395+ if bDatenAnlegen then
388396 sSQL2=" insert into Document_Typ"& _
389397 " (DocumentID,KontaktID,ReferenzID,Summe_ohne_MwSt,Summe_mit_MwSt,Schluss_Text1,Schluss_Text2,Bemerkung,gueltig) "& _
390398 " values "& sValue
@@ -566,7 +574,7 @@ Sub SQL_create_Rechnungstypen()
566574 " (RechnungsTypID int(2) not null auto_increment,RechnungsTyp varchar(50)not null default '' ,RechnungsTypKuerzel varchar(10) not null default '' ,"& _
567575 " primary key(RechnungsTypID))"
568576 SQL_execute_mysql(sSQL)
569- if iDatenAnlegen=1 then
577+ if bDatenAnlegen then
570578 sSQL=" insert into RechnungsTypen(RechnungsTypID,RechnungsTyp,RechnungsTypKuerzel) values(1,' Wareneingang' ,' WE' )"
571579 SQL_execute_mysql(sSQL)
572580 sSQL=" insert into RechnungsTypen(RechnungsTypID,RechnungsTyp,RechnungsTypKuerzel) values(2,' Kosten' ,' K' )"
0 commit comments