Hello everyone.
So in this story we are going to add another method in order to allow the user to update the new light.
Ok to update our specific martial art object inside the school light.
So after the end in the place of this method is martial art object from databased my ID.
And before the end in curly brace of this class martial art actually a database handler before the ading
calibrator of this class.
I'm going to create another method so public voit updates all I can say modify its more meaningful modify
martial art object modified martial art object and put a pair of Prentice's here.
So if you want to specify the ID so int martial arts I-T come up and then add the second prime if it
is going to be off the upstreams martial arts name martial art name Karma.
So now you need to specify the first argument.
Right the first privater but there is a problem here let me show that problem to you here.
Inside is uncreate method where we created this as Q As your database here.
You can see that for the price key.
We said that the data type is going to be real.
Real means floats or decimal value.
And if I go to this a martial art class you can see that if actually created an instance variable for
this modular price here and the data type is integer.
So this is wrong.
OK it should be of type double right.
So if we actually change the data type of this small the price to double.
So let's actually also change this specific method.
For example they get here for this instance value but which the return type should be double OK and
we have also this setter for this Marshall Price.
You can see that the data type of this argument or privater is affect integer.
So let's change the state to double.
Right now the problem is solved.
Now if I go to this database handler class we can see that because we specified that at the price key
is of hyperreal which is actually double a decimal value here.
Now we can go into the Smurfette modify emotional objects and for the first parameter the data type
should be double.
Ok i should it must be double and then we must specify the name which is going to be a martial art twice
martial art.
Price.
So let me create a new line here so that you can see what's going on here exactly.
So now come on.
And here we need to specify define all Prime which is going to be of type string and the name is martial
arts.
Color martial art color.
So let's open and closed this method by using these curly braces.
So inside the body of the Smurfit I can't say so first of all we need to have a reference to the writer
database so I can't say it's q like database database assignment operator.
Get the right table database semicolon.
So notice that when I say Cathro table database I am calling this method on an instance of this database
handler class.
OK the start gate gets writable database in this way we can actually access this method because the
state of his handler class is and actually is a light open help look at this math class here.
Database handler is a school that open helper.
So that's why we can't call this gets right up and gets right over the top.
So let me delete this here at the start.
So now after this line of code I can't say.
So let's create of idea of type string here so strange and the name of a valuable is going to be update
or modify modify martial arts.
Martial art is to l.com an assignment operator.
So I just say to put two quotes here and then I can't see update update space or key update space plus.
And I just need to refer to these monsters table plus Let's create a new line here and then put two
quotes here.
Two double quotes actually and in space said space plus named je ne ke plus and then put two quotes
here and space equal operator.
And here after this equal operator we need to put a single code here k and then after these codes just
put a concatenation operator and refer to this martial arts name argument.
So I can say martial arts name and let's put another can and issue an operator here.
Let's create a new line here and again put two quotes here.
Come on space and then after these quotes another concatenation operator and this time refer to these.
Actually to this price key so I can just say price cheap plus to quote space equal operator space single
quotes after these quotes just put concatenation operator and then refer to this martial arts prize
here.
This argument martial arts prize.
So now let's actually put another concatenation operator here.
Let me tell you that we forgot to put the end in a code I didn't send a single code of these martial
arts in here.
So you can see that after this equal operator here we put this single quote here in order to put this
Montral our name inside the single quotes.
But this is the first single code.
And the final single code should be after this name right.
So here inside these codes before this come all of you need to put a single code here so that this martial
arts name here is going to be inside these single cards.
Right.
Because are using these concatenation operators in order to contaminate these values together.
So again and here we said price plus two cards equal.
And then here we put the single card here plus Marshall Price.
And again we put this plus here.
Let me create a new line here.
And I just need to put two quotes here again another single quote here come comma space.
And finally you need to put the colored key right.
So plus color key plus two coats space equal space single code.
And then after these codes just put a plus operator and this time refers to this marshal or a color
actually the martial art color.
Plus let's create a new line here.
And just put two coats here and put the final Actually the final single code here in order to put this
martial art color inside these single coats.
Right.
And here because we don't have any other cheese here we don't.
We must not put the comma here OK because it's finished.
And now I just say.
Just put our space here after this single code just put a space.
Don't put a comma here just put a space here and then put a plus year and put two coats here and just
type in here where space plus she Id actually the ID key id key actually a plus two quotes space equal
operator space plus and refer to the smashing of ID martial art ID semi-colon.
So this is the SU command if you want to actually update your school database database.
So in order to do that you need to have this come on here.
Right.
So firstly you say update space martial arts table.
So we want to update our martial arts table right plus.
And then we say space set space named ciii plus.
And then if we say equal operator and we assign marshal that name to the name key here and then we say
okay after this one we say price ske space equal operator space.
Marshall Price and then we specify the color key we said Marshal of color we assign the marshal of colors
to these kind of cheap.
And then we say where Id key is equal to marshal or ID right.
So if the user wants to update our specific martial art the user must pass these values to these methods.
MARSHALL The name Marshall Price and martial art color in this way that specific martial art object
is going to be updated in the database like this is this kulak comment and let me tell you that this
will come and here is very important.
Your comment must be actually the same as mine here.
Dont forget to put a comma here for example if you forget to put this comma here later when you want
to refer to the Smurfit if you forget to put the comma.
Your application is going to crash.
OK so I'll talk more about this later.
I will talk more about how we can actually debug your school applications.
But for now just know that there is light come on here.
This comment is very important.
And finally I just need to say database that as you well modify the martial art command modified martial
or you will comment.
And finally if you need to close the database database that close that's it.
So now I can't say if that's enough for this tutorial.
It's just really got to create another method inside the database handler class.
So.
Thank you very much for watching.
If you have any questions about the concepts that they told you so far please suppose the discussion
in the course and then I do my best to answer all of your questions.