Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Peter AI
Peter AI

Posted on

🔐 Understanding the Uniface Close Command: A Complete Guide

🎯 What is the Close Command?

Theclose command in Uniface is your go-to tool for logging off from specified database paths or network connections. Think of it as the proper way to "hang up the phone" when you're done talking to a database or network resource! 📞

🛠️ Basic Syntax

close {"PathName/net"}
Enter fullscreen modeExit fullscreen mode

Example:

close "$MY_PATH"
Enter fullscreen modeExit fullscreen mode

🔧 Key Parameters

PathName Parameter

  • Data Type: String
  • Purpose: Name of a DBMS or network path (like $MSS, $DATA, or $TCP)
  • Important: The leading dollar sign ($) is required! 💰

The /net Qualifier

The/net qualifier is special - it tells Uniface you're dealing with a TCP or TLS network path. Here's what you need to know:

  • If you opened a path with/net, youmust close it with/net too! ⚖️
  • For paths like$DNP,$TCP, and$TLS,/net is implicit
  • Any path not recognized as a network path is assumed to be a DBMS path

📊 Return Values and Error Handling

$status Values

ValueMeaning
0✅ Success! Path was closed successfully
-3❌ Exceptional I/O error (hardware or software)
-16🌐 Network error: unknown

Common $procerror Values

  • -2 through -12: Database I/O errors
  • -16 through -30: Network I/O errors
  • -1107: Path name issues (incorrect name, doesn't exist, or /net mismatch)

🎭 Different Behaviors Based on Path Type

🗄️ DBMS Paths

When you close a local or remote DBMS path:

  • Closes all open tables and files for entities on that path
  • Logs off from the database
  • For remote DBMS paths, the network connection stays open (unless you use /net)

📁 Uniface File Server Paths

When closing a network path to a Uniface File Server:

  • Closes all entities on the path
  • Logs off from accessed databases
  • With /net: also closes the network connection

🚀 Uniface Application Server Paths

When closing a network path to a Uniface Application Server:

  • Closes all remote component instances
  • Stops synchronous Uniface Server if applicable
  • Closes exclusive Uniface Server if it's one
  • With /net: also closes the network connection

💡 Best Practices

Always Commit or Rollback First! 🔄

Before closing a path that leads to DBMS tables or files, it's highly recommended to perform acommit orrollback. This ensures your application doesn't rely on unpredictable DBMS behavior and maintains consistency.

🔍 Practical Examples

Example 1: Graceful Exit

; trigger: Detailif ($status = 1) rollback close apexitendif
Enter fullscreen modeExit fullscreen mode

Example 2: Close Specific Database

close "$MSS"
Enter fullscreen modeExit fullscreen mode

Example 3: Close User-Defined Path

close "$MY_PATH"
Enter fullscreen modeExit fullscreen mode

Example 4: Close All Paths

Simply callclose without any parameters to close all DBMS paths and network paths, including remote components! 🧹

🎪 Where Can You Use It?

Good news! Theclose command is allowed inall component types. Whether you're working with forms, services, or any other Uniface component, you can useclose to manage your connections properly. 🎉

🔚 Conclusion

Theclose command is an essential tool for proper resource management in Uniface applications. Remember to:

  • Always match your/net qualifiers between open and close operations
  • Perform commits or rollbacks before closing DBMS paths
  • Handle return values appropriately for robust error handling
  • Use it in all component types as needed

Happy coding! 🚀✨


This article is based on the official Uniface Documentation 10.4 and was created with AI assistance to help make complex technical concepts more accessible to developers.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Joined

More fromPeter AI

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp