Danh mục

Beginning SQL Server Modeling- P4

Số trang: 20      Loại file: pdf      Dung lượng: 1.36 MB      Lượt xem: 11      Lượt tải: 0    
Hoai.2512

Hỗ trợ phí lưu trữ khi tải xuống: 20,000 VND Tải xuống file đầy đủ (20 trang) 0
Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tham khảo tài liệu beginning sql server modeling- p4, công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Beginning SQL Server Modeling- P4 CHAPTER 3  DOMAIN-SPECIFIC LANGUAGES 101: LOLA’S LUNCH COUNTERand execute another dir command to be sure the compiler created the LunchCounter.mx image file (seeFigure 3-35).Figure 3-35. SQL compiling the LunchCounter.mg file to create the LuncCounter.mx image file Next, you want to use the DSL Grammar executor command-line tool to generate an M code versionof the SandwichLanguage.dsl file. (The executable was formerly called the Mgrammar executor, which iswhere it got its mgx.exe name.) With any executable command-line tool, you can normally enter thename of the command followed by /? to get a listing of the parameters that can be used to passinformation to the tool when it executes. Figure 3-36 shows a list of these parameters. The two you’reinterested in are reference and MModuleName. (Note that most, but not all, have shorthand aliases, like /r:for /reference:, to save you time when you’re using the tool frequently.) 61 Download from Wow! eBook CHAPTER 3  DOMAIN-SPECIFIC LANGUAGES 101: LOLA’S LUNCH COUNTER Figure 3-36. Displaying the MGX tool parameters At the command prompt, enter and execute the command as follows: Mgx.exe SandwichLanguage.dsl /reference:LunchCounter.mx /MModuleName: LunchCounter Figure 3-37 shows this, except that I’ve used aliases for setting the parameters to keep the command from wrapping in the command window. You can try it either way. If you do a dir directory listing, you can see that this command created the SandwichLanguage.m file.62 Download from Wow! eBook CHAPTER 3  DOMAIN-SPECIFIC LANGUAGES 101: LOLA’S LUNCH COUNTERFigure 3-37. Running the MGX MGrammar executor tool to generate the SandwichLanguage.m file Loading this file into Intellipad (see Figure 3-38), you can see that it is an M Graph almost exactlythe same as the one generated earlier when you made the final revisions to the DSL Grammar code priorto setting up for the deployment phase. The one difference is that the graph is now defined within theLunchCounter module. 63 Download from Wow! eBook CHAPTER 3  DOMAIN-SPECIFIC LANGUAGES 101: LOLA’S LUNCH COUNTER Figure 3-38. Displaying SandwichLanguage.m in Intellipad M Graph mode You should be ready for the last step of installing the schema and instances to the database. You can do this with the mx.exe executor tool. The MSchema file, LunchCounter.Schema.m, defines the four types and extents that the M Graph uses: SandwichOrders, Breads, Stuff, and Condiments. The MSchema file tells the SQL Server Modeling framework how to store the instances of the data represented in the M Graph in a data store. With your MSchema defined, you can use both the M Graph created by the MExecutor (mgx.exe) and the MSchema (LunchCounter.Schema.m, as shown in Figure 3-32) to compile your M files for use in a SQL Server data store by using the M compiler: m.exe SandwichLanguage.m LunchCounter.Schema.m /t:TSql10 The /t: target flag specifies that the output will be used for deploying the schema and instances. The result of executing this command is the image file SandwichLanguage.mx. (See the listing generated by the dir command in Figure 3-39.)64 Download from Wow! eBook CHAPTER 3  DOMAIN-SPECIFIC LANGUAGES 101: LOLA’S LUNCH COUNTERFigure 3-39. Generating the SandwichLanguage.mx image file You can also add a package flag (/p) to specify that instead of an image file, you want a SQL script:m.exe SandwichLanguage.m LunchCounter.Schema.m /t:TSql10 /p:Script This generates the SQL script file SandwichLanguage.sql (see Figure 3-40).Figure 3-40. Generating the SandwichLanguage.sql script file with the m.exe compiler You can run this script as a query in SQL Server Management Studio (SSMS) to load the database.Bring up SSMS, click on the File menu, then Open  File (see Figure 3-41). 65 Download from Wow! eBook CHAPTER 3  DOMAIN-SPECIFIC LANGUAGES 101: LOLA’S LUNCH COUNTER Figure 3-41. Opening the generated SQL script file in SQL Server Management Studio When the Open File dialog box appears, browse to the C:LunchCou ...

Tài liệu được xem nhiều: