Hi everyone.
So here before the end in curly brace of this database handler class I'm going to create another method
such as typing here public access modifier.
This method is public.
Now you need to reach specify the return type of this method.
This is going to be martial art.
The name of this method is going to be returned martial art object martial arts object by ID.
OK.
Bypassing the ID of a specific martial art object to dismember it.
We can't get that specific martial art object that is related to that idea.
So just put part of practice.
And if you need to pass up an argument and you even need to specify a parameter of that integer for
this method which is going to be the ID and just open and close this method by using these curly braces.
So first of all we need to get the database so as a database database assignment operator get write
up a database semi-colon and that we need to specify DSU l.com acquire the comment.
So just I've in here.
Strange as well a query come and ask as usual query comment.
Assignment operator.
Just put two quotes here again just they've been here select thought from and then put our space here
and then put a contamination operator here.
Now we need to refer to our table Marshall's table.
Just put another concatenation operator here because we need to specify that.
Give me a modular object that is related to this ID.
So I'll put another concatenation operator here.
And I just put two coats Yelle space where space plus and I just need to say.
Actually I just need to refer to the key id key where Id key is space two quotes.
I just need to put a concatenation operator here so plus two codes space equal operator space.
And then here I just need to put a concatenation operator again Id semicolon.
So here what I'm saying is select from martial arts table that object a module object where the ID is
equal to the idea that the past to this method is argument.
So in this way it's going to give us a specific object that is related to this ID here.
So now after this line of code again we need to have an object of type cursor in order to process this
as well.
Querrey comment.
So just typing here cursor on the name is cursor assignment operator database that's rather quirky.
And here we need to pass these Escurial query command for the selection.
Just put a comma here and pass the value not semicolon.
So now that we have this cursor here to return type of this method is actually the martial art of martial
art.
You need to create a body but of a martial art here so that at the end of this if we can retain that
object from the Smurfette.
So let's create a value of type martial art.
And here the name is martial art object OK.
And then put an assignment operator here and initially passed a value to this body about because it
is actually a local variable.
It's important that the initial I said so we assigned the value not to this value but initially.
So after this line of code let's create an if statement if cursor
move to first move to first because we want to only get one specific martial art object that is related
to this ID.
This time we are going to use move to first because we only have one model that objects right.
We only need to check for this condition.
Move to first and an open and close this if statement by using these curly braces we can assign a real
object to this object.
But so I can say martial art object assignment operator new new martial art.
And here we are.
You are actually calling the constructor of this martial art class.
So first we need to pass the ID.
So again just they've been here integer that parse.
And inside the Franz's it's just sitting here cursor that gets strange the column index is going to
be actually 0 right comma.
Let's create a new line here.
And for the second argument here we need to actually get the name.
So I can just say cursor does get strange and we need to pass the column in which is number one comma.
And here we need to get to actually there.
Marshall Price.
So cursor that gets double the column and this is number two comma.
Let's create a new line here.
And finally we want to get a court martial art color which is of type string.
So cursor that gets strange and the column index is number three.
Right.
Finally just put a semicolon here.
And after this if statement here first we need to close the database so that it happens that close.
And we need to return the martial art object.
So martial art returned Marshall object semi-colon.
So that's it.
And this is our return martial art object method by ID.
So that's enough for this class.
They tell us of a class and that's enough for this tutorial too.
So if you have any questions about the concepts that I taught you so far please post a discussion in
the course and I do my best to answer all of your questions in the next story.
Are we going to go ahead and we're going to work with them actually with the other class and other activity
which is called the add activity at Marshall activity class.
So thank you very much for watching and I'll see you in the next tutorial.