Dim kvs As KeyValueStore
kvs.Initialize(fc.InitialDirectory, "datastore2")
Private sql As SQL
File.Delete(TextField3.Text, "")
sql.InitializeSQLite(TextField3.Text, "converted", True)
sql.BeginTransaction
Try
sql.ExecNonQuery("CREATE TABLE data (key TEXT, value TEXT, PRIMARY KEY (key, key))")
Dim wb As PoiWorkbook
wb.InitializeExisting(Xls, "", "")
Dim sheet As PoiSheet = wb.GetSheet(0)
Dim keyRow As PoiRow = sheet.GetRow(0)
If keyRow.IsInitialized = False Then
cutils.ShowNotification2("", "Key row not found!", cutils.ICON_ERROR, MainForm)
Return
End If
Dim langs As List
For Each cell As PoiCell In keyRow.Cells
If cell.ValueString.ToLowerCase = "value" Then Continue
langs.Add(cell.ValueString)
Next
For Each row As PoiRow In sheet.Rows
If row.RowNumber = 0 Then Continue
Dim key As String
For Each key In kvs.ListKeys
If cell.ColumnIndex = 0 Then
kvs.Put(key, kvs.Get)
Else
Dim lang As String = langs.Get(cell.ColumnIndex - 1)
sql.ExecNonQuery2("INSERT INTO data VALUES (?, ?, ?)", Array (key.ToLowerCase, lang, cell.ValueString))
End If
Next
Next
sql.TransactionSuccessful
wb.Close
Log("Finished!")