1
00:00:00,210 --> 00:00:06,210
So as you can see here these are the lines of code that I actually pasted here and now I'm going to

2
00:00:06,210 --> 00:00:08,570
explain to you what's going on here.

3
00:00:08,700 --> 00:00:14,760
So as you can see here in line one hundred and five I created a comment and it says getting all the

4
00:00:14,760 --> 00:00:16,050
computer objects.

5
00:00:16,170 --> 00:00:20,090
So I want to actually get all the computer objects from the database.

6
00:00:20,280 --> 00:00:21,780
So I created an effort here.

7
00:00:21,780 --> 00:00:27,770
So the access modifier of this and if it is public and the return type of dismay if it is actually a

8
00:00:27,800 --> 00:00:28,490
list.

9
00:00:28,660 --> 00:00:30,890
OK a list is actually and arii.

10
00:00:31,050 --> 00:00:31,520
OK.

11
00:00:31,620 --> 00:00:32,820
Of computer objects.

12
00:00:32,820 --> 00:00:38,550
So in the angle brackets you can see that I put this computer class here and this means that you want

13
00:00:38,550 --> 00:00:44,760
to return a list of computer objects and array of computer objects from this method.

14
00:00:44,780 --> 00:00:45,150
OK.

15
00:00:45,210 --> 00:00:47,030
This is actually an interface.

16
00:00:47,040 --> 00:00:48,600
So let's open the Android.

17
00:00:48,720 --> 00:00:50,400
Let's open the documentation here.

18
00:00:50,400 --> 00:00:53,260
I just need to search for the least.

19
00:00:53,660 --> 00:01:00,710
Inside job the that you package we have this list here and now let's see what is this list here.

20
00:01:00,720 --> 00:01:07,050
So let's actually read some of the descriptions and it says an ordered collection also known as a sequence

21
00:01:07,350 --> 00:01:14,230
the user of this interface has precise control over where in the list each element is inserted.

22
00:01:14,280 --> 00:01:20,070
The user can access elements by that integer index position in the list and search for elements in the

23
00:01:20,070 --> 00:01:20,550
list.

24
00:01:20,550 --> 00:01:23,680
This is actually an older collection of data.

25
00:01:23,790 --> 00:01:25,360
Ok this is like aere.

26
00:01:25,440 --> 00:01:26,100
OK.

27
00:01:26,400 --> 00:01:32,060
And here as you can see that this is the name of this list computer release as you can see here inside

28
00:01:32,070 --> 00:01:34,160
this map at least computer right.

29
00:01:34,230 --> 00:01:35,310
And as you can see here it is.

30
00:01:35,340 --> 00:01:40,260
If it does not accept any arguments this is the name of them if it get on the computers and inside them

31
00:01:40,260 --> 00:01:47,670
if it created an object of type please list of computers so list and inserted in say the angle brackets

32
00:01:47,990 --> 00:01:52,380
I put this computer and this is the name of my list computer list.

33
00:01:52,380 --> 00:01:58,290
So because the return type of this method is a list here which actually retains computer objects.

34
00:01:58,290 --> 00:02:03,000
I created this object here and this is the name of my object computer list and then I initialize this

35
00:02:03,030 --> 00:02:04,940
object new alle list.

36
00:02:05,040 --> 00:02:10,810
So I initialize these computerless object by actually using the class at a list.

37
00:02:11,060 --> 00:02:12,020
OK.

38
00:02:12,360 --> 00:02:14,880
So here in line one hundred and ten.

39
00:02:15,060 --> 00:02:18,610
I created this strange object 3.

40
00:02:18,660 --> 00:02:20,250
Select all query.

41
00:02:20,370 --> 00:02:26,730
OK so you want to select all the objects from the database and I want to return those objects from this

42
00:02:26,730 --> 00:02:27,520
method.

43
00:02:27,570 --> 00:02:29,970
So I did because I actually put this comment.

44
00:02:29,970 --> 00:02:38,760
Select space and then I put this start here this symbol from so select from space as you can see here

45
00:02:38,790 --> 00:02:39,770
plus.

46
00:02:40,380 --> 00:02:43,850
And I actually read through the name of the table table a computer.

47
00:02:43,860 --> 00:02:48,900
This is really important to me to refer to the name of our table table computer so it can actually select

48
00:02:48,960 --> 00:02:52,110
all the data on the table computer and in line.

49
00:02:52,110 --> 00:02:55,040
Here it is 11 more hundred than 11.

50
00:02:55,070 --> 00:02:56,190
It's like database.

51
00:02:56,190 --> 00:03:02,580
So I created an object of type A school like database and the name of this object is database assignment

52
00:03:02,610 --> 00:03:05,400
operator does that get right up at the top.

53
00:03:05,400 --> 00:03:08,660
So I want to actually write some data through the database right.

54
00:03:08,970 --> 00:03:14,420
But here as you can see this it is going to return computer objects.

55
00:03:14,700 --> 00:03:15,240
OK.

56
00:03:15,240 --> 00:03:17,470
We want to read data from the database.

57
00:03:17,490 --> 00:03:19,600
This is going to return the rightabout database.

58
00:03:19,620 --> 00:03:19,990
OK.

59
00:03:20,040 --> 00:03:26,940
It's not necessary to use this method when we can actually use the get readable database instead because

60
00:03:27,040 --> 00:03:33,260
we want we just want to read the data from the database and we can actually return that data.

61
00:03:33,510 --> 00:03:35,480
So instead of write it write up a database.

62
00:03:35,490 --> 00:03:37,620
I can get that through that database.

63
00:03:37,720 --> 00:03:41,240
And here in line one hundred and twelve as you can see here.

64
00:03:41,640 --> 00:03:48,000
I created this cursor here this cursor interface assignment operator database.

65
00:03:48,030 --> 00:03:52,010
So I referred to the name of this database object that raw query.

66
00:03:52,030 --> 00:03:57,900
So I want to I took the query data from the database right database that Brockwell is select or query.

67
00:03:57,960 --> 00:04:01,120
So I refer to the name of this variable that actually holds this data.

68
00:04:01,280 --> 00:04:01,830
OK.

69
00:04:02,070 --> 00:04:07,680
Select all query for the first argument and for the second argument I assign the value not so that naturally

70
00:04:07,680 --> 00:04:13,280
call this method here in order to show you the second argument database that a real query.

71
00:04:13,560 --> 00:04:19,050
So as you can see here for the second argument as you can see here we could actually specify overclass

72
00:04:19,710 --> 00:04:23,790
in order to specify that how you want to actually get the data from the database.

73
00:04:23,970 --> 00:04:29,890
But in this case I just want to get all the objects from the database so I don't need to provide a where

74
00:04:29,910 --> 00:04:34,900
class or selection or X in or for this for the Smurfit for the second argument.

75
00:04:34,920 --> 00:04:40,230
So for the second argument I put a value on and here as you can see I created an if statement.

76
00:04:40,530 --> 00:04:47,150
So if cursor that move to first inside this if statement I created this to while here to do.

77
00:04:47,400 --> 00:04:52,620
And inside the curly braces here as you can see I created an object of type computer.

78
00:04:52,890 --> 00:04:56,750
So computer computer assignment operator new computer.

79
00:04:56,760 --> 00:05:02,280
So I created an object of type computer and as you can see here this constructed I didn't actually provide

80
00:05:02,290 --> 00:05:03,240
the values.

81
00:05:03,370 --> 00:05:07,610
So inside this computer class you can see that we have also an empty constructor.

82
00:05:07,750 --> 00:05:08,260
OK.

83
00:05:08,380 --> 00:05:14,550
So I can create an object for this computer class without providing arguments for this constructor.

84
00:05:14,590 --> 00:05:18,920
As you can see I am actually referring to the name of this object that set I-T.

85
00:05:19,000 --> 00:05:24,840
So I call this set id on this object integer that parse it.

86
00:05:24,850 --> 00:05:30,100
So I referred to the name of this integer class that parsed it this if it is going to actually accept

87
00:05:30,130 --> 00:05:35,500
an argument of type string and it's gonna convert that value to a integer value.

88
00:05:35,500 --> 00:05:37,440
OK so integer does parse.

89
00:05:37,480 --> 00:05:42,240
And here inside the apprentice's I need to provide a string value cursor that gets Thring zero.

90
00:05:42,400 --> 00:05:45,770
So cursive that gets string 0 means the id the column Id.

91
00:05:45,900 --> 00:05:46,150
OK.

92
00:05:46,150 --> 00:05:51,160
And it's going to actually convert that string value to the integer value and you can actually provide

93
00:05:51,160 --> 00:05:52,640
that value for this set id.

94
00:05:52,690 --> 00:05:57,930
If it is related to this computed object and here in line one hundred and twenty one as you can see

95
00:05:57,940 --> 00:06:03,850
computer that said computer name cursor that gets three in part number 1 so this number one refers to

96
00:06:03,850 --> 00:06:05,510
the column computer name.

97
00:06:05,560 --> 00:06:10,920
And we can actually get the computer name by using this method cursor that gets drunk.

98
00:06:11,440 --> 00:06:17,020
And here as you can see computer that set computer type cursor that gets three too.

99
00:06:17,020 --> 00:06:20,440
So this tool refers to computer type Cullom computer type.

100
00:06:20,440 --> 00:06:27,490
And we can actually get this computer type and at the end I want to add this object this computer object

101
00:06:27,490 --> 00:06:28,770
to the computer list.

102
00:06:28,870 --> 00:06:30,830
So computer list as you can see here.

103
00:06:31,090 --> 00:06:33,860
I created this object in line 108.

104
00:06:34,140 --> 00:06:39,370
And inside this will do while loop here as you can see all you want to add this object to this computer

105
00:06:39,460 --> 00:06:44,610
is so computer released that ad computer and at the end as you can see here you have this wide condition

106
00:06:44,630 --> 00:06:46,870
so wide cursor that move to next.

107
00:06:46,870 --> 00:06:53,860
So this means that if the cursor does not is not empty and we have data inside the database and we can

108
00:06:53,860 --> 00:06:58,170
actually move to the next update in the database then it's going to execute this new while loop again

109
00:06:58,690 --> 00:07:04,590
until it reaches the end of the objects into the database and we don't have any objects inside the database.

110
00:07:04,630 --> 00:07:07,990
So it's not going to execute this of do I do it any more.

111
00:07:08,110 --> 00:07:10,280
If the if the database is empty.

112
00:07:10,330 --> 00:07:11,100
OK.

113
00:07:11,560 --> 00:07:18,310
And at the end as you can see here at the end of this statement now you want to actually return the

114
00:07:18,310 --> 00:07:20,230
computer released from the Smurfit.

115
00:07:20,410 --> 00:07:26,120
Remember that if it needs to return a list of computer objects an army of computer objects.

116
00:07:26,230 --> 00:07:29,690
So I just returned this computer list so hopefully that makes sense.

117
00:07:29,770 --> 00:07:34,600
And now I'm going to paste in some other Mfat here and then I'm going explain to you what's going on

118
00:07:34,600 --> 00:07:35,020
here.

119
00:07:35,020 --> 00:07:39,590
So as you can see here these are the lines of code that I actually paste that here.

120
00:07:39,760 --> 00:07:44,100
And as you can see I created a comment here and it says updating a single computer.

121
00:07:44,260 --> 00:07:50,020
So I want to actually update a single computer object inside the database and if over for example I

122
00:07:50,020 --> 00:07:56,600
can actually change the computer name or the computer type ok but using this update method.

123
00:07:56,890 --> 00:08:00,580
So public so the access modifier of the Smurfit is public.

124
00:08:00,700 --> 00:08:06,860
The return type of the Smurfit is integer end and the name of this method is update the computer.

125
00:08:07,060 --> 00:08:11,530
And this if it actually accepts an argument of the computer object as you can see here.

126
00:08:11,700 --> 00:08:13,310
OK Computer here.

127
00:08:13,540 --> 00:08:16,850
So insert the curly braces off this Nefert Let's see what's going on here.

128
00:08:17,050 --> 00:08:22,360
First of all I actually created an object of think it's like database and the name of this object is

129
00:08:22,360 --> 00:08:23,410
database.

130
00:08:23,410 --> 00:08:27,510
I put an assignment operator here this that gets writable database.

131
00:08:27,520 --> 00:08:35,590
So at this time because I want to actually change some data inside my database I need to actually get

132
00:08:35,590 --> 00:08:36,710
the right level database.

133
00:08:36,730 --> 00:08:39,210
I can't get the readable it up.

134
00:08:39,250 --> 00:08:44,250
I need to get the write up a little way because I want to update computer objects inside the database

135
00:08:44,260 --> 00:08:45,170
right.

136
00:08:45,470 --> 00:08:48,600
And inline 110 of 46 as you can see.

137
00:08:48,790 --> 00:08:55,510
I created an object of type content values and the name of this object is values assignment operator

138
00:08:55,720 --> 00:08:57,430
new content values.

139
00:08:57,430 --> 00:09:01,510
So I created this object which is actually of type content values and inline what.

140
00:09:01,520 --> 00:09:08,210
One hundred and forty seven as you can see I referred to the name of this object values that put.

141
00:09:08,260 --> 00:09:14,290
So I want to put some data inside these values object values that put color computer name.

142
00:09:14,380 --> 00:09:19,110
So I want to actually get the computer name that is inside of the column computer name.

143
00:09:19,330 --> 00:09:24,910
So this is actually the column for the first argument and for the second argument I just need to return

144
00:09:24,910 --> 00:09:30,940
to this computed object that we receive as an argument from the Smurfit computer that gets computer

145
00:09:30,940 --> 00:09:31,450
name.

146
00:09:31,780 --> 00:09:32,800
As you can see here.

147
00:09:33,130 --> 00:09:33,760
OK.

148
00:09:33,980 --> 00:09:36,740
And here in line one hundred and forty eight.

149
00:09:36,940 --> 00:09:42,850
I actually again referred to the name of this object of values that pute and for the first argument

150
00:09:43,060 --> 00:09:47,490
I provided this column column computer type as you can see here.

151
00:09:47,590 --> 00:09:52,180
So you want to get the computer type and for the second argument I just need to refer to the name of

152
00:09:52,180 --> 00:09:54,840
this object computer that gets computer type.

153
00:09:54,940 --> 00:09:59,440
So you to get the type of the computer here and here.

154
00:09:59,570 --> 00:10:05,920
Inline 100 than 50 as you can see I want to return a value to return a value of type integer.

155
00:10:05,920 --> 00:10:12,910
So I just need to put that literal keyword here database that update as you can see here because I want

156
00:10:12,910 --> 00:10:16,720
to update the database I need to actually call this method database.

157
00:10:16,720 --> 00:10:20,160
I actually get to the name of this database object that update.

158
00:10:20,170 --> 00:10:25,630
So for the first argument I need to actually provide this value table computer I need to provide the

159
00:10:25,900 --> 00:10:32,080
table of the database table computer and for the second Madie for the second argument I need to provide

160
00:10:32,080 --> 00:10:35,950
these values object which is actually of type content values.

161
00:10:36,370 --> 00:10:42,730
And for the sake and for the first argument I need to provide the where clause here where column Id

162
00:10:43,090 --> 00:10:49,400
as you can see here plus operator and inside the double quotes as you can see here these are equal operator.

163
00:10:49,420 --> 00:10:55,690
And this question mark and this means avare column Id is equal to and here as you can see for the fourth

164
00:10:55,750 --> 00:11:00,890
argument I am actually providing an argument for this very close here for this class here.

165
00:11:00,910 --> 00:11:07,120
OK the argument as you can see here for this class must be of type strange Ari so new string at a and

166
00:11:07,120 --> 00:11:13,660
in say the curly braces as you can see I am providing disvalue streambed that the value of computer.

167
00:11:13,690 --> 00:11:17,400
So here you refer to the name of this Optik computer that get ID.

168
00:11:17,710 --> 00:11:24,540
OK so I want to actually update this specific computer object that is related to this specific ID.

169
00:11:24,790 --> 00:11:25,360
OK.

170
00:11:25,600 --> 00:11:31,680
So by putting this up ID here this column Id Plus does equal operator question mark.

171
00:11:31,840 --> 00:11:38,560
And this idea here computer that get ID this means that we want to update the specific computer that

172
00:11:38,560 --> 00:11:40,850
is related to this specific column Id.

173
00:11:41,050 --> 00:11:42,160
As you can see here.

174
00:11:42,480 --> 00:11:43,130
OK.

175
00:11:43,630 --> 00:11:50,560
So in this way we are assured that we are actually updating their right computer object.

176
00:11:50,680 --> 00:11:56,300
OK so this is very important that you pro-white an ID for your objects inside the database.

177
00:11:56,380 --> 00:12:02,950
And here we are using that ID in order to actually specify that which one of the computer objects we

178
00:12:02,950 --> 00:12:04,580
want to actually to update.

179
00:12:04,640 --> 00:12:10,770
I want to update the computer object that is related to that specific ID computer that gets ID.

180
00:12:10,930 --> 00:12:11,560
OK.

181
00:12:12,130 --> 00:12:13,450
So hopefully that makes sense.

182
00:12:13,510 --> 00:12:17,980
And if you have any questions please post the discussion in the course and then I do my best to answer

183
00:12:18,010 --> 00:12:19,370
all of your questions.

184
00:12:19,660 --> 00:12:24,790
And now I want to actually pasting and another fit and then I'm going to explain to you what's going

185
00:12:24,790 --> 00:12:25,400
on here.

