A
Познакомьтесь с пентестом веб-приложений на практике в нашем новом бесплатном курсе
Религии разные.
Не может открыть БД. Например со стороны SQL сервера некие ограничения или просто выключен.
Код показывайте.
У вас скорее всего не закрывается соединение (не освобождаются объекты)
Exit_function:
If Not oDb Is Nothing Then Call oDb.Close:Set oDb = Nothing
If Not objShell Is Nothing Then Set objShell = Nothing
Exit Sub
Спасибо вам большое, кажется до меня дошло где и что. Вот код из Export All to SQLiteПервое, что вижу:
В агенте "Export All to SQLite" при возникновении ошибки (и при прерывании выполнения по Exit) обработчик не закрывает объект "LiteX.LiteConnection" и "Shell.Application".
т.е. надо добавить 2 строки (if) в конце Initialize
И перегрузить OS WinКод:Exit_function: If Not oDb Is Nothing Then Call oDb.Close:Set oDb = Nothing If Not objShell Is Nothing Then Set objShell = Nothing Exit Sub
%REM
Agent Export All
Description: Comments for Agent
%END REM
Option Public
Option Declare
Use "StringLib"
Use "ExportLib"
Use "sysFileTools"
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim fp As String
Dim dlgDoc As NotesDocument
Dim res As Boolean
Set db=s.Currentdatabase
Set dlgDoc = New NotesDocument(db)
Dim ws As New NotesUIWorkspace
Dim objShell As Variant
Dim objFolder As Variant
Dim objFolderItem As Variant
Dim bOverWrite As Boolean
On Error GoTo Err_handler
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Please select a folder to save the Gitabase file:", 0, "")
If Not (objFolder Is Nothing) Then
Set objFolderItem = objFolder.Self
fp=objFolderItem.Path
If Right(fp,1)<>"\" Then fp=fp+"\"
Else
Exit Sub
End If
'init dlg values
Dim al As String
Dim fn As String,wn As String, vers As String, lang As String
Set db=s.CurrentDatabase
fn=db.FileName
fn=ReplaceSubStringNew(fn,".","")
al= s.GetEnvironmentString("GBEditor_"+fn+"_alias")
lang = s.GetEnvironmentString("GBEditor_"+fn+"_lang")
vers= s.GetEnvironmentString("GBEditor_"+fn+"_version")
wn= s.GetEnvironmentString("GBEditor_"+fn+"_wn")
dlgDoc.Alias = al
dlgDoc.Lang=lang
dlgDoc.Version=vers
'dlgDoc.WhatsNew=wn
dlgDoc.fpath=fp
res = ws.DialogBox("dlgExport", True, True, False, False, False, False, "Export to SQLite", dlgDoc, true)
If Not res Then Exit Sub
'extract the database file
Dim sv As NotesView
Dim sdoc As NotesDocument
Set sv=db.Getview("settings")
Dim rtitem As NotesRichTextItem
Dim fname As String, ret As Variant
Set sdoc = sv.Getfirstdocument()
If sdoc Is Nothing Then
MessageBox "Settings document not found. Please create one."
Exit sub
End If
Set rtitem = sdoc.Getfirstitem("Body")
If ( rtitem.Type = RICHTEXT ) = False Then Exit Sub
If IsEmpty(rtitem.EmbeddedObjects) Then Exit Sub
bOverWrite=true
If fileExists(dlgdoc.fullFilename(0)) Then
ret=ws.Prompt(11, "Export Gitabase", "File "+dlgdoc.fullFilename(0)+" already exists."+Chr(13)+"Would you like to OVERWRITE it (yes) APPEND data to it (No) or stop export (Cancel) ??")
If ret=-1 Then Exit Sub
If ret=0 Then bOverWrite=false
End If
If bOverWrite Then
ForAll o In rtitem.EmbeddedObjects ' loops through all attachments
If ( o.Type = EMBED_ATTACHMENT And o.Source="gitabase_texts_blank.db" ) Then
Call o.ExtractFile ( dlgdoc.fullFilename(0) )
End If
End ForAll
End If
'start exporting
Dim oDb As Variant
Dim eview As NotesView
Dim doc As NotesDocument
Dim sql_insert As String
Set oDb = CreateObject("LiteX.LiteConnection")
oDb.Path = dlgdoc.fullFilename(0)
Call oDb.Open()
'export books
Set eview = db.GetView( "books" )
Set doc = eview.GetFirstDocument
While Not ( doc Is Nothing )
sql_insert = "insert into books (_id, sort, author, title, desc, type, levels, hasSanskrit, hasPurport, hasColorStructure , isSongBook, text_size, purport_size, text_begin_raw, text_end_raw, web_abbrev, compare_code, issue) values (" + _
"'" + CStr(doc.id(0)) + "'," + _
"'" + CStr(doc.sort_id(0)) + "'," + _
"'" + doc.Author(0) + "'," + _
"'" + doc.title(0) + "'," + _
"'" + doc.desc(0) + "'," + _
"'" + doc.code(0) + "'," + _
"'" + doc.levels(0) + "'," + _
"'" + getFlag(doc.hasSanskrit(0)) + "'," + _
"'" + getFlag(doc.hasPurport(0)) + "'," + _
"'" + getFlag(doc.hasColorStructure(0)) +"',"+_
"'" + getFlag(doc.isSongBook(0)) +"',"+_
"'" + CStr(doc.size_text(0)) + "'," + _
"'" + CStr(doc.size_comment(0)) + "'," + _
"'" + CStr(doc.VersesBegin(0)) + "'," + _
"'" + CStr(doc.VersesEnd(0)) + "'," + _
"'" + CStr(doc.Abbrev(0)) + "'," + _
"'" + CStr(doc.Type(0)) + "'," + _
"'" + CStr(doc.Issue(0)) + "')"
Call oDb.Execute( sql_insert )
Print "exporting "+doc.title(0)
Set doc = eview.GetNextDocument( doc )
Wend
'export songs
Set eview = db.GetView( "songs" )
Set doc = eview.GetFirstDocument
While Not ( doc Is Nothing )
sql_insert = "insert into songs (book_id, song, sort, songname, colorBackgnd, colorForegnd, text_size, purport_size) values (" + _
"'" + CStr(doc.BOOK_ID(0)) + "'," + _
"'" + CStr(doc.Number(0)) + "'," + _
"'" + CStr(doc.Number(0)) + "'," + _
"'" + GetExpText(doc, "Name") + "',"+_
"'" + doc.Color(0) + "'," + _
"'" + "" + "'," + _
"'" + CStr(doc.SIZE_TEXT(0)) + "'," + _
"'" + CStr(doc.SIZE_COMMENT(0)) + "')"
Call oDb.Execute( sql_insert )
Print "exporting volume "+CStr(doc.Number(0))
Set doc = eview.GetNextDocument( doc )
Wend
'export chapters
'Dim prevBook As Integer ',
Dim sSong As String
Set eview = db.GetView( "chapters" )
Set doc = eview.GetFirstDocument
' prevBook=doc.bid(0)
' prevSong=doc.sid(0)
While Not ( doc Is Nothing )
sSong=CStr(doc.sid(0))
If sSong="" Then sSong="1"
If CStr(doc.blevels(0))<>"4" Then sSong="1"
sql_insert = "insert into chapters (book_id, book, song, number, title, desc, colorBackgnd, colorForegnd, text_size, purport_size, prev_size_t, prev_size_p) values (" + _
"'" + CStr(doc.bid(0)) + "'," + _
"'" + doc.bcode(0) + "'," + _
"'" + sSong + "'," + _
"'" + CStr(doc.Number(0)) + "'," + _
"'" + GetExpText(doc, "Name") + "'," + _
"'" +GetExpText(doc, "Desc") +"',"+_
"'" + "" + "'," + _ 'color 1
"'" + "" + "'," + _ 'color 2
"'" + CStr(doc.SIZE_TEXT(0)) + "'," + _
"'" + CStr(doc.SIZE_COMMENT(0)) + "',"+_
"'" + CStr(doc.PREV_SIZE_T(0)) + "'," + _
"'" + CStr(doc.PREV_SIZE_C(0)) + "')"
Call oDb.Execute( sql_insert )
Print "exporting chapter "+CStr(doc.Number(0))
Set doc = eview.GetNextDocument( doc )
Wend
'export special line about database version
sql_insert = "insert into chapters (book_id, book, song, number, title, desc, colorBackgnd, colorForegnd, text_size, purport_size, prev_size_t, prev_size_p) values (" + _
"'" + "1024" + "'," + _ 'DONT CHANGE THIS!! book_id=1024
"'" + "VER" + "'," + _
"'" + "VER" + "'," + _
"'" + CStr(dlgDoc.Version(0)) + "'," + _ 'THIS IS THE VERSION NUMBER
"'" + "Number column contains database version" + "'," + _
"'" + dlgDoc.WhatsNew(0) +"',"+_
"'" + "" + "'," + _
"'" + "" + "'," + _
"'" + "" + "'," + _
"'" + "" + "',"+_
"'" + "" + "'," + _
"'" + "" + "')"
Call oDb.Execute( sql_insert )
'export texts
Dim tagsToTrim As Variant, counter As Long
Dim strTransl As String, strPreview As String, strTextNo As String
Dim hasPurport As String, strComment As String
Dim strSong As String, strChapter As string
Dim strTranslit As String
Dim strTranslByWord As String
Dim serv1 As String, serv2 As String
Dim seq_num As long , varTemp As Variant
Dim tsize As Long
Dim psize As Long
Dim totalsize As Long
Dim prevbook As String
Set eview = db.GetView( "text_export" )
tagsToTrim=Evaluate({@Explode("<A*>|</A>";"|")} )
Set doc = eview.GetFirstDocument
counter=0
'sequential number of the text
prevbook=""
While (Not ( doc Is Nothing )) ' And counter <3000 ' this is for testing
'numbers (s,c,t)
strSong=CStr(doc.sid(0))
If CStr(doc.levels(0))<>"4" Then strSong="1"
strChapter=CStr(doc.cid(0))
If strChapter="" Then strChapter="0"
strTextNo=doc.TextNo(0)
'text
strTransl=GetExpText(doc, "TXTTRANSLATION")
strPreview=ReplaceSubString(strTransl,"<P>", "")
strPreview=ReplaceSubString(strPreview,"</P>", "")
strPreview=ReplaceSubString(strPreview,"<p>", "")
strPreview=ReplaceSubString(strPreview,"</p>", "")
hasPurport="0"
'comment
strComment=""
Set rtItem=doc.Getfirstitem("rtComment")
If Not rtItem Is Nothing Then
strComment=rtItem.Getunformattedtext()
strComment=Trim(Replacesubstring(strComment,"'","''"))
End If
If strComment<>"" Then
hasPurport="1"
End If
'seq num
If prevbook<>doc.bname(0) Then
seq_num=1
Else
If CStr(doc.cid(0))<>"0" Then
'check for multiple texts seq num
If InStr(doc.TextNo(0),"-")=0 Then
seq_num=seq_num+1
Else
varTemp=Evaluate({@Explode(TextNo; "-")}, doc)
If UBound(varTemp) - LBound(varTemp) = 1 Then
If IsNumeric(varTemp(UBound(varTemp))) And IsNumeric(varTemp(LBound(varTemp))) Then
seq_num=seq_num+CInt(varTemp(UBound(varTemp)))-CInt(varTemp(LBound(varTemp)))+1
End If
End If
End If
End If
End If
If CStr(doc.cid(0))="0" Then seq_num=0
prevbook=doc.bname(0)
If CStr(doc.ChapterNo(0))="0" Then seq_num=0
tsize=0
psize=0
totalsize=0
If CStr(doc.PREV_SIZE_T(0))<>"" Then tsize=doc.PREV_SIZE_T(0)
If CStr(doc.PREV_SIZE_C(0))<>"" Then psize=doc.PREV_SIZE_C(0)
If CStr(doc.SIZE_COMMENT(0))<>"" Then totalsize=doc.SIZE_COMMENT(0)
If CStr(doc.SIZE_TEXT(0))<>"" Then totalsize=totalsize+doc.SIZE_TEXT(0)
sql_insert = "insert into textnums (book_id, song, ch_no, txt_no, preview, haspurport, url, service1, service2, text_seq_no, text_offset, text_size, text_id) values (" + _
"'" + CStr(doc.bid(0))+ "'," + _
"'" + strSong + "'," + _
"'" + strChapter + "'," + _
"'" + strTextNo + "'," + _
"'" + strPreview + "'," + _
"'" + hasPurport + "'," + _
"'" +""+ "',"+_
"'" +serv1 + "',"+_
"'" +serv2 + "',"+_
"'" +CStr(seq_num) + "',"+_
"'" +CStr(tsize+psize) + "',"+_
"'" +CStr(totalsize) + "',"+_
"'" +doc.Noteid + "')"
Call oDb.Execute( sql_insert )
strTranslit=GetExpText(doc, "TXTTRANSLIT")
strTranslit=TrimTags("<P>"+strTranslit, tagsToTrim)
If strTranslit="<P>" Then strTranslit=""
strComment=Replacesubstring(strComment,"http://vedabase.net","")
strComment=Replacesubstring(strComment,"HREF=""", "HREF=""gb://pro")
' strComment=Replacesubstring(strComment,"<A", "<font color=""#6B3908""><i><A")
' strComment=Replacesubstring(strComment,"</A>", "</A></i></font>")
strTranslByWord=GetExpText(doc, "TXTTRANSLATIONBYWORD")
' strTranslByWord=Replacesubstring(strTranslByWord, "<A", "<font color=""#6B3908""><b><A")
' strTranslByWord=Replacesubstring(strTranslByWord, "</A>", "</A></b></font>")
strTranslByWord=Replacesubstring(strTranslByWord,"HREF=""", "HREF=""gb://pro")
sql_insert = "insert into texts (sanskrit, translit, translit_srch, transl1, transl2, comment) values (" + _
"'" + doc.TXTSANSKRIT(0) + "'," + _
"'" + strTranslit + "'," + _
"'" + GetExpText(doc, "TXTTRANSLIT") + "'," + _
"'" + strTranslByWord + "'," + _
"'" + strTransl + "'," + _
"'" + strComment + "')"
Call oDb.Execute( sql_insert )
Print "exporting "+doc.book(0)+":"+doc.SONGNO(0)+"."+CStr(doc.ChapterNo(0))+":"+doc.TextNo(0)
Set doc = eview.GetNextDocument( doc )
Wend
Call oDb.Close
Set oDB = Nothing
MessageBox "Export successfully completed!", 0, "Sqlite export"
Exit_function:
Exit Sub
Err_handler:
MessageBox "Error "+Cstr(Err)+" on line "+CStr(Erl)+" (Export All to SQLite) Agent: "+Error
Resume Exit_function
End Sub
Function getFlag(ss As String) As String
getFlag="0"
If ss="Yes" Or ss="1" Then
getFlag="1"
End If
End Function
Function GetExpText(doc As NotesDocument, fname As String)
Dim fn As String, strValue As String, tmpVar As Variant
tmpVar=doc.GetItemValue(fname)
strValue=tmpVar(0)
strValue=Replacesubstring(strValue,"'","''")
strValue=Trim(strValue)
GetExpText= strValue
End Function
Function TrimTags(strHtml As String, tags As Variant) As String
'trims html tags like <p style=qqq> -> <p*>
Dim varRes As Variant, tag1 As String, tag2 As String
Dim iPos1 As Long, iPos2 As Long, strOutput As String
Dim tagHtml As String, strNL As String
ForAll tag In tags
varRes=Evaluate({@Explode("}+tag+{";"*")})
If UBound(varRes)<>LBound(varRes) Then
tag1=ReplaceSubString(varRes(LBound(varRes)), "qq", Chr(34) )
tag2=ReplaceSubString(varRes(UBound(varRes)), "qq", Chr(34) )
iPos1=InStr(1, strHTML, tag1)
While iPos1<>0
iPos2=InStr(iPos1+Len(tag1), strHTML, tag2)
If iPos2<>0 Then
tagHtml=Mid(strHtml, ipos1, ipos2-ipos1+1)
strHTML = ReplaceSubString(strHTML, tagHTML, "")
End If
iPos1=InStr(iPos1+Len(tag1), strHTML, tag1)
Wend
Else
strHTML = ReplaceSubString(strHTML, tag, "")
End If
End ForAll
strNL=Chr(10) '& Chr(13)
strHtml=Replacesubstring(strHtml, strNL, "")
strNL=Chr(13)
TrimTags=Replacesubstring(strHtml, strNL, "")
' ipos1=Instr(1, strHTML, strNL)
' ipos1=Instr(1, strHTML, Chr(10))
' IPOS1=Instr(1, strHTML, Chr(13))
'TrimTags= strNL(0)
End Function
.....
Exit_function:
Exit Sub
.....
.....
Exit_function:
If Not oDb Is Nothing Then Call oDb.Close:Set oDb = Nothing
If Not objShell Is Nothing Then Set objShell = Nothing
Exit Sub
.....
было
сталоКод:..... Exit_function: Exit Sub .....
Код:..... Exit_function: If Not oDb Is Nothing Then Call oDb.Close:Set oDb = Nothing If Not objShell Is Nothing Then Set objShell = Nothing Exit Sub .....
да, и ошибку опишите подробно (что как открываете...)Есть у меня еще одна ошибка, тот же исходник если открываю в Lotus Notes 10 выдает ошибку overflow, мне новую тему создавать?
Нинадо нам тут много про эту БД Пусть все в одном будет.мне новую тему создавать?
да, такая ошибка, а другие базы я не пробывал. Хорошо попробую. Спасибо.Нинадо нам тут много про эту БД Пусть все в одном будет.
Посмотреть вложение 24045
Так сообщение выглядит?
Вот именно в этой БД сразу не нашел ничего такого. Возникает только при обращении к этой БД?
Попробуй из Designer R10 выполнить "Recompile All LotusScript"
Посмотреть вложение 24046
Ivan Sharov, помоги своим пользователям. Hare Krishna !
Обучение наступательной кибербезопасности в игровой форме. Начать игру!