1
00:00:00,150 --> 00:00:06,030
Hire everyone in this story are you going to go ahead and we're going to create another method in order

2
00:00:06,030 --> 00:00:12,180
to return all the modular objects that you have inside a school like database.

3
00:00:12,210 --> 00:00:17,940
So excited state of his handler class I-30 and include the brace of this method modify emotional object

4
00:00:17,940 --> 00:00:22,590
here and before the ending really break out of this class database handler I'm going to create another

5
00:00:22,590 --> 00:00:24,050
method so just type in here public.

6
00:00:24,060 --> 00:00:31,400
Now we need to specify the return type of this method which is going to be released are released and

7
00:00:31,440 --> 00:00:37,560
then inside the angle brackets we need to specify the actually type of objects that are going to be

8
00:00:37,560 --> 00:00:40,670
inside this are a list which is going to be martial art.

9
00:00:40,770 --> 00:00:44,530
And then we need to specify the name of this method which is going to be returned.

10
00:00:44,550 --> 00:00:49,200
All martial art objects all martial art objects.

11
00:00:49,220 --> 00:00:52,460
And here we just need to put a pair of prentices.

12
00:00:52,460 --> 00:00:55,640
So let's open and closed this method by using these curly braces.

13
00:00:55,640 --> 00:00:58,830
So first of all we need to get them a skill like database.

14
00:00:58,830 --> 00:01:04,460
So just I think he had a skill like database database assignment operator gets right Hebel database

15
00:01:04,620 --> 00:01:08,530
semicolon and then we need to specify the SDL comment.

16
00:01:08,690 --> 00:01:15,680
So I can just say streams and just type in here as well query as well query come on because we want

17
00:01:15,680 --> 00:01:19,100
to get all the objects from our light database.

18
00:01:19,110 --> 00:01:25,400
We use query here and then we put an assignment operator here and I just put two codes here and I can

19
00:01:25,400 --> 00:01:28,660
say select start with or start here shift.

20
00:01:28,700 --> 00:01:33,770
And number 8 just hold down the shift key on your keyboard and then press on about 8 on your keyboard.

21
00:01:34,100 --> 00:01:40,300
And then I can say from space and I put up a A-plus operator here and I just need to refer to the motion

22
00:01:40,300 --> 00:01:43,120
or table martial arts table a semicolon.

23
00:01:43,370 --> 00:01:47,620
So it's going to actually select all the objects that are inside of the marshal or table.

24
00:01:47,780 --> 00:01:48,650
Right.

25
00:01:48,650 --> 00:01:51,230
So this is this will come at quite a comment here.

26
00:01:51,230 --> 00:01:57,590
Now I can say in order to process this as you l.com quite calm and meaning to have an object of type

27
00:01:57,590 --> 00:01:58,450
cursor.

28
00:01:58,610 --> 00:02:03,240
So just open your cursor and its name is going to be cursor assignment operator.

29
00:02:03,330 --> 00:02:06,680
It can refer to this database so database thought.

30
00:02:06,880 --> 00:02:12,510
Rob Querrey so it look at the Smurfette here raw query the return type of this method is actually the

31
00:02:12,620 --> 00:02:14,630
type cursor right.

32
00:02:14,720 --> 00:02:18,310
So this method is going to return a value of type cursor.

33
00:02:18,500 --> 00:02:22,020
So let's select this method here this one.

34
00:02:22,370 --> 00:02:25,120
And then press on until your keyboard blockwork.

35
00:02:25,220 --> 00:02:26,350
So look at this move it here.

36
00:02:26,360 --> 00:02:27,910
There are two versions of this method.

37
00:02:28,040 --> 00:02:29,450
Let me show you this mirror again.

38
00:02:29,450 --> 00:02:35,430
So there are two the two versions of this for the first version is going to accept only two arguments.

39
00:02:35,510 --> 00:02:40,070
The first argument is that as usual a query comment which we haven't yet in line number one hundred

40
00:02:40,070 --> 00:02:40,700
and eleven.

41
00:02:40,700 --> 00:02:47,860
The second actually the argument is the selection arcs which we are not going to use it in this application

42
00:02:47,870 --> 00:02:48,600
in this method.

43
00:02:48,620 --> 00:02:50,440
And look at the second version of this method.

44
00:02:50,540 --> 00:02:53,510
We have also another argument here.

45
00:02:53,510 --> 00:02:56,700
The first argument is it is cancellation signal.

46
00:02:56,870 --> 00:02:59,030
Again we are not going to use these arguments here.

47
00:02:59,030 --> 00:03:00,730
It's not necessary for the application.

48
00:03:00,890 --> 00:03:06,030
So if you are going to use the first version of this if it is just going to accept as a school query

49
00:03:06,060 --> 00:03:07,880
comment and the selection box.

50
00:03:08,000 --> 00:03:11,620
So just for the actual quoted comment just passed this value as well.

51
00:03:11,780 --> 00:03:12,230
Come on.

52
00:03:12,230 --> 00:03:13,630
Come on come on.

53
00:03:13,880 --> 00:03:20,330
And for the second argument just part of I'll pass the value not because we want to access all the objects

54
00:03:20,660 --> 00:03:23,840
inside our school database right.

55
00:03:23,840 --> 00:03:27,370
We do not want to actually pass or value for the selection arcs here.

56
00:03:27,380 --> 00:03:28,950
So if we pass the value null.

57
00:03:29,020 --> 00:03:29,360
OK.

58
00:03:29,390 --> 00:03:35,970
After this line of code I can say this that the return type of this method is actually really straight.

59
00:03:36,020 --> 00:03:39,060
So this movement must return a value of they are.

60
00:03:39,100 --> 00:03:44,630
So let's create that here let's create a variable of that at least it is and inside the angle brackets

61
00:03:44,690 --> 00:03:49,640
specify the type of the objects that are going to be inside these are at least martial arts and the

62
00:03:49,640 --> 00:03:51,810
name of this list is going to be martial arts.

63
00:03:51,890 --> 00:03:52,830
OK.

64
00:03:52,910 --> 00:03:57,100
And then put an assignment operator here new Aurelie semicolon.

65
00:03:57,290 --> 00:03:58,120
That's it.

66
00:03:58,130 --> 00:04:04,460
Now we have actually an array list that are going to accept objects of type martial arts.

67
00:04:04,460 --> 00:04:09,190
Now after this line of code let's create a loop actually avoid loops.

68
00:04:09,200 --> 00:04:16,430
So just step in here voyde let's I told you that this cursor object is needed in order to process this

69
00:04:16,430 --> 00:04:18,370
as well query comment.

70
00:04:18,440 --> 00:04:19,070
Right.

71
00:04:19,130 --> 00:04:27,590
So say cursor dot move to next move to next if this cursor which is actually responsible for processing

72
00:04:27,600 --> 00:04:29,160
this is Ul-Qadri comment.

73
00:04:29,280 --> 00:04:34,900
If it can go to the mall and to the next object inside the school like database.

74
00:04:34,900 --> 00:04:35,150
Right.

75
00:04:35,150 --> 00:04:39,560
Because we want to use this cursor in order to get those objects inside our database.

76
00:04:39,560 --> 00:04:43,910
If this occurs object can move to the next object inside our database.

77
00:04:44,000 --> 00:04:50,180
If there is actually another object inside our database then in that case we are going to go inside

78
00:04:50,180 --> 00:04:57,170
the loop here and we can say let's create a variable of type martial arts here martial art and the name

79
00:04:57,170 --> 00:05:05,540
of this variable is going to be current martial art object current martial art object assignment operator

80
00:05:05,630 --> 00:05:08,310
new martial art.

81
00:05:08,670 --> 00:05:09,190
OK.

82
00:05:09,350 --> 00:05:17,710
But because we created a custom constructor inside the martial art class we must actually pass values

83
00:05:17,710 --> 00:05:18,950
for that constructor.

84
00:05:19,000 --> 00:05:20,490
So look at these arguments here.

85
00:05:20,500 --> 00:05:25,680
First we need to pass the ID and then we need to pass the name the price the color.

86
00:05:25,690 --> 00:05:26,050
Right.

87
00:05:26,050 --> 00:05:33,880
So look at this actually price argument here it is an integer but we forgot to change the data type

88
00:05:33,880 --> 00:05:38,060
of this argument inside our martial art class so let's go to the martial art class.

89
00:05:38,230 --> 00:05:44,400
And here you can see that this constructor here accepts an argument of the type integer right.

90
00:05:44,410 --> 00:05:45,330
Its name is price.

91
00:05:45,370 --> 00:05:48,790
So if changed the data type of this price here to double.

92
00:05:48,790 --> 00:05:50,560
So let's change it here to double.

93
00:05:50,560 --> 00:05:56,910
Now let's go to the database handler class and here for this second let me actually write it again.

94
00:05:56,920 --> 00:06:02,980
Martial art now is going to say that we must pass a value of type I should be of type double for the

95
00:06:02,980 --> 00:06:03,570
price.

96
00:06:03,580 --> 00:06:04,990
Look at this value here.

97
00:06:05,170 --> 00:06:06,440
Double price right.

98
00:06:06,490 --> 00:06:15,130
Because we changed the data type of this argument inside our martial art class for that constructor.

99
00:06:15,160 --> 00:06:17,440
So first we need to pass the ID right.

100
00:06:17,620 --> 00:06:22,990
But again it's the job of the cursor to process that those values.

101
00:06:22,990 --> 00:06:26,830
So we need to say cursor is going to get a value of type.

102
00:06:27,220 --> 00:06:31,040
And then we must convert that value to a value of integer.

103
00:06:31,090 --> 00:06:35,920
So we need to say integer that parse and inside Apprentice's.

104
00:06:35,920 --> 00:06:43,090
I'm going to refer to this cursor object cursor that get strange and that we need to pass the column

105
00:06:43,090 --> 00:06:43,700
index.

106
00:06:43,810 --> 00:06:46,780
So the ID is in the column index number 0.

107
00:06:46,810 --> 00:06:48,540
So I'm going to pass the value 0 here.

108
00:06:48,610 --> 00:06:49,210
Right.

109
00:06:49,210 --> 00:06:49,720
That's it.

110
00:06:49,720 --> 00:06:55,720
So here let me actually create a new line here for these arguments that we're are going to pass.

111
00:06:55,720 --> 00:06:58,790
So the first argument is for the ID right.

112
00:06:58,910 --> 00:07:03,810
And now we need to specify the second argument which is going to be the name.

113
00:07:03,910 --> 00:07:05,850
And it is of extreme right.

114
00:07:05,890 --> 00:07:07,870
So just put a comma here.

115
00:07:07,930 --> 00:07:10,210
This is our first argument right now.

116
00:07:10,210 --> 00:07:15,880
I put a comma here and for the second argument again cursor that get screened.

117
00:07:15,880 --> 00:07:19,110
So the name is actually of type string right there.

118
00:07:19,200 --> 00:07:20,350
Martial arts name.

119
00:07:20,350 --> 00:07:25,530
So here I just need to pass the column index the column index is going to be Vaun right Dimanche that

120
00:07:25,540 --> 00:07:27,410
name is in the Clinton-Dix number one.

121
00:07:27,610 --> 00:07:30,210
Just with a comma here and then create a new line.

122
00:07:30,250 --> 00:07:32,970
So now we need to specify the emotional price.

123
00:07:32,990 --> 00:07:35,000
So again cursor.

124
00:07:35,130 --> 00:07:38,910
So notice that the modular price is of type double.

125
00:07:39,040 --> 00:07:39,520
OK.

126
00:07:39,670 --> 00:07:46,850
So cursive does get double on the column index is going to be column in this number to right comma.

127
00:07:47,230 --> 00:07:49,520
And finally we have to marshal that color.

128
00:07:49,630 --> 00:07:52,410
So again cursor does get strange.

129
00:07:53,370 --> 00:07:57,730
And so the apprentice's 8:22 column index which is going to be called this number three.

130
00:07:57,810 --> 00:08:04,650
So notice that first we have the ID here and then we have the name which is in the calumniate number

131
00:08:04,650 --> 00:08:04,980
one.

132
00:08:04,980 --> 00:08:10,340
We have the price column of this number two and we have the color which is in the color coloring columnist's

133
00:08:10,350 --> 00:08:11,440
number free.

134
00:08:11,550 --> 00:08:14,790
So now that we have this martial art object is cut into much of the object.

135
00:08:14,790 --> 00:08:19,200
Here we can add this object to our martial arts Aurelia's.

136
00:08:19,230 --> 00:08:25,570
So I can say martial arts which is stuff that I really start at current martial art object semicolon.

137
00:08:25,650 --> 00:08:26,140
That's it.

138
00:08:26,140 --> 00:08:30,710
So after this while loop here first we must close the database.

139
00:08:30,720 --> 00:08:32,210
So they tell me is that close.

140
00:08:32,250 --> 00:08:34,760
And finally we need to return this.

141
00:08:34,760 --> 00:08:39,230
Martial arts are elites so martial arts semicolon.

142
00:08:39,380 --> 00:08:46,160
So in this way the Smurfette return almost for objects is going to return all the martial art objects

143
00:08:46,160 --> 00:08:49,210
that are actually inside the database.

144
00:08:49,220 --> 00:08:50,320
So this is the job of this.

145
00:08:50,320 --> 00:08:52,120
Now we need to create another team effort.

146
00:08:52,130 --> 00:08:57,340
So after the end in Kerley process of the Smurfette return all objects I'm going to create another Merfeld

147
00:08:57,350 --> 00:08:57,670
here.

148
00:08:57,680 --> 00:08:59,810
So we're going to create that Meffert in the next tutorial.

149
00:08:59,810 --> 00:09:02,690
Thank you very much for watching and I'll see you in the next story.

