|
|
| Recent Tweets | |
<%
int uid=0;
st = con.createStatement();
sql = "select count(*) countye from tweets a, country b, city c, login d" +
" where a.Country=b.countryid and a.City=c.cityid and a.UId = d.user_id order by a.TweetId desc limit 0,3";
rs = st.executeQuery(sql);
while(rs.next())
{
//out.println(rs.getString("countye"));
}
st = con.createStatement();
sql="select a.TweetId, a.UID, a.Country , a.City, a.CountryArr, a.CityArr, a.SynCountry, a.SynCity, a.CIDate, a.departureTime, a.CODate," +
"a.arrivalTime, (a.Adults+a.Children+a.infants) total, a.Adults, a.Children, a.Infants,b.countryid, b.countryname, c.cityid, " +
"c.cityname, d.user_id, d.twitter_id, d.user_name, d.profile_image, d.oauth_token, d.oauth_secret, d.source " +
" from tweets a, country b, city c, login d " +
"where a.Country=b.countryid and a.City=c.cityid and a.UId = d.user_id "+
"order by a.TweetId desc limit 0,3";
//out.println("| "+sql+" | ");
rs = st.executeQuery(sql);
//out.println("tweet"+ rs.next());
String tweet = "", source = "", userName="", depDate="", arrDate="", total="", adults="",children="", infants="" ;
///..................PRINT the tweets...................///
while(rs.next()){
String countryArr_code="", cityArr_code="", co_name = "", ci_name = "",countryArr_name = "", cityArr_name = "", syn_co_name ="", syn_ci_name = "", arrTime="", depTime="",airclass="";
co_name = rs.getString("countryname");
ci_name = rs.getString("cityname");
uid=rs.getInt("UId");
userName = rs.getString("user_name");
countryArr_code = rs.getString("CountryArr");
cityArr_code = rs.getString("CityArr");
depDate = rs.getString("CIDate");
arrDate = rs.getString("CODate");
total = rs.getString("total");
adults = rs.getString("Adults");
children = rs.getString("Children");
infants = rs.getString("infants");
arrTime = rs.getString("arrivalTime");
depTime = rs.getString("departureTime");
//...........................Fetch Arrival country details...........................//
st = con.createStatement();
sql = "select countryname from country where countryid='"+countryArr_code+"'";
rs1 = st.executeQuery(sql);
if(rs1.next()){
countryArr_name = rs1.getString("countryname");
countryArr_name = countryArr_name.replaceAll(" ","");
}
st = con.createStatement();
sql = "select cityname from city where cityid='"+cityArr_code+"'";
rs1 = st.executeQuery(sql);
if(rs1.next()){
cityArr_name = rs1.getString("cityname");
cityArr_name = cityArr_name.replaceAll(" ","");
}
//........End arrival countr details................................................//
if(!co_name.equals(""))
co_name = co_name.replaceAll(" ","");
if(!ci_name.equals(""))
ci_name = ci_name.replaceAll(" ","");
/*st1 = con.createStatement();
sql = "select Synonym from synonym where SynId='"+rs.getInt("SynCountry")+"'";
rs1 = st1.executeQuery(sql);
if(rs1.next()){
syn_co_name = rs1.getString("Synonym");
syn_co_name = syn_co_name.replaceAll(" ","");
}
st1 = con.createStatement();
sql = "select Synonym from synonym where SynId='"+rs.getInt("SynCity")+"'";
rs1 = st1.executeQuery(sql);
if(rs1.next()){
syn_ci_name = rs1.getString("Synonym");
syn_ci_name = syn_ci_name.replaceAll(" ","");
}
if(!syn_co_name.equals("")){
co_name = syn_co_name+" (#"+co_name+")";
}
if(!syn_ci_name.equals("")){
ci_name = syn_ci_name+" (#"+ci_name+")";
}
*/
st1 = con.createStatement();
sql = "select source from login where user_id='"+uid+"'";
rs1 = st1.executeQuery(sql);
if(rs1.next()){
source = rs1.getString("source");
}
if(source.equals("mobile")){
source = "images/mobile.png";
} else {
source = "images/laptop.png";
}
tweet = "(via @"+ userName +") I want a #flight from #" + ci_name+", #"+co_name+" to #" + cityArr_name+", #"+countryArr_name + ". on: " + depDate;
if(depTime.equals("AnyTime"))
{
tweet= tweet + "("+ depTime +")";
}
else
{
tweet= tweet + "("+ depTime +"hrs)";
}
if(arrDate=="" || arrDate==null || arrDate.equals(""))
{
}
else
{
tweet=tweet+" and a return flight on "+ arrDate;
if(arrTime.equals("AnyTime"))
{
tweet=tweet+ "(" +arrTime +")";
}
else
{
tweet=tweet+"(between "+ arrTime +"hrs)";
}
}
tweet=tweet+". Total passangers: "+total+" (Adults-"+adults+", Children-"+children+", Infants-"+infants+")";
//" from "+rs.getString("CIDate")+" to "+rs.getString("CODate")+". Rooms required: "+rs.getInt("Rooms")+", " +
// "Total people: "+(rs.getInt("Adults")+rs.getInt("Children"))+" (Adults-"+rs.getInt("Adults")+", Children-"+rs.getInt("Children")+").";
out.println(" ");
}///..................Finish printing the tweets...................///
%>
|