質問編集履歴
4
該当のソースコード 更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -84,45 +84,47 @@
|
|
84
84
|
|
85
85
|
|
86
86
|
|
87
|
-
/*指定フォルダの中にあるファイル毎にループしています*/
|
87
|
+
/*指定フォルダの中にあるファイル毎にループしています*/
|
88
88
|
|
89
|
-
while( ($file = readdir($handle)) !== false ) {
|
89
|
+
while( ($file = readdir($handle)) !== false ) {
|
90
|
-
|
91
|
-
/*ファイルであればif内に入ります*/
|
92
|
-
|
93
|
-
if( filetype( $path = $dir . $file ) == "file" ) {
|
94
90
|
|
95
91
|
|
96
92
|
|
97
|
-
/
|
93
|
+
/*ファイルであればif内に入ります*/
|
98
94
|
|
99
|
-
|
95
|
+
if( filetype( $path = $dir . $file ) == "file" ) {
|
100
96
|
|
101
97
|
|
102
98
|
|
103
|
-
$
|
99
|
+
//ファイル名の取得 → $filenameに格納
|
104
100
|
|
105
|
-
|
101
|
+
//取得したファイルのoid化したもの → $oidに格納
|
106
102
|
|
107
103
|
|
108
104
|
|
109
|
-
|
105
|
+
$dbh->beginTransaction();
|
110
106
|
|
111
|
-
$dbh->commi
|
107
|
+
$dbh->exec("insert into test(name, pdfobj) values ('$filename', '$oid')");
|
112
108
|
|
113
|
-
}else{//失敗
|
114
109
|
|
115
|
-
$dbh->rollBack();
|
116
110
|
|
111
|
+
if($dbh){//成功
|
112
|
+
|
113
|
+
$dbh->commit();
|
114
|
+
|
115
|
+
}else{//失敗
|
116
|
+
|
117
|
+
$dbh->rollBack();
|
118
|
+
|
117
|
-
}
|
119
|
+
}
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
}
|
118
124
|
|
119
125
|
|
120
126
|
|
121
127
|
}
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
}
|
126
128
|
|
127
129
|
|
128
130
|
|
3
該当のソースコード 更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -74,6 +74,8 @@
|
|
74
74
|
|
75
75
|
//20170211 23:15 更新
|
76
76
|
|
77
|
+
```ここに言語を入力
|
78
|
+
|
77
79
|
/*事前に$dbhにてコネクトしております*/
|
78
80
|
|
79
81
|
$dir = "/tmp/";
|
@@ -126,6 +128,10 @@
|
|
126
128
|
|
127
129
|
}
|
128
130
|
|
131
|
+
```
|
132
|
+
|
133
|
+
|
134
|
+
|
129
135
|
|
130
136
|
|
131
137
|
###補足1
|
2
該当のソースコード 更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -70,6 +70,64 @@
|
|
70
70
|
|
71
71
|
|
72
72
|
|
73
|
+
|
74
|
+
|
75
|
+
//20170211 23:15 更新
|
76
|
+
|
77
|
+
/*事前に$dbhにてコネクトしております*/
|
78
|
+
|
79
|
+
$dir = "/tmp/";
|
80
|
+
|
81
|
+
if( is_dir( $dir ) && $handle = opendir( $dir ) ) {
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
/*指定フォルダの中にあるファイル毎にループしています*/
|
86
|
+
|
87
|
+
while( ($file = readdir($handle)) !== false ) {
|
88
|
+
|
89
|
+
/*ファイルであればif内に入ります*/
|
90
|
+
|
91
|
+
if( filetype( $path = $dir . $file ) == "file" ) {
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
//ファイル名の取得 → $filenameに格納
|
96
|
+
|
97
|
+
//取得したファイルのoid化したもの → $oidに格納
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
$dbh->beginTransaction();
|
102
|
+
|
103
|
+
$dbh->exec("insert into test(name, pdfobj) values ('$filename', '$oid')");
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
if($dbh){//成功
|
108
|
+
|
109
|
+
$dbh->commit();
|
110
|
+
|
111
|
+
}else{//失敗
|
112
|
+
|
113
|
+
$dbh->rollBack();
|
114
|
+
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
}
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
}
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
|
130
|
+
|
73
131
|
###補足1
|
74
132
|
|
75
133
|
drop table では完全にデータが削除されずゴミが裏で残っていたりするのでしょうか?
|
1
発生している問題・エラーメッセージの更新、補足1更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,9 +16,17 @@
|
|
16
16
|
|
17
17
|
2.取り込み終了
|
18
18
|
|
19
|
-
3.dropdb table名 コマンドよりテーブルを削除
|
20
19
|
|
20
|
+
|
21
|
+
//20170211 20:35 更新
|
22
|
+
|
23
|
+
3.drop table test --コマンドよりテーブルを削除
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
//20170211 20:35 更新
|
28
|
+
|
21
|
-
4.a
|
29
|
+
4.create table test --テーブルとカラム等を生成
|
22
30
|
|
23
31
|
|
24
32
|
|
@@ -74,6 +82,10 @@
|
|
74
82
|
|
75
83
|
|
76
84
|
|
85
|
+
//20170211 20:35 更新
|
86
|
+
|
87
|
+
oidはpg_lo系の関数で作成しDBに格納してあります。
|
88
|
+
|
77
89
|
|
78
90
|
|
79
91
|
###補足2
|