示例#1
0
def UnionSelect(sql):
    sql = sql.lower()
    sql1 = sql.split('union select')[0]
    sql2 = sql.split('union select')[1]
    sql2 = 'select'+ sql2
    #print sql1,sql2
    res1 = Select(sql1, currentdb)
    res2 = Select(sql2, currentdb)
    # print res1
    # print res2
    # print PrettyTable
    sql = sql.lower()
    sqlItem = re.split(r'[, ]', sql)
    RemoveKong(sqlItem)
    colname = sqlItem[sqlItem.index('select')+1 : sqlItem.index('from')]
    # print colname
    # print sqlItem
    PrintTable = PrettyTable()
    PrintTable.field_names = colname
    for i in res1:
        PrintTable.add_row(i)
    for i in res2:
        if i not in res1:
            PrintTable.add_row(i)
    print 'Union Result:'
    print PrintTable
示例#2
0
 def classify_query(self):
     stat = (self.query).split("|")
     self.operation = stat[0]
     if (self.operation == "select"):
         print(stat)
         query1 = Select(stat, self.database)
         query1.make_select()
示例#3
0
def ViewCreate(currentdb, viewname, sql):
    wb = load_workbook('data/view.xlsx')
    try:
        sheet = wb[viewname]
    except:
        sheet = wb.create_sheet()
        sheet.title = viewname
    sql = sql.lower()
    sqlItem = re.split(r'[, ]', sql)
    RemoveKong(sqlItem)
    headers = sqlItem[sqlItem.index('select') + 1:sqlItem.index('from')]
    #print headers
    viewtableItem = Select(sql, currentdb)
    for i in xrange(1, len(headers) + 1):
        sheet.cell(1, i).value = headers[i - 1]
        #print sheet.cell(1, i).value

    for i in xrange(2, len(viewtableItem) + 1):
        for j in xrange(1, len(headers) + 1):
            sheet.cell(i, j).value = viewtableItem[i - 2][j - 1]
    wb.save('data/view.xlsx')
    print '%s View has been create.' % viewname
示例#4
0
     # Display configuration dialog.
     ThisDisplay.CurrentTab["CONFIGURE"] = Config.Config(
         ThisDisplay.ThisSurface, "CONFIGURE", "CONFIGURE")
 # If save config button is pressed.
 elif ButtonGadgit["BUTTON"] == "SAVE_CONFIG":
     ThisDisplay.CurrentTab.pop("CONFIGURE", None)
     ApplyConfig()
 elif ButtonGadgit["BUTTON"] == "SELECT_FONT":
     # Remember which gadgit the select is for.
     SelectGadgit = ButtonGadgit["GADGIT"]
     # Get a list of mono space font names.
     SelectText = ThisDisplay.CurrentTab[
         "CONFIGURE"].GetFontNameList()
     # Display a font name selection dialog.
     ThisDisplay.CurrentTab["SELECT"] = Select.Select(
         ThisDisplay.ThisSurface, "SELECT_FONT_NAME",
         SelectText)
 elif ButtonGadgit["BUTTON"] == "SELECT_VEHICLE":
     # Remember which gadgit the select is for.
     SelectGadgit = ButtonGadgit["GADGIT"]
     # Get a list of vehicle trouble code file names.
     SelectText = ThisDisplay.CurrentTab[
         "CONFIGURE"].GetVehicleNameList()
     # Display a font name selection dialog.
     ThisDisplay.CurrentTab["SELECT"] = Select.Select(
         ThisDisplay.ThisSurface, "SELECT_VEHICLE_NAME",
         SelectText)
 elif ButtonGadgit["BUTTON"] == "SELECT_SERIAL_PORT":
     # Remember which gadgit the select is for.
     SelectGadgit = ButtonGadgit["GADGIT"]
     # Get a list of vehicle trouble code file names.
示例#5
0
browser.get(('http://egovernance/Egovwebapp/home.aspx'))



username = browser.find_element_by_id('txtUserName')
username.send_keys(usernameStr)

password = browser.find_element_by_id('txtPassword')

password.send_keys(passwordStr)

signInButton = browser.find_element_by_id('ibtnLogin')
signInButton.click()
time.sleep(3)
body=browser.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't')
browser.get('http://egovernance/Egovwebapp/SIS/frmFacultyFeedback.aspx')
#if not(signInButton ==''):
    #browser2 = webdriver.Chrome()
    #browser.get(('http://egovernance/Egovwebapp/frmUserProfile.aspx'))
    #egov = browser.find_element_by_name("dlAppList$ctl00$ctl00")
    #egov.click()
    #driver.send_keys(Keys.CONTROL + 'T')
    #elem = browser.find_element_by_xpath("/html/body/div[2]/div[4]/div/a") #href link
    #time.sleep(2) 
    #elem.send_keys(Keys.CONTROL + Keys.RETURN + "2")
drp=Select(browser.find_element_by_class_name('FormDL'))
drp.select_by_value("5619")

    
    
# Create a new plot: plot
plot = figure()

# Add circles to the plot
plot.circle('x', 'y', source=source)

# Define a callback function: update_plot
def update_plot(attr, old, new):
    # If the new Selection is 'female_literacy', update 'y' to female_literacy
    if new == 'female_literacy': 
        source.data = {
            'x' : fertility,
            'y' : female_literacy
        }
    # Else, update 'y' to population
    else:
        source.data = {
            'x' : fertility,
            'y' : population
        }

# Create a dropdown Select widget: select    
select = Select(title="distribution", options=['female_literacy', 'population'], value='female_literacy')

# Attach the update_plot callback to the 'value' property of select
select.on_change('value', update_plot)

# Create layout and add to current document
layout = row(select, plot)
curdoc().add_root(layout)