Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 20 of 53 total
Thread How To Perform A Multi-Field Dataset Search?
Mon, Oct 5 2015 7:14 AMPermanent Link

Walter Matte

Tactical Business Corporation

Frederick:

As Uli stated, EWB JS is asynchronous.

 qMnpsmain.Params.Clear;
  qMnpsmain.Params.Add('name='+quotedstr(edtName.Text));
  qMnpsmain.Params.Add('password='+quotedstr(edtPassword.Text));
  Database.Loadrows(qMnpsmain);
  showmessage(IntToStr(qMnpsmain.RowCount));   <<<<<<<<<


When you execute Database.LoadRows   - this causes a request to be sent to the server - the server needs to do the work to get the data from the database and then respond.  This trip takes time.  BUT the next line of code ShowMessage executes immediately - (asynchronously) - web development is completely different than desktop Delphi in this regard. You need to understand when you execute something that causes a tip to the server and a response to come back execution of your program does not wait, it continues.  

So what you need to do is use the events to manage the flow and control within your EWB program.

In the case of LoadRow - you need to put code in the AfterLoad event, or OnLoadError event.

Walter

Mon, Oct 5 2015 8:50 AMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 10/4/2015 11:29 PM, Frederick Chin wrote:
> Thanks for the information. What do you use with EWB to encrypt and decrypt data? I am currently relying on DBISAM's encrypted tables but I am not sure if the data will be decrypted by EWB's web server before it is sent across the wire or will it be decrypted only when EWB receives the data.

No it's decrypted on server and send in plain text - EWB is database
agnostic and works by exchanging JSON with back-end (so all databases
"look" alike to EWB app).

You use SSL/TLS for communication - EWB generates javascript running in
the client browser so there is no meaningful way to encrypt/decrypt
(since your algorithm and password(s) would be trivially readable by any
user who knows about browser debug tools).

Raul
Mon, Oct 5 2015 9:57 AMPermanent Link

Frederick Chin

Uli,

/*
There should be no problem with the syntax of your code. But you have to
know that everything in JS is asynchronous. That's why you should move
this line

showmessage(IntToStr(qMnpsmain.RowCount));

in the OnLoad event of the dataset. Doing so you make sure that the
dataset has been loaded *before* you check the rowcount.

Most probably that's your problem.
*/

Thanks. That was the problem. I'm still coding like for a desktop application.

Frederick
Mon, Oct 5 2015 9:59 AMPermanent Link

Frederick Chin

Walter,

/*
When you execute Database.LoadRows   - this causes a request to be sent to the server - the server needs to do the work to get the data from the database and then respond.  This trip takes time.  BUT the next line of code ShowMessage executes immediately - (asynchronously) - web development is completely different than desktop Delphi in this regard. You need to understand when you execute something that causes a tip to the server and a response to come back execution of your program does not wait, it continues.  

So what you need to do is use the events to manage the flow and control within your EWB program.

In the case of LoadRow - you need to put code in the AfterLoad event, or OnLoadError event.
*/

Thanks. I need to think in a different manner with regard to web applications. After moving the code to OnAfterLoad, the correct result was returned.

Frederick
Mon, Oct 5 2015 10:04 AMPermanent Link

Frederick Chin

Raul,

/*
No it's decrypted on server and send in plain text - EWB is database
agnostic and works by exchanging JSON with back-end (so all databases
"look" alike to EWB app).

You use SSL/TLS for communication - EWB generates javascript running in
the client browser so there is no meaningful way to encrypt/decrypt
(since your algorithm and password(s) would be trivially readable by any
user who knows about browser debug tools).
*/

What would be the best way to securely connect to a desktop computer with the EWB web server running and if the server does not have a fixed IP address?

Frederick
Mon, Oct 5 2015 10:39 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< Note: I wish to suggest that more examples be shown in the manual. >>

Examples of *what*, specifically ?

<< 1.   Is EWB using the name field's index from DBISAM to search for the name? >>

No.  EWB doesn't even know that DBISAM is involved in any way.  EWB client applications are database-agnostic.

<< If my product table has an index for the code field and I do not perform a sort from EWB, will my query take advantage of the code index defined in the DBISAM table? >>

Yes, because the query is being executed by DBISAM in the EWB Web Server, not in the client application.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Oct 5 2015 10:47 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< There should be no problem with the syntax of your code. But you have to know that everything in JS is asynchronous. >>

Clarification: *some* things are asynchronous in JS code.  Server request (include database request) complete events, load/error events for TBrowser, TImage, and TPlugin, and modal form close events are the most notable asynchronous events that an EWB application developer has to be concerned with.  The general rule of thumb is that if the event is originating from the browser, then there is a good chance that it will be fired asynchronously.

On this subject: in the latest ECMAScript (7), there are now things like the "await" keyword that I'll be surfacing in EWB.  They will allow you to do things like this:

await Database.LoadRows(MyDataSet);
...Do some other stuff *after* the rows are loaded...

IOW, no more callback spaghetti. Smile

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Oct 5 2015 11:13 AMPermanent Link

Uli Becker

Tim.

<< On this subject: in the latest ECMAScript (7), there are now things like the "await" keyword that I'll be surfacing in EWB.  They will allow you to do things like this:

await Database.LoadRows(MyDataSet);
...Do some other stuff *after* the rows are loaded...

IOW, no more callback spaghetti. Smile
>>

Thanks for this information.

Uli
Mon, Oct 5 2015 11:51 AMPermanent Link

Frederick Chin

Tim,

/*
Examples of *what*, specifically ?
*/

The following is a sample code in the manual for searching a row and is also the code you asked me to refer for the LOCATE command:-

begin
  with Products do
     begin
     Columns['ProductID'].SortDirection:=sdAscending;
     SortCaseInsensitive:=True;
     Sort;
     InitFind;
     Columns['ProductID'].AsString:='PEN-BP-12PK';
     if Find(False,True) then
        Result:=True
     else
        Result:=False;
     end;
end;

It does not explain what I should do to emulate the functionality of LOCATE. I finally managed to get the results I wanted for a multi-field search by trial and error. Even then, I am not sure if it should be done that way because there is no "official" writeup.

If your manual had the example, I would not have taken time and space by coming here and posting the question.

Your user manual is well written, for a technical guy, but most of the terminology is foreign to me even though I have used Delphi for many years.

When I got EWB, all I wanted to do was to get the application out, using the existing visual components, procedures and functions. I want to know how to generate a report, connect to other databases, connect securely to a desktop computer, compare Delphi's common database commands with EWB's, etc. I do not want to write components and have no desire to do so.

I recently created a user login module with EWB and it took me the better part of two days of work to complete by trial and error, with constant referencing to the manual, and yet, I still have the feeling that I cobbled the module together rather than being knowledgeable, coding it.

I know I could have created the same module in Delphi within 1 hour.

Frederick
Mon, Oct 5 2015 12:50 PMPermanent Link

Matthew Jones

<Frederick Chin> wrote:
> Matthew Jones wrote:
>
> /*
> I realise I may be wrong here, given the little information, but please be
> sure you are not storing passwords "as-is" in text. My password lookup code
> finds the name, and then reads he "salt" to apply to the provided password
> encryption and then compares with the stored encrypted data. Anything less
> is not safe nowadays.
> */
>
> Thanks for the information. What do you use with EWB to encrypt and
> decrypt data? I am currently relying on DBISAM's encrypted tables but I
> am not sure if the data will be decrypted by EWB's web server before it
> is sent across the wire or will it be decrypted only when EWB receives the data.
>
> Frederick
>
>

I don't use modules, sorry. But EWB has security built in if you use EDB,
so consider switching. FWIW I had my shop working with DBISAM and decided
to switch to a grown up EDB and it was only a few hours.

Also, this went by my feed:

http://blog.learningtree.com/why-you-need-to-pay-attention-to-the-wyndham-case/

Doing things properly protects you from lawsuits!

--
Matthew Jones
Previous PagePage 2 of 6Next Page
Jump to Page:  1 2 3 4 5 6
Image