python查询sql_使用python查询SQL

我尝试使用python查询SQL,但它返回问号。在

这是我的密码。在import cx_Oracle

import importlib

class CustomDatabase(object):

ROBOT_LIBRARY_SCOPE = 'GLOBAL'

def __init__(self):

"""

Initializes _dbconnection to None.

"""

self._dbconnection = None

self.db_api_module_name = None

def GetDataFromDatabaseByRow(self, db_connect_string, selectStatement, row):

db_api_2 = importlib.import_module("cx_Oracle")

db_connect_string = 'db_api_2.connect(%s)' % db_connect_string

self.db_api_module_name = "cx_Oracle"

self._dbconnection = eval(db_connect_string)

row = int(row)

cur = None

try:

cur = self._dbconnection.cursor()

cur.execute(selectStatement)

res = cur.fetchone()

i = 0

while (i < row):

if cur.rowcount == row:

data = res

res = cur.fetchone()

i = i + 1

if i == row:

for x in data:

result=x

#return result.decode('iso-8859-11')

return result

finally :

if cur :

self._dbconnection.rollback()

Obj=CustomDatabase()

A=Obj.GetDataFromDatabaseByRow("'BELL', 'BELL#', '192.168.1.10:110/BELL'","select book_name from book where id='100'",1)

print A

这是实际结果。在

^{pr2}$

这是以DB为单位的值。在OOP แม่เจ้า

我希望期望值是OOP แม่เจ้า(泰语)。在

你能帮帮我吗?在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值