Standard |
Backup |
BackupNow |
|
Basic |
|
4 |
SUB BackupNow WriteDataFromCache DatabaseBackup(10) END SUB |
Standard |
Backup |
DatabaseBackup |
|
Basic |
BackupNow (Procedure) |
45 |
SUB DatabaseBackup(inMax AS INTEGER) DIM oPath AS OBJECT DIM oDoc AS OBJECT DIM sTitel AS STRING DIM sUrl_Target AS STRING DIM sUrl_Start AS STRING DIM i AS INTEGER DIM k AS INTEGER oDoc = ThisComponent sTitel = oDoc.Title sUrl_Start = oDoc.URL oPath = createUnoService("com.sun.star.util.PathSettings") FOR i = 1 TO inMax + 1 IF NOT FileExists(oPath.Backup & "/" & i & "_" & sTitel) THEN IF i > inMax THEN FOR k = inMax -1 TO 1 STEP -1 IF FileDateTime(oPath.Backup & "/" & k & "_" & sTitel) <= FileDateTime(oPath.Backup & "/" & k+1 & "_" & sTitel) THEN IF k = 1 THEN i = k EXIT FOR END IF ELSE i = k+1 EXIT FOR END IF NEXT END IF EXIT FOR END IF NEXT sUrl_Target = oPath.Backup & "/" & i &"_" & sTitel FileCopy(sUrl_Start,sUrl_Target) END SUB |
Standard |
Backup |
WriteDataFromCache |
|
Basic |
BackupNow (Procedure) |
9 |
SUB WriteDataFromCache DIM oData AS OBJECT DIM oDataSource AS OBJECT oData = ThisDatabaseDocument.CurrentController IF NOT ( oData.isConnected() ) THEN oData.connect() oDataSource = oData.DataSource oDataSource.flush END SUB |
Standard |
Comboboxes |
ColumnSize |
|
Basic |
TextSelectionSaveValue (Procedure) |
22 |
FUNCTION ColumnSize(Tablename AS STRING, Fieldname AS STRING) AS INTEGER DIM oDatasource AS OBJECT DIM oConnection AS OBJECT DIM oResult AS OBJECT DIM oSQL_Command AS OBJECT DIM i AS INTEGER oDatasource = ThisComponent.Parent.CurrentController If NOT (oDatasource.isConnected()) Then oDatasource.connect() End If oConnection = oDatasource.ActiveConnection() oSQL_Command = oConnection.createStatement() stSql="SELECT ""COLUMN_SIZE"" FROM ""INFORMATION_SCHEMA"".""SYSTEM_COLUMNS"" WHERE ""TABLE_NAME"" = '"+Tablename+"' AND ""COLUMN_NAME"" = '"+Fieldname+"'" oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next i = oResult.getInt(1) WEND ColumnSize = i END FUNCTION |
Standard |
Comboboxes |
DatasetActionGenerate |
✔ |
Basic |
Media|comMed (Control) Media|Author|comAdd (Control) Media|Author|comAut (Control) Media|comCat (Control) Media|comTow (Control) Media|comPub (Control) Reader_Admission|Form|Adress|comPosTow (Control) Reader_Admission|Form|Adress|comStr (Control) |
|
|
Standard |
Comboboxes |
GenerateRecordAction |
|
Basic |
|
7 |
SUB GenerateRecordAction(oEvent AS OBJECT) DIM oForm AS OBJECT oForm = oEvent.Source.Model.Parent oForm.isModified = TRUE END SUB |
Standard |
Comboboxes |
ShowText |
|
Basic |
Media (Form) Media|Author (Control) Reader_Admission|Form|Adress (Control) |
54 |
SUB ShowText(oEvent AS OBJECT) DIM oForm AS OBJECT DIM inCom AS INTEGER DIM oFieldList AS OBJECT DIM stFieldID AS STRING DIM stQuery AS STRING DIM stFieldValue AS STRING oForm = oEvent.Source aComboboxen() = Split(oForm.getByName("combofields").Tag,",") FOR inCom = LBound(aComboboxen) TO UBound(aComboboxen) oFieldList = oForm.getByName(Trim(aComboboxen(inCom))) stFieldID = oForm.getString(oForm.findColumn(oFieldList.Tag)) oFieldList.Refresh() IF stFieldID <> "" THEN stQuery = oFieldList.ListSource IF InStr(stQuery,"order by") > 0 THEN stSql = Left(stQuery, InStr(stQuery,"order by")-1) ELSE stSql = stQuery END IF IF InStr(stSql,"where") THEN st = Right(stSql, Len(stSql)-InStr(stSql,"where")-4) IF InStr(Left(st, InStr(st,"=")),".""ID""") THEN a() = Split(Right(st, Len(st)-InStr(st,"=")-1),".") ELSE a() = Split(Left(st, InStr(st,"=")-1),".") END IF stSql = stSql + "AND "+a(0)+".""ID"" = "+stFieldID ELSE stSql = stSql + "WHERE ""ID"" = "+stFieldID END IF oDatasource = ThisComponent.Parent.CurrentController IF NOT (oDatasource.isConnected()) THEN oDatasource.connect() END IF oConnection = oDatasource.ActiveConnection() oSQL_Command = oConnection.createStatement() oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next stFieldValue = oResult.getString(1) WEND oFieldList.Text = stFieldValue ELSE oFieldList.Text = "" END IF NEXT inCom END SUB |
Standard |
Comboboxes |
String_to_SQL |
|
Basic |
TextSelectionSaveValue (Procedure) |
7 |
FUNCTION String_to_SQL(st AS STRING) IF InStr(st,"'") THEN st = Join(Split(st,"'"),"''") END IF String_to_SQL = st END FUNCTION |
Standard |
Comboboxes |
TextSelectionSaveValue |
|
Basic |
Media (Form) Media|Author (Control) Reader_Admission|Form|Adress (Control) |
263 |
SUB TextSelectionSaveValue(oEvent AS OBJECT) DIM oDatasource AS OBJECT DIM oConnection AS OBJECT DIM oResult AS OBJECT DIM oSQL_Command AS OBJECT DIM NameIDField AS STRING DIM NameTableField1 AS STRING DIM NameTableField2 AS STRING DIM stFieldSeparator AS STRING DIM NameTable1 AS STRING DIM NameTable2 AS STRING DIM NameTab12ID AS STRING DIM Position AS INTEGER DIM oFieldList AS OBJECT DIM oField AS OBJECT DIM oForm AS OBJECT DIM stQuery AS STRING DIM stContent AS STRING DIM i AS INTEGER DIM stContentField2 AS STRING DIM a_stParts() AS STRING DIM stmsgbox1 AS STRING DIM stmsgbox2 AS STRING DIM inID1 AS INTEGER DIM inID2 AS INTEGER DIM LengthField1 AS INTEGER DIM LengthField2 AS INTEGER IF InStr(oEvent.Source.ImplementationName,"ODatabaseForm") THEN oForm = oEvent.Source aComboboxen() = Split(oForm.getByName("combofields").Tag,",") FOR inCom = LBound(aComboboxen) TO UBound(aComboboxen) NameTable2 = "" a() = Split(Trim(aComboboxen(inCom)),">") IF Ubound(a) > 0 THEN oFieldList = oForm.getByName(a(0)).getByName(a(1)) ELSE oFieldList = oForm.getByname(a(0)) END IF stQuery = oFieldList.ListSource aFields() = Split(stQuery, """") stContent = "" FOR i=LBound(aFields)+1 TO UBound(aFields) IF Trim(UCASE(aFields(i))) = "ORDER BY" THEN EXIT FOR ELSEIF Trim(UCASE(aFields(i))) = "FROM" THEN stContent = stContent+" §§ " ELSEIF Trim(UCASE(aFields(i))) = "WHERE" THEN stContent = stContent+" §§ " ELSE stContent = stContent+Trim(aFields(i)) END IF NEXT i aContent() = Split(stContent, " §§ ") aFirst() = Split(aContent(0),"||") IF UBound(aFirst) > 0 THEN IF UBound(aContent) > 1 THEN aTest() = Split(aFirst(0),".") NameTable1 = aTest(0) NameTableField1 = aTest(1) Erase aTest stFieldSeparator = Join(Split(aFirst(1),"'"),"") aTest() = Split(aFirst(2),".") NameTable2 = aTest(0) NameTableField2 = aTest(1) Erase aTest aTest() = Split(aContent(2),"=") aTest1() = Split(aTest(0),".") IF aTest1(1) <> "ID" THEN NameTab12ID = aTest1(1) IF aTest1(0) = NameTable1 THEN Position = 2 ELSE Position = 1 END IF ELSE Erase aTest1 aTest1() = Split(aTest(1),".") NameTab12ID = aTest1(1) IF aTest1(0) = NameTable1 THEN Position = 2 ELSE Position = 1 END IF END IF ELSE IF UBound(aFirst) > 1 THEN NameTableField1 = aFirst(0) stFieldSeparator = Join(Split(aFirst(1),"'"),"") NameTableField2 = aFirst(2) ELSE NameTableField1 = aFirst(0) NameTableField2 = aFirst(1) END IF NameTable1 = aContent(1) END IF ELSE NameTableField1 = aFirst(0) NameTable1 = aContent(1) END IF LengthField1 = ColumnSize(NameTable1,NameTableField1) IF NameTableField2 <> "" THEN IF NameTable2 <> "" THEN LengthField2 = ColumnSize(NameTable2,NameTableField2) ELSE LengthField2 = ColumnSize(NameTable1,NameTableField2) END IF ELSE LengthField2 = 0 END IF stContent = oFieldList.getCurrentValue() stContent = Trim(stContent) IF stContent <> "" THEN IF NameTableField2 <> "" THEN a_stParts = Split(stContent, stFieldSeparator, 2) IF Position = 2 THEN stContent = Trim(a_stParts(0)) IF UBound(a_stParts()) > 0 THEN stContentField2 = Trim(a_stParts(1)) ELSE stContentField2 = "" END IF ELSE stContentField2 = Trim(a_stParts(0)) IF UBound(a_stParts()) > 0 THEN stContent = Trim(a_stParts(1)) ELSE stContent = "" END IF END IF END IF IF (LengthField1 > 0 AND Len(stContent) > LengthField1) OR (LengthField2 > 0 AND Len(stContentField2) > LengthField2) THEN stmsgbox1 = "Field "+NameTableField1+" must not be "+LengthField1+ " characters long."+CHR(13) stmsgbox2 = "Field "+NameTableField2+" must not be "+LengthField2+ " characters long."+CHR(13) IF (LengthField1 > 0 AND Len(stContent) > LengthField1) AND (LengthField2 > 0 AND Len(stContentField2) > LengthField2) THEN msgbox ("The inputted text is too long."+CHR(13)+stmsgbox1+stmsgbox2+"Please reduce text.",64,"Wrong Input") ELSEIF (LengthField1 > 0 AND Len(stContent) > LengthField1) THEN msgbox ("The inputted text is too long."+CHR(13)+stmsgbox1+"Please reduce text.",64,"Wrong Input") ELSE msgbox ("The inputted text is too long."+CHR(13)+stmsgbox2+"Please reduce text.",64,"Wrong Input") END IF ELSE stContent = String_to_SQL(stContent) IF stContentField2 <> "" THEN stContentField2 = String_to_SQL(stContentField2) END IF inID1 = -1 inID2 = -1 oDatasource = ThisComponent.Parent.CurrentController If NOT (oDatasource.isConnected()) Then oDatasource.connect() End If oConnection = oDatasource.ActiveConnection() oSQL_Command = oConnection.createStatement() IF NameTableField2 <> "" AND NOT IsEmpty(stContentField2) AND NameTable2 <> "" THEN stSql = "SELECT ""ID"" FROM """+NameTable2+""" WHERE """+NameTableField2+"""='"+stContentField2+"'" oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next inID2 = oResult.getInt(1) WEND IF inID2 = -1 THEN stSql = "INSERT INTO """+NameTable2+""" ("""+NameTableField2+""") VALUES ('"+stContentField2+"') " oSQL_Command.executeUpdate(stSql) stSql = "CALL IDENTITY()" oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next inID2 = oResult.getInt(1) WEND END IF stSql = "SELECT ""ID"" FROM """+NameTable1+""" WHERE """+NameTab12ID+"""='"+inID2+"' AND """+NameTableField1+""" = '"+stContent+"'" oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next inID1 = oResult.getInt(1) WEND IF inID1 = -1 THEN stSql = "INSERT INTO """+NameTable1+""" ("""+NameTableField1+""","""+NameTab12ID+""") VALUES ('"+stContent+"','"+inID2+"') " oSQL_Command.executeUpdate(stSql) stSql = "CALL IDENTITY()" oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next inID1 = oResult.getInt(1) WEND END IF END IF IF NameTableField2 <> "" AND NameTable2 = "" THEN stSql = "SELECT ""ID"" FROM """+NameTable1+""" WHERE """+NameTableField1+"""='"+stContent+"' AND """+NameTableField2+"""='"+stContentField2+"'" oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next inID1 = oResult.getInt(1) WEND IF inID1 = -1 THEN stSql = "INSERT INTO """+NameTable1+""" ("""+NameTableField1+""","""+NameTableField2+""") VALUES ('"+stContent+"','"+stContentField2+"') " oSQL_Command.executeUpdate(stSql) stSql = "CALL IDENTITY()" oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next inID1 = oResult.getInt(1) WEND END IF END IF IF NameTableField2 = "" THEN stSql = "SELECT ""ID"" FROM """+NameTable1+""" WHERE """+NameTableField1+"""='"+stContent+"'" oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next inID1 = oResult.getInt(1) WEND IF inID1 = -1 THEN stSql = "INSERT INTO """+NameTable1+""" ("""+NameTableField1+""") VALUES ('"+stContent+"') " oSQL_Command.executeUpdate(stSql) stSql = "CALL IDENTITY()" oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next inID1 = oResult.getInt(1) WEND END IF END IF oForm.updateLong(oForm.findColumn(oFieldList.Tag),inID1) END IF ELSE oForm.updateNULL(oForm.findColumn(oFieldList.Tag),NULL) END IF NEXT inCom END IF END SUB |
Standard |
Maintenance |
DatabaseCompressing |
|
Basic |
|
20 |
SUB DatabaseCompressing DIM stMessage AS STRING oDataSource = ThisComponent.Parent.CurrentController IF NOT (oDataSource.isConnected()) THEN oDataSource.connect() END IF oConnection = oDataSource.ActiveConnection() oSQL_Command = oConnection.createStatement() stSql = "SHUTDOWN COMPACT" oSQL_Command.executeQuery(stSql) stMessage = "Database has been compressed." + CHR(13) + "The form will be closed." stMessage = stMessage + CHR(13) + "After closing the form you should close the whole database." stMessage = stMessage + CHR(13) + "You could work with the database again, when reopening the database." msgbox stMessage ThisDatabaseDocument.FormDocuments.getByName( "Maintenance" ).close END SUB |
Standard |
Maintenance |
DialogTableAdjustmentCB1Selected |
|
Basic |
Dialog_TableAdjustment|CheckBox1 (Control) |
9 |
SUB DialogTableAdjustmentCB1Selected DIM oCtlList2 AS OBJECT DIM oCtlText AS OBJECT oCtlText = oDlg.GetControl("TextField1") oCtlText.Model.Enabled=False oCtlList2 = oDlg.GetControl("ListBox2") oCtlList2.Model.Enabled=False END SUB |
Standard |
Maintenance |
DialogTableAdjustmentLB1selected |
|
Basic |
Dialog_TableAdjustment|ListBox1 (Control) |
25 |
SUB DialogTableAdjustmentLB1selected STATIC stContent AS STRING STATIC inPos AS Integer DIM oCtlList1 AS OBJECT DIM oCtlList2 AS OBJECT DIM oCtlText AS OBJECT DIM oCtlCheck1 AS OBJECT IF Len(stContent) >0 THEN oCtlList2 = oDlg.GetControl("ListBox2") oCtlList2.addItem(stContent,inPos) END IF oCtlList1 = oDlg.GetControl("ListBox1") inPos = oCtlList1.selectedItemPos stContent = oCtlList1.getSelectedItem() oCtlText = oDlg.GetControl("TextField1") oCtlText.Model.Enabled=True oCtlList2 = oDlg.GetControl("ListBox2") oCtlList2.removeItems(inPos,1) oCtlList2.Model.Enabled=True oCtlCheck1 = oDlg.GetControl("CheckBox1") oCtlCheck1.Model.Enabled=True END SUB |
Standard |
Maintenance |
DialogTableAdjustmentLB2Selected |
|
Basic |
Dialog_TableAdjustment|ListBox2 (Control) |
9 |
SUB DialogTableAdjustmentLB2Selected DIM oCtlText AS OBJECT DIM oCtlCheck1 AS OBJECT oCtlText = oDlg.GetControl("TextField1") oCtlText.Model.Enabled=False oCtlCheck1 = oDlg.GetControl("CheckBox1") oCtlCheck1.Model.Enabled=False END SUB |
Standard |
Maintenance |
DialogTableAdjustmentTextSelected |
|
Basic |
Dialog_TableAdjustment|TextField1 (Control) |
9 |
SUB DialogTableAdjustmentTextSelected DIM oCtlList2 AS OBJECT DIM oCtlCheck1 AS OBJECT oCtlList2 = oDlg.GetControl("ListBox2") oCtlList2.Model.Enabled=False oCtlCheck1 = oDlg.GetControl("CheckBox1") oCtlCheck1.Model.Enabled=False END SUB |
Standard |
Maintenance |
IndexAllTablesDown |
|
Basic |
|
8 |
SUB IndexAllTablesDown(oEvent AS OBJECT) DIM stTag AS STRING stTag = oEvent.Source.Model.Tag aTabs() = Split(stTag, ",") FOR i = LBound(aTabs()) TO UBound(aTabs()) TableIndexDown(Trim(aTabs(i)) NEXT END SUB |
Standard |
Maintenance |
TableAdjustment |
|
Basic |
Media|Button 5 (Control) Media|Button 6 (Control) Media|Button 7 (Control) Media|Button 8 (Control) Media|Button 10 (Control) Media|Button 9 (Control) Reader_Admission|Button 6 (Control) Reader_Admission|Button 5 (Control) |
383 |
SUB TableAdjustment(oEvent AS OBJECT) DIM oCtlList1 AS OBJECT DIM oCtlList2 AS OBJECT DIM oCtlText AS OBJECT DIM oCtlCheck1 AS OBJECT DIM oCtlCheck2 AS OBJECT DIM oCtlLabel1 AS OBJECT DIM oFieldList AS OBJECT DIM oFieldID AS OBJECT DIM aContent() DIM aColumns() DIM aForeignTables(0, 0 to 1) DIM aForeignTables2(0, 0 to 1) DIM stTag AS STRING DIM stFieldList AS STRING DIM stCondition AS STRING DIM stText AS STRING DIM stContent1 AS STRING DIM stContent2 AS STRING DIM stFieldHeader AS STRING DIM stSideTable AS STRING DIM stForeignIDTab1Tab2 AS STRING DIM stForeignIDTab2Tab1 AS STRING DIM inRepeat AS INTEGER DIM inLB1 AS INTEGER DIM inLB2 AS INTEGER DIM inCounter AS INTEGER DIM i AS INTEGER DIM inK AS INTEGER DIM inID AS INTEGER DIM inUnique AS INTEGER DIM inRow AS INTEGER stTag = oEvent.Source.Model.Tag aTable() = Split(stTag, ", ") FOR i = LBound(aTable()) TO UBound(aTable()) aTable(i) = trim(aTable(i)) NEXT oDataSource = ThisComponent.Parent.CurrentController If NOT (oDataSource.isConnected()) THEN oDataSource.connect() END IF oConnection = oDataSource.ActiveConnection() oSQL_Command = oConnection.createStatement() stSql = "SELECT ""FKTABLE_NAME"", ""FKCOLUMN_NAME"" FROM ""INFORMATION_SCHEMA"".""SYSTEM_CROSSREFERENCE"" WHERE ""PKTABLE_NAME"" = '" + aTable(5) + "'" inCounter = 0 stForeignIDTab1Tab2 = "ID" stForeignIDTab2Tab1 = "ID" stSideTable = aTable(5) oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next ReDim Preserve aForeignTables(inCounter,0 to 1) aForeignTables(inCounter,0) = oResult.getString(1) aForeignTables(inCounter,1) = oResult.getString(2) IF UBound(aTable()) = 8 THEN IF aTable(8) = aForeignTables(inCounter,0) THEN stForeignIDTab2Tab1 = aForeignTables(inCounter,1) stSideTable = aTable(8) END IF END IF inCounter = inCounter + 1 WEND IF UBound(aTable()) = 8 THEN stSql = "SELECT ""FKTABLE_NAME"", ""FKCOLUMN_NAME"" FROM ""INFORMATION_SCHEMA"".""SYSTEM_CROSSREFERENCE"" WHERE ""PKTABLE_NAME"" = '" + aTable(8) + "'" oResult = oSQL_Command.executeQuery(stSql) inCounter = 0 WHILE oResult.next ReDim Preserve aForeignTables2(inCounter,0 to 1) aForeignTables2(inCounter,0) = oResult.getString(1) aForeignTables2(inCounter,1) = oResult.getString(2) IF aTable(5) = aForeignTables2(inCounter,0) THEN stForeignIDTab1Tab2 = aForeignTables2(inCounter,1) END IF inCounter = inCounter + 1 WEND END IF oDoc = thisComponent oDrawpage = oDoc.drawpage oForm = oDrawpage.forms.getByName(aTable(0)) inRow = -1 IF aTable(1) <> "" THEN oSubForm = oForm.getByName(aTable(1)) IF aTable(2) <> "" THEN oSubSubForm = oSubForm.getByName(aTable(2)) IF aTable(4) <> "" THEN oFieldList = oSubSubForm.getByName(aTable(3)) oFieldID = oSubSubForm.getByName(aTable(4)) inRow = oSubSubForm.Row END IF ELSE IF aTable(4) <> "" THEN oFieldList = oSubForm.getByName(aTable(3)) oFieldID = oSubForm.getByName(aTable(4)) inRow = oSubForm.Row END IF END IF ELSE IF aTable(4) <> "" THEN oFieldList = oForm.getByName(aTable(3)) oFieldID = oForm.getByName(aTable(4)) inRow = oForm.Row END IF END IF inID = -1 IF aTable(4) <> "" THEN IF oFieldID.getCurrentValue() THEN inID = oFieldID.getCurrentValue() END IF END IF DO IF UBound(aTable()) = 6 THEN stSql = "SELECT """ + aTable(6) + """ FROM """ + aTable(5) + """ ORDER BY """ + aTable(6) + """" ELSEIF UBound(aTable()) = 7 THEN stSql = "SELECT """ + aTable(6) + """||' > '||""" + aTable(7) + """ FROM """ + aTable(5) + """ ORDER BY """ + aTable(6) + """" ELSE stSql = "SELECT """ + aTable(5) + """.""" + aTable(6) + """||' > '||""" + aTable(8) + """.""" + aTable(7) + """ FROM """ + aTable(5) + """, """ + aTable(8) + """" stSql = stSql + " WHERE """ + aTable(8) + """.""" + stForeignIDTab2Tab1 + """ = """ + aTable(5) + """.""" + stForeignIDTab1Tab2 + """ ORDER BY """ + aTable(6) + """" END IF oResult = oSQL_Command.executeQuery(stSql) inCounter = 0 WHILE oResult.next ReDim Preserve aContent(inCounter) aContent(inCounter) = oResult.getString(1) inCounter = inCounter+1 WEND DialogLibraries.LoadLibrary("Standard") oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog_TableAdjustment) oCtlList1 = oDlg.GetControl("ListBox1") oCtlList1.addItems(aContent(),0) oCtlList2 = oDlg.GetControl("ListBox2") oCtlList2.addItems(aContent(),0) oCtlLabel1 = oDlg.GetControl("Label1") oCtlLabel1.setText(aTable(5)) oCtlCheck1 = oDlg.GetControl("CheckBox1") oCtlText = oDlg.GetControl("TextField1") IF inRepeat = 1 THEN oCtlCheck2 = oDlg.GetControl("CheckBox2") oCtlCheck2.SetState(1) END IF Select Case oDlg.Execute() Case 1 stContent1 = oCtlList1.getSelectedItem() IF UBound(aTable()) = 6 THEN stSql = "SELECT ""ID"" FROM """ + aTable(5) + """ WHERE """ + aTable(6) + """='" + stContent1 + "'" ELSEIF UBound(aTable()) = 7 THEN stSql = "SELECT ""ID"" FROM """ + aTable(5) + """ WHERE """ + aTable(6) + """||' > '||""" + aTable(7) + """='" + stContent1 + "'" ELSE stSql = "SELECT """ + stSideTable + """.""ID"" FROM """ + aTable(5) + """, """ + aTable(8) + """" stSql = stSql + " WHERE """ + aTable(8) + """.""" + stForeignIDTab2Tab1 + """ = """ + aTable(5) + """.""" + stForeignIDTab1Tab2 + """" stSql = stSql + " AND """ + aTable(5) + """.""" + aTable(6) + """||' > '||""" + aTable(8) + """.""" + aTable(7) + """='" + stContent1 + "'" END IF oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next inLB1 = oResult.getInt(1) WEND stText = oCtlText.Text IF stText <> "" THEN aText() = Sting_to_SQL(Split(stText, ">")) IF UBound(aTable()) = 6 OR UBound(aText()) = 0 THEN stSql = "UPDATE """ + aTable(5) + """ SET """ + aTable(6) + """='" + trim(stText) + "' WHERE ""ID""='" + inLB1 + "'" ELSEIF UBound(aTable()) = 7 THEN stSql = "UPDATE """ + aTable(5) + """ SET """ + aTable(6) + """='" + trim(aText(0)) + "', """ + aTable(7) + """='" + trim(aText(1)) + "' WHERE ""ID""='" + inLB1 + "'" ELSE stSql = "UPDATE """ + aTable(5) + """ SET """ + aTable(6) + """='" + trim(aText(0)) + "' WHERE " stSql = stSql + " ""ID""= (SELECT """ + stForeignIDTab2Tab1 + """ FROM """ + stSideTable + """ WHERE ""ID"" = '" + inLB1 + "');" stSql = stSql + "UPDATE """ + aTable(8) + """ SET """ + aTable(7) + """='" + trim(aText(1)) + "' WHERE " stSql = stSql + " ""ID""= (SELECT """ + stForeignIDTab1Tab2 + """ FROM """ + stSideTable + """ WHERE ""ID"" = '" + inLB1 + "')" END IF oSQL_Command.executeQuery(stSql) ELSEIF oCtlList2.getSelectedItem() <> "" THEN stContent2 = oCtlList2.getSelectedItem() IF UBound(aTable()) = 6 THEN stSql = "SELECT ""ID"" FROM """ + aTable(5) + """ WHERE """ + aTable(6) + """='" + stContent2 + "'" ELSEIF UBound(aTable()) = 7 THEN stSql = "SELECT ""ID"" FROM """ + aTable(5) + """ WHERE """ + aTable(6) + """||' > '||""" + aTable(7) + """='" + stContent2 + "'" ELSE stSql = "SELECT """ + stSideTable + """.""ID"" FROM """ + aTable(5) + """, """ + aTable(8) + """" stSql = stSql + " WHERE """ + aTable(8) + """.""" + stForeignIDTab2Tab1 + """ = """ + aTable(5) + """.""" + stForeignIDTab1Tab2 + """" stSql = stSql + " AND """ + aTable(5) + """.""" + aTable(6) + """||' > '||""" + aTable(8) + """.""" + aTable(7) + """='" + stContent2 + "'" END IF oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next inLB2 = oResult.getInt(1) WEND IF stSideTable = aTable(5) THEN FOR i = LBound(aForeignTables()) TO UBound(aForeignTables()) stSql = "SELECT ""COLUMN_NAME"" FROM ""INFORMATION_SCHEMA"".""SYSTEM_INDEXINFO"" WHERE ""TABLE_NAME"" = '" + aForeignTables(i,0) + "' AND " stSql = stSql + """NON_UNIQUE"" = False AND ""INDEX_NAME"" = (SELECT ""INDEX_NAME"" FROM ""INFORMATION_SCHEMA"".""SYSTEM_INDEXINFO""" stSql = stSql + "WHERE ""TABLE_NAME"" = '" + aForeignTables(i,0) + "' AND ""COLUMN_NAME"" = '" + aForeignTables(i,1) + "')" oResult = oSQL_Command.executeQuery(stSql) stFieldHeader = "" inUnique = 0 inCounter = 0 WHILE oResult.next stFieldHeader = oResult.getString(1) IF aForeignTables(i,1) = stFieldHeader THEN inUnique = 1 ELSE ReDim Preserve aColumns(inCounter) aColumns(inCounter) = oResult.getString(1) inCounter = inCounter + 1 END IF WEND IF inUnique = 1 THEN stSql = "UPDATE """ + aForeignTables(i,0) + """ AS ""a"" SET """ + aForeignTables(i,1) + """='" + inLB2 + "' WHERE """ + aForeignTables(i,1) + """='" + inLB1 + "' AND " stSql = stSql + "( SELECT COUNT(*) FROM """ + aForeignTables(i,0) + """ WHERE """ + aForeignTables(i,1) + """='" + inLB2 + "' )" IF inCounter > 0 THEN stFieldgruppe = Join(aColumns(), """|| ||""") stFieldHeader = "" FOR ink = LBound(aColumns()) TO UBound(aColumns()) stFieldHeader = stFieldHeader + "AND """ + aColumns(ink) + """ = ""a"".""" + aColumns(ink) + """ " NEXT stSql = Left(stSql, Len(stSql) - 1) stSql = stSql + stFieldHeader + "GROUP BY (""" + stFieldgruppe + """) ) < 1" END IF ELSE stSql = "UPDATE """ + aForeignTables(i,0) + """ SET """ + aForeignTables(i,1) + """='" + inLB2 + "' WHERE """ + aForeignTables(i,1) + """='" + inLB1 + "'" END IF oSQL_Command.executeQuery(stSql) NEXT stSql = "DELETE FROM """ + aTable(5) + """ WHERE ""ID""='" + inLB1 + "'" oSQL_Command.executeQuery(stSql) END IF IF UBound(aTable()) = 8 THEN IF stSideTable = aTable(8) THEN FOR i = LBound(aForeignTables2()) TO UBound(aForeignTables2()) stSql = "SELECT ""COLUMN_NAME"" FROM ""INFORMATION_SCHEMA"".""SYSTEM_INDEXINFO"" WHERE ""TABLE_NAME"" = '" + aForeignTables2(i,0) + "' AND " stSql = stSql + """NON_UNIQUE"" = False AND ""INDEX_NAME"" = (SELECT ""INDEX_NAME"" FROM ""INFORMATION_SCHEMA"".""SYSTEM_INDEXINFO""" stSql = stSql + "WHERE ""TABLE_NAME"" = '" + aForeignTables2(i,0) + "' AND ""COLUMN_NAME"" = '" + aForeignTables2(i,1) + "')" oResult = oSQL_Command.executeQuery(stSql) stFieldHeader = "" inUnique = 0 inCounter = 0 WHILE oResult.next stFieldHeader = oResult.getString(1) IF aForeignTables2(i,1) = stFieldHeader THEN inUnique = 1 ELSE ReDim Preserve aColumns(inCounter) aColumns(inCounter) = oResult.getString(1) inCounter = inCounter + 1 END IF WEND IF inUnique = 1 THEN stSql = "UPDATE """ + aForeignTables2(i,0) + """ AS ""a"" SET """ + aForeignTables2(i,1) + """='" + inLB2 + "' WHERE """ + aForeignTables2(i,1) + """='" + inLB1 + "' AND " stSql = stSql + "( SELECT COUNT(*) FROM """ + aForeignTables2(i,0) + """ WHERE """ + aForeignTables2(i,1) + """='" + inLB2 + "'" IF inCounter > 0 THEN stFieldgruppe = Join(aColumns(), """|| ||""") stFieldHeader = "" FOR ink = LBound(aColumns()) TO UBound(aColumns()) stFieldHeader = stFieldHeader + " AND """ + aColumns(ink) + """ = ""a"".""" + aColumns(ink) + """ " NEXT stSql = Left(stSql, Len(stSql) - 1) stSql = stSql + stFieldHeader + "GROUP BY (""" + stFieldgruppe + """) ) < 1" END IF ELSE stSql = "UPDATE """ + aForeignTables2(i,0) + """ SET """ + aForeignTables2(i,1) + """='" + inLB2 + "' WHERE """ + aForeignTables2(i,1) + """='" + inLB1 + "'" END IF oSQL_Command.executeQuery(stSql) NEXT stSql = "DELETE FROM """ + aTable(8) + """ WHERE ""ID""='" + inLB1 + "'" oSQL_Command.executeQuery(stSql) END IF END IF IF inID = inLB1 THEN inID = inLB2 END IF inRow = 1 ELSEIF oCtlCheck1.State = 1 THEN stCondition = "" IF stSideTable = aTable(5) THEN FOR i = LBound(aForeignTables()) TO UBound(aForeignTables()) stCondition = stCondition + """ID"" NOT IN (SELECT """ + aForeignTables(i,1) + """ FROM """ + aForeignTables(i,0) + """) AND " NEXT ELSE FOR i = LBound(aForeignTables2()) TO UBound(aForeignTables2()) stCondition = stCondition + """ID"" NOT IN (SELECT """ + aForeignTables2(i,1) + """ FROM """ + aForeignTables2(i,0) + """) AND " NEXT END IF stCondition = Left(stCondition, Len(stCondition) - 4) stSql = "DELETE FROM """ + stSideTable + """ WHERE " + stCondition + "" oSQL_Command.executeQuery(stSql) TableIndexDown(stSideTable) ELSE msgbox "Nothing to do - nothing done!" END IF oCtlCheck2 = oDlg.GetControl("CheckBox2") IF oCtlCheck2.State = 1 THEN inRepeat = 1 ELSE inRepeat = 0 END IF Case 0 inRepeat = 0 End Select LOOP WHILE inRepeat = 1 IF aTable(3) <> "" THEN oFieldList.refresh() END IF IF inID <> "" AND aTable(4) <>"" AND inRow <> -1 THEN IF UBound(aTable()) = 6 THEN stSql = "SELECT """ + aTable(6) + """ FROM """ + aTable(5) + """ WHERE ""ID""='" + inID + "'" ELSEIF UBound(aTable()) = 7 THEN stSql = "SELECT """ + aTable(6) + """||' > '||""" + aTable(7) + """ FROM """ + aTable(5) + """ WHERE ""ID""='" + inID + "'" ELSE stSql = "SELECT """ + aTable(5) + """.""" + aTable(6) + """||' > '||""" + aTable(8) + """.""" + aTable(7) + """" stSql = stSql + " FROM """ + aTable(5) + """, """ + aTable(8) + """ WHERE """ + aTable(8) + """.""" + stForeignIDTab2Tab1 + """ = " stSql = stSql + """" + aTable(5) + """.""" + stForeignIDTab1Tab2 + """ AND """ + stSideTable + """.""ID""='" + inID + "'" END IF oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next stFieldList = oResult.getString(1) WEND oDocCrl = ThisComponent.getCurrentController() oCtlView = oDocCrl.GetControl(oFieldList) oCtlView.setText(stFieldList) ELSE IF aTable(2) <> "" THEN inRow = oSubSubForm.Row oSubSubForm.reload() oSubSubForm.absolute(inRow) ELSEIF aTable(1) <> "" THEN inRow = oSubForm.Row oSubForm.reload() oSubForm.absolute(inRow) ELSE inRow = oForm.Row oForm.reload() oForm.absolute(inRow) END IF END IF oDlg.endExecute() oDlg.Dispose() END SUB |
Standard |
Maintenance |
TableIndexDown |
|
Basic |
TableAdjustment (Procedure) IndexAllTablesDown (Procedure) |
24 |
SUB TableIndexDown(stTable AS STRING) DIM inCount AS INTEGER DIM inSequenceValue AS INTEGER oDataSource = ThisComponent.Parent.CurrentController IF NOT (oDataSource.isConnected()) THEN oDataSource.connect() END IF oConnection = oDataSource.ActiveConnection() oSQL_Command = oConnection.createStatement() stSql = "SELECT MAX(""ID"") FROM """+stTable+"""" oResult = oSQL_Command.executeQuery(stSql) WHILE oResult.next inCount = oResult.getInt(1) WEND IF inCount = "" THEN inCount = -1 END IF inSequenceValue = inCount+1 oSQL_Command1 = oConnection.createStatement() oSQL_Command1.executeQuery("ALTER TABLE """ + stTable + """ ALTER COLUMN ""ID"" RESTART WITH " + inSequenceValue + "") END SUB |
Standard |
Navigation |
MainformOpen |
|
Basic |
|
3 |
SUB MainformOpen ThisDatabaseDocument.FormDocuments.getByName( "Media" ).open END SUB |
Standard |
Navigation |
ToFormFromForm |
|
Basic |
Loan|Button 4 (Control) Loan|Button 3 (Control) Loan|Button 2 (Control) Media|Button 1 (Control) Media|Button 2 (Control) Media|Button 3 (Control) Reader_Admission|Button 4 (Control) Reader_Admission|Button 2 (Control) Reader_Admission|Button 1 (Control) Recall|Button 4 (Control) Recall|Button 3 (Control) Recall|Button 1 (Control) |
7 |
SUB ToFormFromForm(oEvent AS OBJECT) DIM stTag AS STRING stTag = oEvent.Source.Model.Tag aForms() = Split(stTag, ",") ThisDatabaseDocument.FormDocuments.getByName( Trim(aForms(0)) ).open ThisDatabaseDocument.FormDocuments.getByName( Trim(aForms(1)) ).close END SUB |
Standard |
Navigation |
ToFormFromFormWithFolder |
|
Basic |
|
20 |
SUB ToFormFromFormWithFolder(oEvent AS OBJECT) DIM stTag AS STRING stTag = oEvent.Source.Model.Tag aForms() = Split(stTag, ",") aForms1() = Split(aForms(0),"/") aForms2() = Split(aForms(1),"/") IF UBound(aForms1()) = 0 THEN ThisDatabaseDocument.FormDocuments.getByName( Trim(aForms1(0)) ).open ELSE ThisDatabaseDocument.FormDocuments.getByName( Trim(aForms1(0)) ).getByName( Trim(aForms1(1)) ).open END IF IF UBound(aForms2()) = 0 THEN ThisDatabaseDocument.FormDocuments.getByName( Trim(aForms2(0)) ).close ELSE ThisDatabaseDocument.FormDocuments.getByName( Trim(aForms2(0)) ).getByName( Trim(aForms2(1)) ).close END IF END SUB |
Standard |
Print |
ReportStart |
|
Basic |
Media|butMediaChart (Control) Recall|Button 5 (Control) |
15 |
SUB ReportStart(oEvent AS OBJECT) DIM stTag AS String stTag = oEvent.Source.Model.Tag IF stTag = "Recall" THEN oDataSource = ThisComponent.Parent.CurrentController If NOT (oDataSource.isConnected()) Then oDataSource.connect() End If oConnection = oDataSource.ActiveConnection() oSQL_Command = oConnection.createStatement() stSql = "INSERT INTO ""Recall"" (""Loan_ID"",""Date"") SELECT ""ID"",""Today"" FROM ""View_Reminder""" oSQL_Command.executeUpdate(stSql) END IF ThisDatabaseDocument.ReportDocuments.getByName( stTag ).open END SUB |
Standard |
Refreshing |
LoanRefresh |
|
Basic |
Loan|Choose_Reader|Show_Reader|Loan|Input|Listfield 1 (Control) |
20 |
SUB LoanRefresh DIM oDoc AS OBJECT DIM oDrawpage AS OBJECT DIM oForm AS OBJECT DIM oSubForm AS OBJECT DIM oSubSubForm AS OBJECT DIM oField AS OBJECT oDoc = thisComponent oDrawpage = oDoc.drawpage oForm = oDrawpage.forms.getByName("Filter") oSubForm = oForm.getByName("Choose_Reader") oSubSubForm = oSubForm.getByName("Show_Reader") oSubSubSubForm = oSubSubForm.getByName("Loan") oSubSubSubSubForm = oSubSubSubForm.getByName("Input") oField = oSubSubSubSubForm.getByName("Listfield 1") oField.commit() oSubSubSubSubForm.insertRow() oField.refresh() oSubSubSubForm.reload() END SUB |
Standard |
Refreshing |
LoanWindowRefresh |
|
Basic |
ReturnRefresh (Procedure) |
19 |
SUB LoanWindowRefresh DIM oDoc AS OBJECT DIM oDrawpage AS OBJECT DIM oForm AS OBJECT DIM oSubForm AS OBJECT DIM oSubSubForm AS OBJECT DIM oSubSubSubForm AS OBJECT DIM oSubSubSubSubForm AS OBJECT DIM oField AS OBJECT oDoc = thisComponent oDrawpage = oDoc.drawpage oForm = oDrawpage.forms.getByName("Filter") oSubForm = oForm.getByName("Choose_Reader") oSubSubForm = oSubForm.getByName("Show_Reader") oSubSubSubForm = oSubSubForm.getByName("Loan") oSubSubSubSubForm = oSubSubSubForm.getByName("Input") oField = oSubSubSubSubForm.getByName("Listfield 1") oField.refresh() END SUB |
Standard |
Refreshing |
ReturnRefresh |
|
Basic |
Loan|Choose_Reader|Return|Tablecontrol|Return_Date (Control) |
25 |
SUB ReturnRefresh DIM oDoc AS OBJECT DIM oDrawpage AS OBJECT DIM oForm AS OBJECT DIM oSubForm AS OBJECT DIM oSubSubForm AS OBJECT DIM oSubSubForm2 AS OBJECT DIM oTable AS OBJECT DIM oField1 AS OBJECT DIM oField2 AS OBJECT oDoc = thisComponent oDrawpage = oDoc.drawpage oForm = oDrawpage.forms.getByName("Filter") oSubForm = oForm.getByName("Choose_Reader") oSubSubForm = oSubForm.getByName("Return") oTable = oSubSubForm.getByName("Tablecontrol") oField1 = oTable.getByIndex(2) oField1.commit() oField2 = oTable.getByIndex(3) oField2.commit() oSubSubForm.updateRow() oSubSubForm2 = oSubForm.getByName("Show_Reader") oSubSubForm2.reload() LoanWindowRefresh END SUB |