版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Working with DatabasesThis chapter describes how to use SQL statements in embedded applications to control databases. There are three database statements that set up and open databases for access: SET DATABASE declares a
2、 database handle, associates the handle with an actual database file, and optionally assigns operational parameters for the database.SET NAMES optionally specifies the character set a client application uses for CHAR, VA
3、RCHAR, and text Blob data. The server uses this information to transliterate from a database’s default character set to the client’s character set on SELECT operations, and to transliterate from a client application’s ch
4、aracter set to the database character set on INSERT and UPDATE operations.g CONNECT opens a database, allocates system resources for it, and optionally assigns operational parameters for the database.All databases must b
5、e closed before a program ends. A database can be closed by using DISCONNECT, or by appending the RELEASE option to the final COMMIT or ROLLBACK in a program.Declaring a databaseBefore a database can be opened and used i
6、n a program, it must first be declared with SET DATABASE to:CHAPTER 3 WORKING WITH DATABASES. Establish a database handle. Associate the database handle with a database file stored on a local or remote node.A database ha
7、ndle is a unique, abbreviated alias for an actual database name. Database handles are used in subsequent CONNECT, COMMIT RELEASE, and ROLLBACK RELEASE statements to specify which databases they should affect. Except in d
8、ynamic SQL (DSQL) applications, database handles can also be used inside transaction blocks to qualify, or differentiate, table names when two or more open databases contain identically named tables.Each database handle
9、must be unique among all variables used in a program. Database handles cannot duplicate host-language reserved words, and cannot be InterBase reserved words.The following statement illustrates a simple database declarati
10、on:DSQL programs can access only a single database at a time, so database handle use is restricted to connecting to and disconnecting from a database.In multi-database programs, each database must be declared in a separa
11、te SET DATABASE statement. For example, the following code contains two SET DATABASE statements:. . .EXEC SQLSET DATABASE DB2 = ’employee2.gdb’;EXEC SQLSET DATABASE DB1 = ’employee.gdb’;. . .4Using handles for table name
12、sWhen the same table name occurs in more than one simultaneously accessed database, a database handle must be used to differentiate one table name from another. The database handle is used as a prefix to table names, and
13、 takes the form handle.table.For example, in the following code, the database handles, TEST and EMP, are used to distinguish between two tables, each named EMPLOYEE:. . .EXEC SQLDECLARE IDMATCH CURSOR FORSELECT TESTNO IN
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- sql數(shù)據(jù)庫(kù)修復(fù)
- sql 游標(biāo) 數(shù)據(jù)庫(kù)
- 數(shù)據(jù)庫(kù)(sql)論文
- 數(shù)據(jù)庫(kù)sql習(xí)題
- 外文翻譯---開(kāi)發(fā)基于sql server 的cs數(shù)據(jù)庫(kù)應(yīng)用系統(tǒng)
- wincc數(shù)據(jù)庫(kù)sql訪問(wèn)
- 外文翻譯----數(shù)據(jù)庫(kù)和數(shù)據(jù)庫(kù)系統(tǒng)
- sql入門(mén)高級(jí),sql教程,數(shù)據(jù)庫(kù)教程
- sql數(shù)據(jù)庫(kù)查詢優(yōu)化
- sql server數(shù)據(jù)庫(kù)教程-
- 數(shù)據(jù)庫(kù)設(shè)計(jì)外文翻譯
- 數(shù)據(jù)庫(kù)設(shè)計(jì)外文翻譯
- 數(shù)據(jù)庫(kù)管理-外文翻譯
- 外文翻譯---數(shù)據(jù)庫(kù)管理
- 數(shù)據(jù)庫(kù)編程外文翻譯
- 數(shù)據(jù)庫(kù)管理外文翻譯
- 數(shù)據(jù)庫(kù)外文翻譯---關(guān)系數(shù)據(jù)庫(kù)的結(jié)構(gòu)
- sql數(shù)據(jù)庫(kù)課程設(shè)計(jì)
- sql數(shù)據(jù)庫(kù)復(fù)習(xí)題
- sql server數(shù)據(jù)庫(kù)試卷題庫(kù)
評(píng)論
0/150
提交評(píng)論