| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import sys | 5 import sys |
| 6 | 6 |
| 7 try: | 7 try: |
| 8 sys.path.append('/usr/lib/python2.7/dist-packages/') | 8 sys.path.append('/usr/lib/python2.7/dist-packages/') |
| 9 import MySQLdb | 9 import MySQLdb |
| 10 except ImportError: # pragma: no cover | 10 except ImportError: # pragma: no cover |
| 11 pass | 11 pass |
| 12 finally: | 12 finally: |
| 13 sys.path.remove('/usr/lib/python2.7/dist-packages/') | 13 sys.path.remove('/usr/lib/python2.7/dist-packages/') |
| 14 | 14 |
| 15 DB_INSTANCE_IP = '173.194.225.193' | 15 DB_INSTANCE_IP = '173.194.225.193' |
| 16 DEFAULT_DATABASE = 'ANTIBODY_DB' | 16 DEFAULT_DATABASE = 'ANTIBODY_2' |
| 17 USERNAME = 'antibody-team' | 17 USERNAME = 'antibody-team' |
| 18 | 18 |
| 19 | 19 |
| 20 def connect(password): # pragma: no cover | 20 def connect(password): # pragma: no cover |
| 21 """Connect to Cloud SQL instance google.com:antibody-978:antibody-sql""" | 21 """Connect to Cloud SQL instance google.com:antibody-978:antibody-sql""" |
| 22 connection = MySQLdb.connect(host=DB_INSTANCE_IP, | 22 connection = MySQLdb.connect(host=DB_INSTANCE_IP, |
| 23 user=USERNAME, passwd=password, | 23 user=USERNAME, passwd=password, |
| 24 db=DEFAULT_DATABASE) | 24 db=DEFAULT_DATABASE) |
| 25 cc = connection.cursor() | 25 cc = connection.cursor() |
| 26 return connection, cc | 26 return connection, cc |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 | 94 |
| 95 def commit(conn): # pragma: no cover | 95 def commit(conn): # pragma: no cover |
| 96 conn.commit() | 96 conn.commit() |
| 97 | 97 |
| 98 | 98 |
| 99 def close(conn, cursor): # pragma: no cover | 99 def close(conn, cursor): # pragma: no cover |
| 100 cursor.close() | 100 cursor.close() |
| 101 conn.commit() | 101 conn.commit() |
| 102 conn.close() | 102 conn.close() |
| OLD | NEW |