Functions inside types
Posted: Wed May 21, 2014 5:50 pm
I am attempting to port an sqlite3 wrapper from Rapidq.
There are functions inside the type definition.
When I attempt to assign the return value to "Result" the compiler complains with "RESULT" not declared/unknown.
What is the proper way to return the results from a function inside a type definition or can i?
:-?
CODE:
Type SQLite3 As Panel
Databasepath As String
Commandtext As String
Handle As Long
StringSep As String
`onerror as event
SqLiteOK As Long
Function LibraryVersion() As String
Dim bchar As Byte, iCounter As Byte
Dim ptr_version As Long
Dim str_version As String
str_version=""
ptr_version = sqlite3_libversion()
icounter=0
Do
Memcopy(Varptr(bchar),ptr_version+icounter,1)
If bchar=0 Then Exit Do
str_version=str_version+Chr$(bchar)
Inc(icounter)
Loop
result = str_version
End Function
Function sq3_errorCode(errNumber As Long) As String
Dim errstr As String
Select Case errNumber
Case 1
errstr = "SQL syntax error or access to basic non-valid data: " + Chr$(13) + SQLite3.commandText
Case Else
errstr = "An error occured. SQL Error numver : "+Str$(errNumber)
End Select
`result = errstr
End Function
End Type
END CODE
There are functions inside the type definition.
When I attempt to assign the return value to "Result" the compiler complains with "RESULT" not declared/unknown.
What is the proper way to return the results from a function inside a type definition or can i?
:-?
CODE:
Type SQLite3 As Panel
Databasepath As String
Commandtext As String
Handle As Long
StringSep As String
`onerror as event
SqLiteOK As Long
Function LibraryVersion() As String
Dim bchar As Byte, iCounter As Byte
Dim ptr_version As Long
Dim str_version As String
str_version=""
ptr_version = sqlite3_libversion()
icounter=0
Do
Memcopy(Varptr(bchar),ptr_version+icounter,1)
If bchar=0 Then Exit Do
str_version=str_version+Chr$(bchar)
Inc(icounter)
Loop
result = str_version
End Function
Function sq3_errorCode(errNumber As Long) As String
Dim errstr As String
Select Case errNumber
Case 1
errstr = "SQL syntax error or access to basic non-valid data: " + Chr$(13) + SQLite3.commandText
Case Else
errstr = "An error occured. SQL Error numver : "+Str$(errNumber)
End Select
`result = errstr
End Function
End Type
END CODE