<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    jojo's blog--快樂憂傷都與你同在
    為夢想而來,為自由而生。 性情若水,風起水興,風息水止,故時而激蕩,時又清平……
    posts - 11,  comments - 30,  trackbacks - 0
    [mdrop@authbackup5 jojo]$ cat insert_sql_statement.sql

    #!/usr/bin/perl -w

    #
    # Created by: JoJo
    # Created Date: 28 July 2009
    # Desc: To create the sql statement for Sanriotown Digital
    #

    use DateTime;
    use DBI;


    #open log file for writing, append purpose
    open(MYLOGFILE, ">> mylog");


    ######### Step 1: Create DB Connection  ################################
    #definition of variables
    $db="UserDB";
    $host="localhost";
    $socket="/var/lib/auth5-1.us4/mysql1/mysql.sock";
    $user="root";
    $password="pwd";


    #connect to MySQL database
    my $dbh   = DBI->connect ("DBI:mysql::mysql_socket=$socket;database=$db:host=$host",$user,$password)
                             or die "Can't connect to database: $DBI::errstr"n";



    ######### Step 2: Get Active User ################################

    # Get date
    my $sdt = DateTime->now;
    # Get active user ( from userdb, usertype != 8)
    print MYLOGFILE "Get all active users from cobranddb.sanriotown_com_userdb tables at  $sdt."n";
    #!`echo 'select username from cobranddb.sanriotown_com_userdb where usertype  &8 <> 8 '|mysql -uroot -ppwd --socket=/var/lib/auth5-1.us4/mysql/mysql.sock --skip-column-names >  activeuser.txt` || die print "Cannot connect to cobranddb database."n";
    # Get date
    my $edt = DateTime->now;
    print MYLOGFILE "Finish grep all active users from cobranddb.sanriotown_com_userdb tables at  $edt."n";




    ######### Step 3: Get Active UserID and Field Value, then Create Insert Statement File#############

    # Open active user file for reading
    open (USERFILE, 'activeuser.txt');
    # Get date
    my $s1dt = DateTime->now;
    # Get active userid and its field value for "country" filedname whose cobrand is "sanriotown.com"
    print MYLOGFILE "Get active userid and its field value for 'country' filedname whose cobrand is 'sanriotown.com' from UserDB.UserProfileTbl and UserDB.UserTbl tables at  $s1dt."n";
    while (<USERFILE>) {
      chomp;
      #prepare the query
      my $sql = "select  u.userid, p.fieldvalue from UserDB.UserProfileTbl p, UserDB.UserTbl u where u.cobrand='sanriotown.com' and u.username='$_' and u.userid=p.userid and p.fieldname='country' ";
      my $sth = $dbh->prepare( $sql);
      #execute the query
      $sth->execute( );

      ## Retrieve the results of a row of data and print
      my ( $userid,$fieldvalue);
      $sth->bind_columns ( undef,"$userid,"$fieldvalue );
      while ( $sth->fetch( ) )  {      
          #print MYLOGFILE  "Userid is $userid and the fieldvalue is $fieldvalue"n";
          `echo "insert UserDB.UserProfileTbl values($userid,'orignal_country', '$fieldvalue');" >> insert_sql_statement.sql`;
      }

      $sth->finish( );
    }
    # Get date
    my $e1dt = DateTime->now;
    print MYLOGFILE "Finish grep active userid and its field value for 'country' filedname whose cobrand is 'sanriotown.com' from UserDB.UserProfileTbl and UserDB.UserTbl tables at  $e1dt."n";


    ######### Step 4: Close All File and DB Connection#############

    # Close all opened file
    close (USERFILE);
    close (MYLOGFILE);
    $dbh->disconnect( );
    exit;

    posted on 2009-07-29 10:13 Blog of JoJo 閱讀(273) 評論(0)  編輯  收藏 所屬分類: 每日一記My Script

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    常用鏈接

    留言簿(6)

    隨筆檔案

    文章分類

    文章檔案

    新聞分類

    新聞檔案

    相冊

    收藏夾

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲AV成人片色在线观看| 亚洲区日韩区无码区| 亚洲欧洲日产韩国在线| 久久w5ww成w人免费| 亚洲午夜免费视频| 亚欧免费视频一区二区三区| 亚洲国产天堂久久综合网站| 久久成人国产精品免费软件| 亚洲国产高清视频在线观看| aⅴ免费在线观看| 国产成人精品日本亚洲专| 成人免费午夜视频| 在线看亚洲十八禁网站| 亚洲另类少妇17p| 18禁超污无遮挡无码免费网站| 亚洲国产日韩在线视频| 无码人妻久久一区二区三区免费| 亚洲国产高清人在线| 999久久久免费精品国产| 亚洲熟妇无码八V在线播放| 国产一区二区三区在线免费| 亚州**色毛片免费观看| 国产V亚洲V天堂A无码| 亚洲精品视频免费看| 亚洲精品无码高潮喷水A片软| 免费观看国产小粉嫩喷水| 在线播放免费人成视频网站 | 黄色视屏在线免费播放| 久久久久亚洲?V成人无码| 成全视频在线观看免费| 亚洲六月丁香六月婷婷蜜芽| 暖暖在线日本免费中文| 一级做a爱过程免费视| 亚洲视频免费一区| 最好免费观看韩国+日本| 国产特黄特色的大片观看免费视频| 亚洲AV成人片色在线观看| 日韩特黄特色大片免费视频| 一级特黄录像免费播放肥| 2020天堂在线亚洲精品专区| 亚洲综合激情另类专区|