#1 Re: mORMot 1 » Trouble connecting to mORMot data via TSynRestDataset » 2019-04-29 14:27:40

Arnaud,

So the question is, how do I authenticate?

Project04Client.dpr authenticates like this:
  TSQLHttpClient(Form1.Database).SetUser('User','synopse');

I suspect that TSynRestSQLDataSet.OnGetURISignature needs to be implemented, but there's no example in the documentation on how to implement it.
I've seen that "&session_signature=..." is added, but I can't find a method that generates the signature.

#2 mORMot 1 » Trouble connecting to mORMot data via TSynRestDataset » 2019-04-24 14:14:28

BrainCell
Replies: 3

Following the example in: 
  mORMot\SQLite3\Samples\ThirdPartyDemos\EMartin\TSynRestDataset

I modified the mORMot\SQLite3\Samples\04 - HTTP Client-Server example to contain a TSynRestDataset that should be able to connect to the SampleModel data as such:

  Model := CreateSampleModel; // from SampleData unit
  ds := TSynRestDataset.Create(Self);
  ds.DataSet.SQLModel := Model;
  ds.CommandText := 'http://localhost:8080/root/SampleRecord?select=Time,Name,Question&sort=ID';
  ds.Open;

Upon running the ds.Open; I get :

First chance exception at $7C812FD3. Exception class ESynException with message 'Error
Authentication Failed: Invalid signature (0)
from
http://localhost:8080/root/SampleRecord?select=Time,Name,Question&sort=ID'. Process Project04Client.exe (103652)

What might I be missing? I know the server is running, because the I didn't remove the Project04Client controls, and they still work even after the Exception.

#3 mORMot 1 » Owner measured and drawn DBLookupListBox alternative for mORMot? » 2019-03-14 13:34:00

BrainCell
Replies: 1

Synopse,
  First, let me thank you for all your work on mORMot. I've had it for years, but I didn't understand it because I didn't take the time to investigate it, but recently, I've been looking to abstract the presentation layer of a Delphi program that I wrote in 2004, and I've been maintaining ever since that is tightly bound to the database engine.
  Years ago I created an owner measured and drawn DBLookupListBox alternative using large portions of the code from the DBCtrls unit. I'm not ready to completely ditch the look and feel of this in favor of the mORMot TDrawGrid just yet, so I was wondering if you'd be able to point me toward a way to connect a mORMot table to a TDatasource, or suggest some way to get the same functionality. If you paste the form components below onto a new form, you will see the general idea of my design (I changed my custom DBLookupListBox alternative into a TDBLookupListBox so that you can see what it would look like). I inherit from the form that results from the code below, and then add the functionality to communicate with the database in the descendant.
Sincerely,
Brain Cell

This code is from Delphi 2005 (which is the one that I could afford at the time)

object PickListSplitter: TSplitter
  Left = 165
  Top = 26
  Height = 145
end
object DetailsBox: TGroupBox
  Left = 168
  Top = 26
  Width = 493
  Height = 145
  Align = alClient
  Caption = ' Information Details '
  TabOrder = 3
  object memoDetails: TRichEdit
    Left = 2
    Top = 15
    Width = 489
    Height = 128
    Align = alClient
    BorderStyle = bsNone
    Color = clMenu
    PopupMenu = menuDetailsContext
    ReadOnly = True
    TabOrder = 0
  end
end
object gbPickList: TGroupBox
  Left = 0
  Top = 26
  Width = 165
  Height = 145
  Align = alLeft
  Caption = ' Pick List '
  TabOrder = 0
  object dbPickList: TDBLookupListBox
    Left = 2
    Top = 15
    Width = 161
    Height = 128
    Align = alClient
    BorderStyle = bsNone
    ListSource = dsPickList
    ParentColor = True
    TabOrder = 0
    OnDblClick = dbPickListDblClick
  end
end
object pnlSearch: TPanel
  Left = 366
  Top = 39
  Width = 289
  Height = 29
  Anchors = [akTop, akRight]
  TabOrder = 1
  Visible = False
  object lblSearch: TLabel
    Left = 8
    Top = 7
    Width = 52
    Height = 13
    Caption = 'Search for:'
  end
  object edtSearch: TEdit
    Left = 85
    Top = 4
    Width = 121
    Height = 21
    TabOrder = 0
  end
  object btnSearch: TBitBtn
    Left = 208
    Top = 4
    Width = 75
    Height = 21
    Caption = 'Go !'
    TabOrder = 1
  end
end
object ControlBar1: TControlBar
  Left = 0
  Top = 0
  Width = 661
  Height = 26
  Align = alTop
  BevelEdges = []
  BevelInner = bvNone
  BevelOuter = bvNone
  BevelKind = bkNone
  TabOrder = 2
  object ToolBar: TToolBar
    Left = 11
    Top = 2
    Width = 529
    Height = 22
    Align = alNone
    AutoSize = True
    ButtonHeight = 20
    ButtonWidth = 40
    Color = clBtnFace
    EdgeBorders = [ebRight]
    EdgeInner = esNone
    EdgeOuter = esNone
    ParentColor = False
    TabOrder = 0
    DesignSize = (
      529
      22)
    object btnNew: TSpeedButton
      Left = 0
      Top = 2
      Width = 70
      Height = 20
      Action = actNew
      AllowAllUp = True
      Anchors = [akTop]
      Flat = True
      NumGlyphs = 2
    end
    object btnEdit: TSpeedButton
      Left = 70
      Top = 2
      Width = 58
      Height = 20
      Action = actEdit
      AllowAllUp = True
      Anchors = [akTop]
      Flat = True
      NumGlyphs = 2
    end
    object btnDelete: TSpeedButton
      Left = 128
      Top = 2
      Width = 70
      Height = 20
      Action = actDelete
      AllowAllUp = True
      Anchors = [akTop]
      Flat = True
      NumGlyphs = 2
    end
    object btnFind: TSpeedButton
      Left = 198
      Top = 2
      Width = 70
      Height = 20
      Action = actFind
      AllowAllUp = True
      Anchors = [akTop]
      Flat = True
      NumGlyphs = 2
    end
    object btnShowAll: TSpeedButton
      Left = 268
      Top = 2
      Width = 70
      Height = 20
      Action = actShowAll
      AllowAllUp = True
      Anchors = [akTop]
      Flat = True
      NumGlyphs = 2
    end
    object btnSortBy: TSpeedButton
      Left = 338
      Top = 2
      Width = 53
      Height = 20
      Action = actSortBy
      AllowAllUp = True
      Anchors = [akTop]
      Flat = True
      NumGlyphs = 2
    end
    object btnPrint: TSpeedButton
      Left = 391
      Top = 2
      Width = 70
      Height = 20
      Action = actPrint
      AllowAllUp = True
      Anchors = [akTop]
      Flat = True
      NumGlyphs = 2
    end
    object btnExit: TSpeedButton
      Left = 461
      Top = 2
      Width = 68
      Height = 20
      Action = actExit
      AllowAllUp = True
      Anchors = [akTop, akRight]
      Flat = True
    end
  end
end
object dsPickList: TDataSource
  OnDataChange = dsPickListDataChange
  Left = 4
  Top = 40
end
object tmrShowDetails: TTimer
  Enabled = False
  Interval = 250
  Left = 68
  Top = 40
end
object menuDetailsContext: TPopupMenu
  Left = 100
  Top = 40
  object miCopy: TMenuItem
    Action = actEditCopy
  end
  object miSelectAll: TMenuItem
    Action = actEditSelectAll
  end
  object miPrint: TMenuItem
    Action = actEditPrint
  end
end
object EditMenuActions: TActionList
  Left = 36
  Top = 40
  object actNew: TAction
    Category = 'Toolbar'
    Caption = 'New (Ins)'
    ShortCut = 45
  end
  object actEdit: TAction
    Category = 'Toolbar'
    Caption = 'Edit'
  end
  object actDelete: TAction
    Category = 'Toolbar'
    Caption = 'Delete (Del)'
    ShortCut = 46
  end
  object actFind: TAction
    Category = 'Toolbar'
    Caption = '&Find'
    ShortCut = 114
  end
  object actShowAll: TAction
    Category = 'Toolbar'
    Caption = '&Show all'
  end
  object actSortBy: TAction
    Category = 'Toolbar'
    Caption = 'S&ort By'
  end
  object actPrint: TAction
    Category = 'Toolbar'
    Caption = '&Print'
  end
  object actExit: TAction
    Category = 'Toolbar'
    Caption = 'E&xit'
    ShortCut = 32856
    OnExecute = actExitExecute
  end
  object actEditCopy: TEditCopy
    Category = 'Edit'
    Caption = '&Copy'
    Hint = 'Copy'
    ShortCut = 16451
  end
  object actEditSelectAll: TEditSelectAll
    Category = 'Edit'
    Caption = 'Select &All'
    ShortCut = 16449
  end
  object actEditPrint: TAction
    Category = 'Edit'
    Caption = '&Print'
    ShortCut = 16464
  end
end
object EditTimer: TTimer
  Enabled = False
  Interval = 100
  OnTimer = EditTimerTimer
  Left = 172
  Top = 40
end

Board footer

Powered by FluxBB