質問編集履歴

12

修正位

2017/04/28 10:54

投稿

edoooooo
edoooooo

スコア476

test CHANGED
@@ -1 +1 @@
1
- Cursorの c.getString()をしたいのですが、where(mov)がfalseになります。
1
+ Cursorの c.getString()をしたいのですが、where(mov)がfalseになります。sql文が間違えているのでしょうか?
test CHANGED
@@ -6,7 +6,9 @@
6
6
 
7
7
  なぜ、データを取得できないのでしょうか?
8
8
 
9
+
10
+
9
- アドバイスをただけないでしょうか?
11
+ sql文が間違えてるのでしょうか?
10
12
 
11
13
 
12
14
 

11

誤字

2017/04/28 10:54

投稿

edoooooo
edoooooo

スコア476

test CHANGED
File without changes
test CHANGED
@@ -58,7 +58,7 @@
58
58
 
59
59
  ///////////改善したinsert文////////////////
60
60
 
61
- insert into nearsdb(data,username,comment,latitude,longitude) values ('4/ 28 1:4: 7','taich','にのやはさは',35.6539782,139.6471526);
61
+ insert into nearsdb(data,username,comment,latitude,longitude) values ('4/ 28 1:4: 7','ta','にのやはさは',35.6539782,139.6471526);
62
62
 
63
63
  ```
64
64
 

10

誤字

2017/04/28 04:22

投稿

edoooooo
edoooooo

スコア476

test CHANGED
File without changes
test CHANGED
@@ -58,7 +58,7 @@
58
58
 
59
59
  ///////////改善したinsert文////////////////
60
60
 
61
- insert into nearsdb(data,username,comment,latitude,longitude) values ('4/ 28 1:4: 7','taichi','にのやはさは',35.6539782,139.6471526);
61
+ insert into nearsdb(data,username,comment,latitude,longitude) values ('4/ 28 1:4: 7','taich','にのやはさは',35.6539782,139.6471526);
62
62
 
63
63
  ```
64
64
 

9

誤字

2017/04/28 04:21

投稿

edoooooo
edoooooo

スコア476

test CHANGED
File without changes
test CHANGED
@@ -53,6 +53,8 @@
53
53
  insert into near (data,username,comment,latitude,longitude)
54
54
 
55
55
  values ('4/ 28 10:33: 27','tai','やにやゆさはゆゆら',35.6539782,139.6471526)
56
+
57
+
56
58
 
57
59
  ///////////改善したinsert文////////////////
58
60
 

8

ついか

2017/04/28 04:20

投稿

edoooooo
edoooooo

スコア476

test CHANGED
File without changes
test CHANGED
@@ -7,6 +7,10 @@
7
7
  なぜ、データを取得できないのでしょうか?
8
8
 
9
9
  アドバイスをいただけないでしょうか?
10
+
11
+
12
+
13
+ 13:19 sqlの問題は、h2databaseで、sql文が正しいかを確認したことで、解消しました。
10
14
 
11
15
 
12
16
 
@@ -21,6 +25,12 @@
21
25
  "create table near (data text,username text,comment text,id integer primary key," +
22
26
 
23
27
  "latitude double,longitude double)";
28
+
29
+
30
+
31
+ ///////改善したcreatetable////////////
32
+
33
+ create table nearsdb (data text,username text,comment text,latitude double,longitude double);
24
34
 
25
35
 
26
36
 
@@ -44,7 +54,9 @@
44
54
 
45
55
  values ('4/ 28 10:33: 27','tai','やにやゆさはゆゆら',35.6539782,139.6471526)
46
56
 
57
+ ///////////改善したinsert文////////////////
47
58
 
59
+ insert into nearsdb(data,username,comment,latitude,longitude) values ('4/ 28 1:4: 7','taichi','にのやはさは',35.6539782,139.6471526);
48
60
 
49
61
  ```
50
62
 
@@ -100,4 +112,10 @@
100
112
 
101
113
 
102
114
 
115
+ ///////////////改善したselect文////////////
116
+
117
+ select data,username,comment from nearsdb where latitude - 35.6539782 <= 2.694944E-5 and 35.6539782 - latitude <= 2.694944E-5 and longitude - 139.6471526 <= 3.2899147E-4 and 139.6471526 - longitude <= 3.2899147E-4;
118
+
119
+
120
+
103
121
  ```

7

誤字

2017/04/28 04:19

投稿

edoooooo
edoooooo

スコア476

test CHANGED
File without changes
test CHANGED
@@ -58,7 +58,7 @@
58
58
 
59
59
  String sql= "select data,username,comment from near " +
60
60
 
61
- " latitude - "+latitude+" <= "+clearlatitude+" and "
61
+ "where latitude - "+latitude+" <= "+clearlatitude+" and "
62
62
 
63
63
  +latitude+" - latitude <= "+clearlatitude+
64
64
 

6

詳細

2017/04/28 03:53

投稿

edoooooo
edoooooo

スコア476

test CHANGED
File without changes
test CHANGED
@@ -9,6 +9,8 @@
9
9
  アドバイスをいただけないでしょうか?
10
10
 
11
11
 
12
+
13
+ //create tableをしてる、MyOpenHelperクラス
12
14
 
13
15
  ```java
14
16
 
@@ -24,15 +26,19 @@
24
26
 
25
27
  ```
26
28
 
29
+ //insertの文と、下は、logから取得したsql文です。LocationActivity
30
+
27
31
  ```java
28
32
 
29
- //insert
33
+ //insertの文
30
34
 
31
35
  String sql="insert into near (data,username,comment,latitude,longitude)" +
32
36
 
33
37
  " values ('"+data+"','"+username+"','"+comment+"',"+latitude+","+longitude+");";
34
38
 
35
39
 
40
+
41
+ //insertのsqlをlogで出力
36
42
 
37
43
  insert into near (data,username,comment,latitude,longitude)
38
44
 
@@ -44,11 +50,27 @@
44
50
 
45
51
 
46
52
 
47
-
53
+ //select文と、下は、logから取得したsqlです。LocationActivity
48
54
 
49
55
  ```java
50
56
 
51
- //select
57
+ //select
58
+
59
+ String sql= "select data,username,comment from near " +
60
+
61
+ " latitude - "+latitude+" <= "+clearlatitude+" and "
62
+
63
+ +latitude+" - latitude <= "+clearlatitude+
64
+
65
+ " and longitude - "+longitude+" <= "+clearlongitude+" and "
66
+
67
+ +longitude+" - longitude <= "+clearlongitude+";";
68
+
69
+
70
+
71
+
72
+
73
+ //selectのsqlをlogで出力
52
74
 
53
75
  String sql= "select data,username,comment from near " +
54
76
 

5

わけた

2017/04/28 02:51

投稿

edoooooo
edoooooo

スコア476

test CHANGED
File without changes
test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  ```java
14
14
 
15
- //createtable
15
+ //create table
16
16
 
17
17
  public static final String CREATE_TABLE =
18
18
 
@@ -22,7 +22,11 @@
22
22
 
23
23
 
24
24
 
25
+ ```
26
+
27
+ ```java
28
+
25
- //insert
29
+ //insert
26
30
 
27
31
  String sql="insert into near (data,username,comment,latitude,longitude)" +
28
32
 
@@ -36,11 +40,17 @@
36
40
 
37
41
 
38
42
 
43
+ ```
44
+
45
+
39
46
 
40
47
 
41
48
 
49
+ ```java
42
50
 
51
+ //select
52
+
43
- String sql= "select data,username,comment from near " +
53
+ String sql= "select data,username,comment from near " +
44
54
 
45
55
  "where latitude - 35.6539782 <= 2.694944E-5 " +
46
56
 
@@ -64,10 +74,6 @@
64
74
 
65
75
  textView.setText(String.format("%s %s : %s", c.getString(0), c.getString(1),c.getString(2)));
66
76
 
67
-
68
-
69
-
70
-
71
77
  }
72
78
 
73
79
 

4

ついか

2017/04/28 02:44

投稿

edoooooo
edoooooo

スコア476

test CHANGED
File without changes
test CHANGED
@@ -60,6 +60,8 @@
60
60
 
61
61
 
62
62
 
63
+ Log.v("whileにはいった",sql);
64
+
63
65
  textView.setText(String.format("%s %s : %s", c.getString(0), c.getString(1),c.getString(2)));
64
66
 
65
67
 

3

insertの追加

2017/04/28 02:40

投稿

edoooooo
edoooooo

スコア476

test CHANGED
File without changes
test CHANGED
@@ -23,6 +23,12 @@
23
23
 
24
24
 
25
25
  //insert
26
+
27
+ String sql="insert into near (data,username,comment,latitude,longitude)" +
28
+
29
+ " values ('"+data+"','"+username+"','"+comment+"',"+latitude+","+longitude+");";
30
+
31
+
26
32
 
27
33
  insert into near (data,username,comment,latitude,longitude)
28
34
 

2

誤字

2017/04/28 02:39

投稿

edoooooo
edoooooo

スコア476

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  この下のコードは、sqlをlogcatで出力したものになります。
6
6
 
7
- なぜ、取得されないのでしょうか?
7
+ なぜ、データを取得できないのでしょうか?
8
8
 
9
9
  アドバイスをいただけないでしょうか?
10
10
 

1

誤字

2017/04/28 02:22

投稿

edoooooo
edoooooo

スコア476

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  この下のコードは、sqlをlogcatで出力したものになります。
6
6
 
7
- データは取得できるはずなのですが、なぜ、出力されないのでしょうか?
7
+ 、なぜ、取得されないのでしょうか?
8
8
 
9
9
  アドバイスをいただけないでしょうか?
10
10