Advertisement
mrkarp

Untitled

Apr 14th, 2014
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. package Main;
  2.  
  3. import java.io.IOException;
  4. import java.util.Arrays;
  5. import java.util.List;
  6.  
  7. public class RunChunk {
  8.  
  9.    
  10.     /*
  11.      * Download the CSV once
  12.      * Parse through to fill a List
  13.      * Iterate through list saving variables each time
  14.      * Run SQL query with saved variables each iteration
  15.      */
  16.    
  17.     static String symbol;
  18.     static String askPrice;
  19.     static  String bidPrice;
  20.     static String realPrice;
  21.     static String volume;
  22.     static String dividendYield;
  23.    
  24.     public static void main(String [] args) throws IOException {
  25.         String[] sqlString;
  26.         String splitBy = ",";
  27.        
  28.         GetFile.GetFileMakeFolder();
  29.         ParseAndIterate.IterateCSV();
  30.        
  31.         SQLQuery query = new SQLQuery();
  32.        
  33.         List<String> sl = ParseAndIterate.stockInfo;
  34.         while( ! sl.isEmpty() ) {
  35.                        
  36.             String element = sl.get(0);
  37.             sl= sl.subList(1,sl.size());  
  38.             System.out.println("Stock Info: " + element);
  39.             sqlString = element.split(splitBy);
  40.             String sql = Arrays.toString(sqlString);
  41.            
  42.             symbol = sqlString[0];
  43.             askPrice = sqlString[1];
  44.             bidPrice = sqlString[2];
  45.             realPrice = sqlString[3];
  46.             volume = sqlString[4];
  47.             dividendYield = sqlString[5];
  48.            
  49.             System.out.println("Split String: " + sql);
  50.             System.out.println("Stock: " + symbol + askPrice + bidPrice + realPrice + volume + dividendYield);
  51.             System.out.println("");
  52.            
  53.             query.SendQuery();
  54.  
  55.  
  56.         }
  57.        
  58.     }
  59.    
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement