Hello, to make a backup of SQLite in PostgreSQL. How do I convert SQLite to binary, but most importantly, I have to send String in my query ??
[quote] Dim db As New PostgreSQLDatabase
db.Host = “-..”
db.Port = 5432
db.DatabaseName = “**”
db.Username = “"
db.Password = "”
If db.Connect Then
MsgBox “Connexion OK”
Else
MsgBox(“The connection failed.”)
End If
Dim f As FolderItem = GetFolderItem("SSPLiFE.rsd")
If f <> Nil And f.Exists Then
Dim ReadStream As BinaryStream = BinaryStream.Open(f, False) //
// create a large object
Dim oid As Integer = db.CreateLargeObject
If oid < 1 Or db.Error Then
MsgBox db.ErrorMessage
Return
End If
Dim lo As PostgreSQLLargeObject = db.OpenLargeObject(oid)
If lo = Nil Or db.Error Then
MsgBox db.ErrorMessage
Raise New RuntimeException
End If
lo.Write(str(ReadStream)) //<---- NOT POSSIBLE... BUG
If db.Error Then
MsgBox db.ErrorMessage
Raise New RuntimeException
End If
Dim d as new date
db.SQLExecute "BEGIN TRANSACTION"
sql ="INSERT INTO ""SAUVEGARDES"" (""UR"", ""UNITE"", ""NOMFICHIER"",""DONNEE"",""DATE"",""LONGDATE"") VALUES ('919136', 'BRIOCHE DOREE','NOMFICHIER','"+str(ReadStream)+"','"+d.SQLDate+"','"+d.SQLDateTime+"');"
db.SQLExecute (sql)
if db.error then
msgbox db.errormessage
db.rollback
else
db.Commit
end if
MsgBox "Envoy"
end [/quote]
thanks !