Interested in a training?
Contact us for a trainings and events or meet us at Real World in Orlando, Florida.
Contact us for a trainings and events or meet us at Real World in Orlando, Florida.
MBS Real Studio Plugin Tutorial Videos
SQLite Extension Install REALserver Source
Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = E&xit
Const kEditClear = &Delete
End Class
Class Window1
Inherits Window
// Controls
ControlInstance
Sub DoubleClick() Handles Event
dim RowID as string = me.CellTag(me.ListIndex, 0)
dim rec as RecordSet = r.SQLSelect("SELECT name, ReadBlobMBS(NULL, path) FROM test where RowID="+RowID)
if rec<>nil then
dim name as string = rec.IdxField(1).StringValue
dim data as string = rec.IdxField(2).StringValue
dim pic as Picture = JPEGStringToPictureMBS(data, true)
if pic<>Nil then
dim w as new PicWindow
w.Title = name
w.Backdrop = pic
w.Width = pic.Width
w.Height = pic.Height
end if
end if
End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
dim f as FolderItem = GetOpenFolderItem(MyFileTypes.any)
if f=nil then Return
dim p as Picture = f.OpenAsPicture
if p = nil then
MsgBox "Not a picture file."
Return
end if
dim data as string = PictureToJPEGStringMBS(p, 75)
dim name as string = f.DisplayName
dim d as new DatabaseRecord
d.Column("name")=name
r.InsertRecord("test",d)
dim RowID as string = str(R.LastRowID)
r.SQLExecute "UPDATE test SET path = WriteBlobMBS(x'"+EncodingToHexMBS(data)+"', ""/data/"+RowID+".jpg"") where RowID = "+RowID
r.Commit
update
End Sub
End ControlInstance
// Properties
Dim r As REALSQLServerDatabase
// Event implementations
Sub Open()
r = new REALSQLServerDatabase
r.Host = "localhost"
r.DatabaseName = "test"
r.UserName = "admin"
r.Password = "admin"
if r.Connect then
update
else
MsgBox "Failed to connect."
end if
End Sub
// Methods
Sub update()
list.DeleteAllRows
dim rec as RecordSet = r.SQLSelect("select RowID, name from test")
if rec<>Nil then
while not rec.EOF
dim RowID as string = rec.IdxField(1).StringValue
dim Name as string = rec.IdxField(2).StringValue
List.AddRow name
List.CellTag(List.LastIndex,0)=RowID
rec.MoveNext
wend
end if
End Sub
End Class
Class PicWindow
Inherits Window
End Class
Loading
Links
MBS Real Studio Chart Plugins - Pfarrgemeinde St. Arnulf Nickenich