Databases Reference
In-Depth Information
break;
case 3:query_product();
break;
case 4:return 0;
default : printf(" Error: Option not recognized\n");
break;
}
printf ("\n");
}
}
void add_product(void){…}
void update_product(void){…}
void query_product(void){…}
Dynamic embedded SQL is used to update information about a product. The
user can choose to update the quantity or location of a particular product. The
application will prompt the user to specify which piece of information about a
product they wish to update. The complete SQL statement will not be known at
precompile time because the column of the table (either QUANTITY or
LOCATION) to be updated is not known. The column of the table to be updated
will only be known at runtime once the user supplies the data. Only at that time
can the SQL statement be built and submitted to the database for processing.
Static embedded SQL is used in adding a new product and querying for
information about a product, because the complete SQL statement will exist at
precompile time.
The system will provide a menu of basic inventory operations to the user, and
look like Example 4-5.
Example 4-5 Menu of inventory operations
-------------------------------------------------
SIMPLE INVENTORY MANAGEMENT SYSTEM
1. Add New Product
2. Update Product Info (Quantity or Location)
3. Query Product
4. Exit
Enter option:
Search WWH ::




Custom Search