Difference between revisions of "Other handles (file, sql)"

From Team Developer SqlWindows Wiki
Jump to: navigation, search
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''This page covers handle datatype (Sql, file etc) tips & tricks.'''
+
{{PageHeader|Handle datatype (Window/SQL/File)}}
 +
 
  
 
__TOC__
 
__TOC__
<br>
+
 
  
 
<!------------------------------------------------------------------------------------------------------------------------------>
 
<!------------------------------------------------------------------------------------------------------------------------------>
 
{{TipHeader|What are the errorcodes returned by VisFile functions}}
 
{{TipHeader|What are the errorcodes returned by VisFile functions}}
The following list are VisFile return codes. They can be found in<br>
+
The following list are VisFile return codes:
[http://samples.tdcommunity.net/index.php?dir=SalExtension/&file=SALExtension-v204.zip SAL Extension V2.04] library.
+
 
  
 
<pre>
 
<pre>
Number: ERROR_FILE_NOT_FOUND = 2
+
Number: ERROR_FILE_NOT_FOUND = -2
Number: ERROR_PATH_NOT_FOUND = 3
+
Number: ERROR_PATH_NOT_FOUND = -3
Number: ERROR_TOO_MANY_OPEN_FILES = 4
+
Number: ERROR_TOO_MANY_OPEN_FILES = -4
Number: ERROR_ACCESS_DENIED = 5
+
Number: ERROR_ACCESS_DENIED = -5
Number: ERROR_INVALID_HANDLE = 6
+
Number: ERROR_INVALID_HANDLE = -6
Number: ERROR_NOT_ENOUGH_MEMORY = 8
+
Number: ERROR_NOT_ENOUGH_MEMORY = -8
Number: ERROR_BAD_FORMAT = 11
+
Number: ERROR_BAD_FORMAT = -11
Number: ERROR_OUTOFMEMORY = 14
+
Number: ERROR_OUTOFMEMORY = -14
Number: ERROR_INVALID_DRIVE = 15
+
Number: ERROR_INVALID_DRIVE = -15
Number: ERROR_CURRENT_DIRECTORY = 16
+
Number: ERROR_CURRENT_DIRECTORY = -16
Number: ERROR_NOT_SAME_DEVICE = 17
+
Number: ERROR_NOT_SAME_DEVICE = -17
Number: ERROR_NO_MORE_FILES = 18
+
Number: ERROR_NO_MORE_FILES = -18
Number: ERROR_WRITE_PROTECT = 19
+
Number: ERROR_WRITE_PROTECT = -19
Number: ERROR_NOT_READY = 21
+
Number: ERROR_NOT_READY = -21
Number: ERROR_BAD_COMMAND = 22
+
Number: ERROR_BAD_COMMAND = -22
Number: ERROR_OUT_OF_PAPER = 28
+
Number: ERROR_OUT_OF_PAPER = -28
Number: ERROR_WRITE_FAULT = 29
+
Number: ERROR_WRITE_FAULT = -29
Number: ERROR_READ_FAULT = 30
+
Number: ERROR_READ_FAULT = -30
Number: ERROR_SHARING_VIOLATION = 32
+
Number: ERROR_SHARING_VIOLATION = -32
Number: ERROR_LOCK_VIOLATION = 33
+
Number: ERROR_LOCK_VIOLATION = -33
Number: ERROR_WRONG_DISK = 34
+
Number: ERROR_WRONG_DISK               = -34
Number: ERROR_HANDLE_EOF = 38
+
Number: ERROR_HANDLE_EOF = -38
Number: ERROR_HANDLE_DISK_FULL = 39
+
Number: ERROR_HANDLE_DISK_FULL = -39
Number: ERROR_NOT_SUPPORTED = 50
+
Number: ERROR_NOT_SUPPORTED = -50
 
</pre>
 
</pre>
 +
 +
The list of constants can be found in the SalExtension archives<br>
 +
{{Download
 +
|URL=http://samples.tdcommunity.net/index.php?dir=SalExtension/
 +
|TEXT=SalExtension archives
 +
}}<br>
 +
 +
 +
<!------------------------------------------------------------------------------------------------------------------------------>
 +
{{TipHeader|How to check if a file is already opened}}
 +
Use this to check if a file is already opened.<br>
 +
 +
<pre>
 +
  If SalFileOpen( hFile, sFile, OF_Share_Exclusive )
 +
      ! File was not open, now it is and it is locked by this process
 +
      ! ... do file stuff ...
 +
      ! Dont forget to close the file
 +
      ! Call SalFileClose( hFile )
 +
  Else
 +
      ! File is opened by this or another process
 +
</pre>
 +
 +
 +
 +
[[Category:Datatypes]]

Latest revision as of 11:08, 29 October 2013

Handle datatype (Window/SQL/File)


Contents


Pointer2.png What are the errorcodes returned by VisFile functions Pointer.png

The following list are VisFile return codes:


Number: ERROR_FILE_NOT_FOUND 		= -2
Number: ERROR_PATH_NOT_FOUND 		= -3
Number: ERROR_TOO_MANY_OPEN_FILES 	= -4
Number: ERROR_ACCESS_DENIED 		= -5
Number: ERROR_INVALID_HANDLE 		= -6
Number: ERROR_NOT_ENOUGH_MEMORY 	= -8
Number: ERROR_BAD_FORMAT 		= -11
Number: ERROR_OUTOFMEMORY 		= -14
Number: ERROR_INVALID_DRIVE 		= -15
Number: ERROR_CURRENT_DIRECTORY 	= -16
Number: ERROR_NOT_SAME_DEVICE 		= -17
Number: ERROR_NO_MORE_FILES 		= -18
Number: ERROR_WRITE_PROTECT 		= -19
Number: ERROR_NOT_READY 		= -21
Number: ERROR_BAD_COMMAND 		= -22
Number: ERROR_OUT_OF_PAPER 		= -28
Number: ERROR_WRITE_FAULT 		= -29
Number: ERROR_READ_FAULT 		= -30
Number: ERROR_SHARING_VIOLATION 	= -32
Number: ERROR_LOCK_VIOLATION 		= -33
Number: ERROR_WRONG_DISK                = -34
Number: ERROR_HANDLE_EOF 		= -38
Number: ERROR_HANDLE_DISK_FULL 		= -39
Number: ERROR_NOT_SUPPORTED 		= -50

The list of constants can be found in the SalExtension archives
Down.png SalExtension archives


Pointer2.png How to check if a file is already opened Pointer.png

Use this to check if a file is already opened.

   If SalFileOpen( hFile, sFile, OF_Share_Exclusive ) 
      ! File was not open, now it is and it is locked by this process
      ! ... do file stuff ...
      ! Dont forget to close the file 
      ! Call SalFileClose( hFile )
   Else
      ! File is opened by this or another process