import base64
import MySQLdb
import MySQLdb.cursors
-import re
#class MySQLCursorDict(mysql.connector.cursor.MySQLCursor):
# build_project_id 값 확인
- #select_sr_detail = ( "SELECT id, sr_status_id, pre_build_project_id, post_build_project_id, obs_request_no, obs_request_comment, obs_request_date, obs_request_status "
- #"FROM sr_status_detail "
- #"WHERE sr_status_id = %s "
- #"ORDER BY id DESC" )
- select_sr_detail = ("SELECT bp.id "
- " FROM sr_status_detail ssd, build_project bp, info_project ip"
- " WHERE ssd.sr_status_id = %s "
- " AND ssd.trbs_build_project_id = bp.id"
- " AND bp.info_project_id = ip.id"
- " AND ip.project_name LIKE '%%:Mobile:ref:%%'"
- )
-
+ select_sr_detail = ( "SELECT id, sr_status_id, trbs_build_project_id, post_build_project_id, obs_request_no, obs_request_comment, obs_request_date, obs_request_status "
+ "FROM sr_status_detail "
+ "WHERE sr_status_id = %s "
+ "ORDER BY id DESC" )
print select_sr_detail
query.execute( select_sr_detail, [RESULT['sr_id']] )
if len( RESULT['raw']['sr_detail'] ) < 1:
sys.exit("ERROR: %s was not found in database(sr_status_detail)!" % ITEM['sr'])
- RESULT['build_project_id'] = RESULT['raw']['sr_detail'][0]['id']
+ RESULT['build_project_id'] = RESULT['raw']['sr_detail'][0]['trbs_build_project_id']
print "build_project_id is", RESULT['build_project_id']
select_snapshot = ( "SELECT build_snapshot.id, snapshot_name, snapshot_num, snapshot_url, start_time, end_time, build_snapshot.status, info_project_id "
"FROM build_snapshot "
"LEFT JOIN build_project ON build_project.id = build_snapshot.build_project_id "
- "WHERE build_project_id = %s ORDER BY build_snapshot.id DESC" )
+ "WHERE build_project_id = %s ORDER BY snapshot_num DESC" )
query.execute( select_snapshot, [RESULT['build_project_id']] )
query.execute( insert_tct, value )
dbcon.commit()
+ print "[Write: trbs_tct] id =", value['id']
except MySQLdb.IntegrityError:
print "[Error] Duplicate entry (" + key + ")-", value
try:
query.execute( insert_tct_suite, temp )
dbcon.commit()
+ print "[Write: trbs_tct_suite] id =", temp['id']
except MySQLdb.IntegrityError:
- print "[Error] Duplicate entry (" + key + ")-", value
+ print "[Error] Duplicate entry (" + key + ")-", temp
elif key == 'trbs_ref':
try:
query.execute( insert_ref, value )
dbcon.commit()
+ print "[Write: trbs_ref] id =", value['id']
except MySQLdb.IntegrityError:
print "[Error] Duplicate entry (" + key + ")-", value
try:
query.execute( insert_ref_suite, temp )
dbcon.commit()
+ print "[Write: trbs_ref_suite] id =", temp['id']
except MySQLdb.IntegrityError:
- print "[Error] Duplicate entry (" + key + ")-", value
+ print "[Error] Duplicate entry (" + key + ")-", temp
elif key == 'trbs_smoke':
query.execute( insert_smoke, value )
dbcon.commit()
+ print "[Write: trbs_smoke] id =", value['id']
except MySQLdb.IntegrityError:
print "[Error] Duplicate entry (" + key + ")-", value
try:
query.execute( insert_smoke_suite, temp )
dbcon.commit()
+ print "[Write: trbs_smoke_suite] id =", temp['id']
+ except MySQLdb.IntegrityError:
+ print "[Error] Duplicate entry (" + key + ")-", temp
+
+
+ elif key == 'trbs_smoke_suite_test':
+
+ insert_smoke_suite_test = ( "INSERT INTO trbs_smoke_suite_test (id, trbs_smoke_suite_id, name, result) "
+ "VALUES ( %(id)s, %(trbs_smoke_suite_id)s, %(name)s, %(result)s )" )
+
+ for temp in value:
+ try:
+
+ query.execute( insert_smoke_suite_test, temp )
+ dbcon.commit()
+ print "[Write: trbs_smoke_suite_test] id =", temp['id']
+
except MySQLdb.IntegrityError:
- print "[Error] Duplicate entry (" + key + ")-", value
+ print "[Error] Duplicate entry (" + key + ")-", temp
elif key == 'trbs_perf':
query.execute( insert_perf, value )
dbcon.commit()
+ print "[Write: trbs_perf] id =", value['id']
except MySQLdb.IntegrityError:
print "[Error] Duplicate entry (" + key + ")-", value
try:
query.execute( insert_perf_suite, temp )
dbcon.commit()
+ print "[Write: trbs_perf_suite] id =", temp['id']
except MySQLdb.IntegrityError:
- print "[Error] Duplicate entry (" + key + ")-", value
+ print "[Error] Duplicate entry (" + key + ")-", temp
elif key == 'trbs_perf_suite_test':
try:
query.execute( insert_perf_suite_test, temp )
dbcon.commit()
+ print "[Write: trbs_perf_suite_test] id =", temp['id']
except MySQLdb.IntegrityError:
- print "[Error] Duplicate entry (" + key + ")-", value
+ print "[Error] Duplicate entry (" + key + ")-", temp
else: