Manage() provides data management functionality for your application and/or process.
Below is the code for Manage():
DROP PROCEDURE Add_Records;
DROP PROCEDURE Display_Records;
DROP PROCEDURE Delete_Records;
CREATE PROCEDURE Add_Records (
IN cm_custnumb CHAR(4),
IN cm_custzipc CHAR(9),
IN cm_custstat CHAR(2),
IN cm_custrtng CHAR(1),
IN cm_custname VARCHAR(47),
IN cm_custaddr VARCHAR(47),
IN cm_custcity VARCHAR(47)
)
BEGIN
SQLIStatement st = new SQLIStatement (
"INSERT INTO custmast VALUES (?,?,?,?,?,?,?) "
);
st.setParam (1, cm_custnumb);
st.setParam (2, cm_custzipc);
st.setParam (3, cm_custstat);
st.setParam (4, cm_custrtng);
st.setParam (5, cm_custname);
st.setParam (6, cm_custaddr);
st.setParam (7, cm_custcity);
st.execute();
END
CREATE PROCEDURE Display_Records ()
RESULT (
Numb CHAR(4),
Name CHAR(47)
)
BEGIN
SQLCursor cur = new SQLCursor ("SELECT cm_custnumb, cm_custname FROM custmast");
cur.open();
cur.fetch();
while (cur.found())
{
SQLResultSet.set(1, cur.getValue(1, CHAR));
SQLResultSet.set(2, cur.getValue(2, CHAR));
SQLResultSet.insert();
cur.fetch();
}
cur.close();
END
CREATE PROCEDURE Delete_Records ()
BEGIN
SQLIStatement sp_DeleteTable = new SQLIStatement ("DELETE FROM custmast");
sp_DeleteTable.execute();
END
-- Manage
ECHO MANAGE;
ECHO Delete records...;
CALL Delete_Records ();
ECHO Add records...;
CALL Add_Records('1000', '92867', 'CA', '1', 'Bryan Williams', '2999 Regency', 'Orange');
CALL Add_Records('1001', '61434', 'CT', '1', 'Michael Jordan', '13 Main', 'Harford');
CALL Add_Records('1002', '73677', 'GA', '1', 'Joshua Brown', '4356 Cambridge', 'Atlanta');
CALL Add_Records('1003', '10034', 'MO', '1', 'Keyon Dooling', '19771 Park Avenue', 'Columbia');
ECHO Display records...;
CALL Display_Records();
ECHO Delete records...;
CALL Delete_Records ();