Couple question from newbie (To find where certain things can be accessed)

Hello,

Firstly I would like to find event (what not) where I can see and/or log the final SQL sent into the Database server. I tried find it but was not able to find it. It would help me to figure out how system works, when I do a change into the client or what ever…

Secondly I did not find information how I could make calls to the Schema (or DB) from the server side, so I don’t need to have separate DB-connection for some maintenance stuff or what ever. Or even something like if I would like to keep all the User credential information hidden in DB only, and while log in I would need to validate credentials against DB. and would like to use existing connection instead of “hand coding” some extra connection.

I had some other question but can’t remember them right now :slight_smile:

oh yes, one more, if there is some kind charts or images that will describe how all the components are wired together. Because when you build your system skeleton using wizard, it kind of hides how it is wired together, so it is little bit difficult to understand all the components are in the different places and what they are actually doing and in which stage…

Maybe RemObjects TV episode to implement same thing Wizard makes by hand and configure everything by hand. So it would make the whole process, and how the data flows and where is what… It is little bit difficult to reverse engineer how it actually works…

-Tee-

Is good idea you look at the demos. The server demo have code for log the sql calls and other things. Also check my questions, they have a lot of answers about basic things.

Two options for getting the SQL:

  1. Handle the OnGetSQL event of your Service’s Schema object. This will get you the SQL direct from the Statement of your datatable (including the {Where} macros)

  2. Drop a TDABusinessProcessor on the Service implementation, hook it up to the schema and the Datatable (via oddly named ReferencedDataset property) and handle it’s OnGenerateSQL event - this gives you the final SQL after the macros (e.g. {WHERE}) have been processed.

For accessing data on the server, you can use TDALocalDataAdapter component. Hook it up to the service schema, and you can hook this TDALocalDataAdapter up to a TDAMemDataTable and access it exactly as you would on the client.

You should also look at IDACommand and IDADataset for accessing data and running SQL on the server.

You should make the SimpleLoginService the ancester of your “Login” Service then you can handle the services’ own OnLogin and OnLogout events. For passing extended user information to the client, take a look at the UserInfo.Attributes and UserInfo.Privileges (very useful).

Hope this helps a little

Stuart

Hello,

tprami said: Firstly I would like to find event (what not) where I can see and/or log the final SQL sent into the Database server.

Examine DA Sample Server, it does logging of SQL commands and datasets from schema, business processor custom SQL.

tprami said: Secondly I did not find information how I could make calls to the Schema (or DB) from the server side

You could read data from the tables on the server in DataService like this :

var con:IDAConnection;
ds:IDADataset;

begin

con:=Schema.ConnectionManager.NewConnection(‘Your connection Name’);
ds:= con.NewDataset(‘SELECT …’); // or any other SQL statement
ds.Open;

end;

tprami said: if there is some kind charts or images that will describe how all the components are wired together. Because when you build your system skeleton using wizard, it kind of hides how it is wired together, so it is little bit difficult to understand all the components are in the different places and what they are actually doing and in which stage...

There is not such detailed information, but we’ll consider your suggestion.

Best regards

Thanks,

more than helpful

-Tee-