Application Programming Flashcards

1
Q

Embedded SQL

A

placing of SQL statements directly in a host program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Static SQL

A

embedded SQL in the case that the SQL statements in the program are static (they are the same each time the program is ran)

all statements begin with an introducer and end with a terminator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Static Embedded SQL program layout (in C)

A

introducer = “EXEC SQL”

“EXEC SQL INCLUDE SQLCA”

“Exec SQL begin declare section”

[declare stuff]

“Exec SQL end declare section”

[fetch inputs from user]

“Exec SQL” [query here]
(The variable defined above referred to as ‘:variable’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Dynamic Embedded SQL query

A

char* sqlprog = [query here]

“EXEC SQL prepare dynprog from :sqlprog”

char account[] = blah

“Exec SQL execute dynprog using :acount” (replace ? with account variable)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Cursors

A

data structures that allow for the handling of SQL queries that return multiple rows

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Cursor structure

A

“Exec SQL declare [cursor_name] Cursor for [query] ;”

“Exec SQL open [cursor name]”

“Exec SQL fetch into :variable1, :variable2 …;”

"while (sqlca.sqlcode != 100) {
      printf();
      EXEC SQL fetch into 
      :variable1, :variable2
}"

“Exec SQL close [cursor name]”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Components of Client Server architecture

A

database client - connects to DB to manipulate data

client software - provides general and specific capabilities

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Two Tier Client Server Model

A

data server and client

client tier communicates directly with data tier.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Pros and cons of Two Tier model

A

pro: flexible need not be restricted to predefined queries
cons: security, more code shipped to client, not good for large organizations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

3 tier client server model

A

user layer, middleware layer, database layer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

3 tier client server model for ODBC

A

application program, odbc driver manager, db server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

ODBC Starter code

A

“HENV ;” (environment variable)

“HDBC ;” database connection variable

“SQLAllocEnv(&env);” (allocate sql environment)

“SQLAllocConnect(env, &conn);” (allocate sql connection)

“SQLConnect(conn, server url, …)”

“SQLDisconnect(conn);”

“SQLFreeConnect(conn);”

“SQLFreeEnv(env);”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

JDBC Code

A

“Class.forName(driver)” (find, open, load appropriate driver)

“Connection conn = DriverManager.getConnection(url, user, pass);”

“Statement stat = conn.createStatement();”

“ResultSet rs = null;”

“rs = stat.executeQuery(sql_command);”

while(rs.next()) {
var = rs.getString();
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

entity set

A

a set of entities (think a table) that share the same properties

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

domain

A

set of permitted values for each attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

composite attributes

A

an attribute consisting of its own attributes

17
Q

relationship set

A

a mathematical relation among 2 or more entities

an instance of a relationship set is a set of relationships

can have attributes of its own

18
Q

relationship set degree

A

the number of entities that participate in a relationship set

19
Q

Cardinality

A

the number of entities to which another entity can be associated via a relationship set

20
Q

ER Roles

A

aka line from entitty to relationship diamond back to same entity

21
Q

ER Arrows

A

The arrow head represents the 1 side of the cardinality

= one to one
—- = many to man

22
Q

Schema

A

the logical structure of the db

physical schema- design at a physical level
logical schema- design at a logical level

23
Q

Instance

A

the actual content of the database at a particular point in time