package taffy;
import java.io.*;
public class pro {
String data=new String[100][10];
int s,sx,datanumber,creditnumber;
String credit=new String[10];
String db;
public static void main(String args) {
pro test=new pro();
}
pro(){
creditnumber=2;
datanumber=40;
db="db";
credit[1]="name";
credit[2]="slice";
for(s=1;s<datanumber+1;s++){
data[s][1]="角川";
data[s][2]="猫";
}
writefile("ren.txt");
}
void writefile(String file){
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<datanumber+1;s++){
pw.print(db);
pw.print(".insert({");
for(sx=1;sx<creditnumber;sx++){
pw.print(credit[sx]);
pw.print(":");
pw.print(change(data[s][sx]));
pw.print(",");
}
pw.print(credit[sx]);
pw.print(":");
pw.print(change(data[s][sx]));
pw.println(" });");
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
String change(String str){
String sre;
sre="\""+str+"\"";
return sre;
}
}