zoukankan      html  css  js  c++  java
  • 利用回调函数响应事件

    <pre name="code" class="sql">use Tk;
    use strict;  
    use DBI; 
    # Main Window
    my $mw = new MainWindow;
    my $but1 = $mw -> Button(-text => "view cpu",-width=>80,
    -command =>&push_button);
    $but1 -> pack();
    
    my $but2 = $mw -> Button(-text => "view memory",-width=>80);
    
    $but2 -> pack();
    
    my $but3 = $mw -> Button(-text => "view disk",-width=>80);
    
    $but3 -> pack();
    
    my $but3 = $mw -> Button(-text => "view Event",-width=>80);
    
    $but3 -> pack();
    MainLoop;
    
    #This is executed when the button is pressed
    sub push_button {
     system("cls");
    my $dbName = 'june';  
    my $dbUser = 'test';  
    my $dbUserPass = 'test';  
    my $dbh = DBI->connect("dbi:Oracle:$dbName", $dbUser, $dbUserPass) or die "can't connect to database " 
    
    ;
    my $hostSql = qq{select table_name,tablespace_name,status from user_tables};  
     
    
    my ($table_name, $tablespace_name, $status);  
    my $selStmt = $dbh->prepare($hostSql);  
    $selStmt->bind_columns(undef, $table_name, $tablespace_name, $status);  
    $selStmt->execute();  
    while( $selStmt->fetch() ){  
      print "$table_name		   $tablespace_name		$status
    ";  
    }  
    $selStmt->finish;  
    $dbh->disconnect;  
    }
    


    
                                        
    
  • 相关阅读:
    Android中的5种数据存储方式
    Android Service
    Android BroadcastReceiver
    Android Intent
    Android Fragment
    Android 教学实验计划1
    【Android教学用例程序】计算器
    Android UI 基础知识
    Android 控件
    Android 计算器布局测试2
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351926.html
Copyright © 2011-2022 走看看