// The validAdmin property is used to protect the Administrative pages
client.validAdmin == "false"
if(project.sharedConnections == null) {
project.sharedConnections = new Object()
//Note: Videoapp will NOT work with INFORMIX. You can use the Oldvideo application
project.sharedConnections.pool = new DbPool("","", "", "", "", 2, false)
if ( project.sharedConnections.pool.connected() ) {
project.sharedConnections.connections = new Object()
project.cursors = new Object()
project.sharedConnections.cursors = new Object()
project.sharedCursors = new Object()
project.sharedCursors.cursors = new Object()
}
else {
delete project.sharedConnections
}
}
if (project.sharedConnections == null)
write("Error: Unable to connect to database.")
else {
var pool = project.sharedConnections.pool
if ( pool.connected() == true ) {
var userId = getUserId()
client.userId = scramble(userId)
var connection = pool.connection()
project.sharedConnections.connections[userId] = new ConnectionBucket(connection)
/* Below we find the highest customer ID and store it in a
property we created called "lastID". Later, we will use
this property to find the next available unique ID that
we can use to add a new customer to the database.
Notice how we lock the project object before we modify its
properties, so we can protect it from corruption that may
occur with simultaneous accesses.
*/
project.lock()
project.lastID = 0
cursor = connection.cursor("select * from customer order by ID")
while(cursor.next())
{
project.lastID = cursor.id
}
cursor.close()
project.unlock()
cursor.close()
// start a new transaction
connection.beginTransaction()
redirect("home.htm")
}
}