tailieunhanh - Java Data Access—JDBC, JNDI, and JAXP phần 3

Để phá vỡ mối quan hệ bạn có thể sử dụng từ khóa CASCADE hạn chế cùng với tuyên bố thả. Từ khóa này loại bỏ các ràng buộc toàn vẹn liên kết với bảng để bạn có thể loại bỏ nó. Vì vậy, để loại bỏ các bảng Location, bạn dùng lệnh sau đây: | Chapter 5 Building JDBC Statements JDBC SQL escape syntax Most database languages provide you with a programming language so you can interact with the database in ways you cannot achieve just using standard DML or DDL SQL statements. The languages also generally provide you with internal helper functions that you can use to format character and numeric data as well as mathematical functions that help you perform useful calculations. However all databases have unique syntaxes for their programming languages. For instance Oracle uses PL SQL and Microsoft SQL Server uses Transact-SQL. Because of the uniqueness of each database s programming language JDBC provides you with access to the functions and their special features using the JDBC SQL escape syntax. When you specify a command using the syntax the driver translates the command into the necessary database-specific format. The escape syntax gives you the flexibility to use database specific features unavailable to you by using standard JDBC methods and properties. However use escape clauses with caution. Overusing them can make your code database-dependent because you are using specific functions unique to your database. The general SQL escape syntax format is as follows keyword parameters Table 5-3 lists and describes the escape keywords. Table 5-3 SQL Escape Keywords Keyword d t ts Description Example Helps identify date time d yyyy-mm-dd and timestamp literals. As where yyyy year mm month dd date for example d you know no two DBMSs 2002-08-03 is March 8 2002 represent time and date the same way. This escape t hh mm ss syntax tells the driver to where hh hour mm minute ss second for example t render the date or time in 13 30 29 is 1 30 29 PM the target database s format. ts d . where d date format t time format f optional fractional second fn Represents scalar functions fn length Hello World returns 11 the length of the used in a DBMS. character string Hello World . escape Identifies the escape String sql .

TỪ KHÓA LIÊN QUAN