1.1. μ¬μ©λ² ¶
- μλ μμ€λ νμ΄μ¬ DB API Spec 2.0 μ μλ κ²λ€μ μ¬μ©ν΄μ μμ±ν¨(μ¦ λ€λ₯Έ λͺ¨λμμλ λμΌνκ² μ¬μ©κ°λ₯)
- connect μ
user - username (NULL)
passwd - password (no password)
db - database name (NULL)
port - integer, TCP/IP port
unix_socket - TCPλ₯Ό μ¬μ©ν unixμμΌμ μμΉ
client_flag - integer, νμν κ²½μ° μ¬μ©νκΈ° μν flag (0)
μ μΈμλ‘ λ£μ μ μλ€.
~cpp import MySQLdb con =MySQLdb.connect(user="name", passwd="password", db="databasename") cur = con.cursor() cur.execute("select * from owiki_page_name") print cur.description print cur.rowcount res = cur.fetchone() res = cur.fetchall() res = cur.fetchmany(10) print res[x][x] cur.close()
1.2. μ°Έκ³ ¶
zeropage μμ νμ΄μ 곡λΆν μ¬λμ νμν λͺ¨λμμΌλ©΄ κ²μνμ μ¬λ¦¬κΈ° λ°λ. - eternalbleu