tailieunhanh - Hướng dẫn sử dụng MySQL part 11

Nếu bạn không quen với Python và bạn làm được rất nhiều lập trình Perl, bạn chắc chắn muốn có một cái nhìn vào nó. Python là một ngôn ngữ kịch bản hướng đối tượng, kết hợp những thế mạnh của các ngôn ngữ như Perl và Tcl với một cú pháp rõ ràng là vay chính nó để ứng dụng được dễ dàng để duy trì và mở rộng | DRAFT 8 24 01 11 Python If you are not familiar with Python and you do a lot of Perl programming you definitely want to take a look at it. Python is an object-oriented scripting language that combines the strengths of languages like Perl and Tcl with a clear syntax that lends itself to applications that are easy to maintain and extend. The O Reilly Associates Inc. book Learning Python 2nd Edition by Mark Lutz and David Asher provides an excellent introduction into Python programming. This chapter assumes a working understanding of the Python language. In order to follow the content of this chapter you will need to download and install the MySQLdb the MySQL version of DB-API. You can find the module at http andy python MySQLdb. Chapter 23 The Python DB-API in the reference section includes directions on how to install MySQLdb. DB-API Like Java and Perl Python has developed a unified API for database access DB-API. This database API was developed by a Python Special Interest Group SIG called the Database SIG. The Database SIG is a group of influential Python developers interested Python access to various databases. On the positive side DB-API is a very small simple API. On the negative side it isn t very good. Part of its problem is that it is very small and thus does not support a lot of the more complex features database programmers expect in a database API. It is also not very good because it realistically does not enable true database independence. The Database Connection The entry point into DB-API is really the only part of the API tied to a particular database engine. By convention all modules supporting DB-API are named after Copyright 2001 O Reilly Associates Inc. 192 DRAFT 8 24 01 the database they support with a db extension. The MySQL implementation is thus called MySQLdb. Similarly the Oracle implementation would be called ora-cledb and the Sybase implementation sybasedb. The module implementing DB-API should contain a connect method that .

TỪ KHÓA LIÊN QUAN