アットウィキロゴ

ぽ099

  1. package memo;
  2.  
  3.  
  4. public class pro {
  5.  
  6.  
  7. int sx,number;
  8. int[] month=new int[500];
  9. int[] year=new int[500];
  10. String[] v=new String[500];
  11.  
  12. double[] delta=new double[500];
  13.  
  14. double[] com=new double[500];
  15. double[] tax=new double[500];
  16. String[] im=new String[500];
  17. String[] ex=new String[500];
  18. double[] y=new double[500];
  19. String[] name=new String[500];
  20.  
  21. public static void main(String[] args) {
  22. pro t=new pro();
  23. }
  24. pro(){
  25.  
  26. String db,tab;
  27.  
  28.  
  29. db="power";
  30. tab="power";
  31. int co,s,cr,ind;
  32. int a1;
  33.  
  34. co=1;
  35. cr=1;
  36. ind=1;
  37.  
  38. select sub=new select();
  39. sub.makedata(db,tab,"b1","c1");
  40. number=sub.number;
  41. ex=sub.v;
  42. year=sub.year;
  43. month=sub.month;
  44.  
  45. System.out.println(number);
  46.  
  47. for(s=1;s<number+1;s++){
  48. System.out.println(year[s]+"年"+month[s]+"月,"+ex[s]);
  49. }
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. }
  57.  
  58.  
  59.  
  60.  
  61.  
  62. int numx(String str){
  63.  
  64. int nx;
  65.  
  66. nx=0;
  67.  
  68. try{
  69.  
  70. nx=Integer.parseInt(str);
  71.  
  72. }catch (Exception e) {}
  73.  
  74. return nx;
  75.  
  76.  
  77.  
  78. }
  79.  
  80.  
  81.  
  82.  
  83.  
  84. double num(String str){
  85.  
  86. double nx;
  87.  
  88. nx=0;
  89.  
  90. try{
  91.  
  92. nx=Double.parseDouble(str);
  93.  
  94. }catch (Exception e) {}
  95.  
  96. return nx;
  97.  
  98.  
  99.  
  100. }
  101.  
  102.  
  103.  
  104. }
  105.  
  106.  
  107.  
  108. package memo;
  109.  
  110. import java.sql.*;
  111.  
  112. class select{
  113.  
  114. Statement stx;
  115. String sqx;
  116. ResultSet rsx;
  117.  
  118. int key;
  119. String word;
  120. int sx,number;
  121. int[] year=new int[50000];
  122. String[] v=new String[50000];
  123.  
  124. int[] month=new int[50000];
  125.  
  126. void makedata(String db,String tab,String b1,String c1){
  127.  
  128. String url = "jdbc:h2:"+db+";create=true";
  129. String usr = "";
  130. String pwd = "";
  131.  
  132.  
  133. try
  134. {
  135. Class.forName("org.h2.Driver");
  136.  
  137. dbx = DriverManager.getConnection(url, usr, pwd);
  138. } catch (Exception ex) { ex.printStackTrace();}
  139.  
  140. sx=0;
  141. try {
  142. stx = dbx.createStatement();
  143. sqx="select * from "+tab+" where com="+change(c1)+" and bus = "+change(b1);
  144. rsx = stx.executeQuery(sqx);
  145. if (rsx != null) {
  146. while (rsx.next()) {
  147. sx=sx+1;
  148. v[sx]= rsx.getString("value");
  149. year[sx]=rsx.getInt("year");
  150. month[sx]=rsx.getInt("month");
  151. }
  152. }
  153.  
  154. number=sx;
  155.  
  156.  
  157. rsx.close();
  158. stx.close();
  159. dbx.close();
  160.  
  161. } catch (Exception ex) {ex.printStackTrace();}
  162.  
  163.  
  164.  
  165.  
  166. }
  167.  
  168. String change(String word){
  169. e="'"+word+"'";
  170. return e;
  171. }
  172.  
  173.  
  174.  
  175. }
  176.  
最終更新:2015年08月02日 00:48