Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'SQLiteningU.Inc
- ' ====================================================================
- ' | |
- ' | SQLitening Universal Include |
- ' | |
- ' ====================================================================
- ' This include file is intended to be used by non PowerBASIC
- ' programs that use the SQLiteningU.Dll This include file will
- ' need to be modified to support specific language syntax.
- ' Comments include here with some of the Declares are only present
- ' for parameter passing explanation. See SQLitening.Txt or
- ' SQLitening.Chm for information on each command.
- '
- ' ====================================================================
- ' PUBLIC DOMAIN SOFTWARE
- ' The author or authors of this code dedicate any and all
- ' copyright interest in this code to the public domain.
- ' Anyone is free to copy, modify, publish, use, compile,
- ' sell, or distribute the original code, either in source
- ' code form or as a compiled binary, for any purpose,
- ' commercial or non-commercial, and by any means.
- ' Fred Meier - November 2009
- '
- ' ====================================================================
- '============================<[ Equates ]>=============================
- ' ==========>>> SQLitening return codes
- %SQLitening_NoOpenDatabase = -7
- %SQLitening_AccessDenied = -8
- %SQLitening_FileDoesNotExist = -9
- %SQLitening_FileOpenGetPutError = -10
- %SQLitening_LockTimeout = -11
- %SQLitening_NochangedRows = -12
- %SQLitening_InvalidColumnNameNumber = -13
- %SQLitening_InvalidSetNumber = -14
- %SQLitening_AttachIsInvalid = -15
- %SQLitening_CanNotConnect = -16
- %SQLitening_InvalidKeyOrNotFound = -17
- %SQLitening_SendOrReceiveError = -18
- %SQLitening_InvalidStringOrRequest = -19
- %SQLitening_ErrorAtServer = -20
- ' ==========>>> SQLite return codes
- %SQLite_OK = 0 'Successful result
- %SQLite_Busy = 5 'Database is locked
- %SQLite_Dups = 19 'Constraint violation. Normally caused by
- 'trying to add a non unique key to an index
- 'during an Insert or Update.
- '=============================<[ Attach ]>=============================
- Declare Function sluAttach lib "SQLiteningU.Dll" alias "sluAttach" ( _
- byval FileName as Long, _
- byval AsDatabaseName as Long, _
- byval ModChars as Long) as Long
- ' FileName is a pointer to a null-terminated string.
- ' AsDatabaseName is a pointer to a null-terminated string.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '==========================<[ BuildBindDat ]>==========================
- Declare Sub sluBuildBindDat lib "SQLiteningU.Dll" alias "sluBuildBindDat" ( _
- byval Data as Long, _
- byval LengthOfData as Long, _
- byval BindDat as Long, _
- byref SizeOfBindDat as Long, _
- byval ModChars as Long)
- ' Data is a pointer to the memory containing the data to be bound.
- ' LengthOfData contains the length of the data.
- ' BindDat is a pointer to the returning binary data.
- ' SizeOfBindDat is both passed and returned. Pass the size of BindDat.
- ' It must be at least the size of the returning binary data.
- ' The actual length of the returing binary data is returned.
- ' If the passed size is too small then the returning length will
- ' be set to -1.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '======================<[ BuildInsertOrUpdate ]>=======================
- Declare Sub sluBuildInsertOrUpdate lib "SQLiteningU.Dll" alias "sluBuildInsertOrUpdate" ( _
- byval Table as Long, _
- byval Values as Long, _
- byval LengthOfValues as Long, _
- byval Columns as Long, _
- byval Where as Long, _
- byval SqlStatment as Long, _
- byref SizeOfSqlStatement as Long)
- ' Table is a pointer to a null-terminated string.
- ' Values is a pointer to the memory containing the null delimited values.
- ' LengthOfValues contains the length of the null delimited values.
- ' Columns is a pointer to a null-terminated string.
- ' If not needed you may pass a zero.
- ' Where is a pointer to a null-terminated string.
- ' If not needed you may pass a zero.
- ' SqlStatement is a pointer to the memory which will receive the built statement.
- ' A Null (hex '00') will be added to end.
- ' SizeOfSqlStatement is both passed and returned. Pass the size of SqlStatement.
- ' It must be at least the size of the returning statement + 1.
- ' The actual length of the returing statement is returned.
- ' If the passed size is too small then the returning length will
- ' be set to -1.
- '=============================<[ Close ]>==============================
- Declare Sub sluClose lib "SQLitening.Dll" alias "slClose"
- ' Calls SQLitening.Dll directly.
- '===========================<[ Close Set ]>============================
- Declare Sub sluCloseSet lib "SQLitening.Dll" alias "slCloseSet" ( _
- byval SetNumber as Long)
- ' Calls SQLitening.Dll directly.
- '============================<[ Connect ]>=============================
- Declare Function sluConnect lib "SQLiteningU.Dll" alias "sluConnect" (_
- byval Server as Long, _
- byval Port as Long, _
- byval ModChars as Long, _
- byval OutData as Long, _
- byref SizeOfOutData as Long) as Long
- ' Server is a pointer to a null-terminated string.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- ' DataOut is a pointer to the returning out data. If not needed you
- ' may pass a zero.
- ' SizeOfOutData is both passed and returned. Pass the size of OutData.
- ' It must be at least the size of the returning out data.
- ' The actual length of the returing out data is returned.
- ' If the passed size is too small then the returning length will
- ' be set to -1.
- '===========================<[ ConvertDat ]>===========================
- Declare Sub sluConvertDat lib "SQLiteningU.Dll" alias "sluConvertDat" ( _
- byval DataIn as Long, _
- byval LengthOfDataIn as Long, _
- byval DataOut as Long, _
- byref SizeOfDataOut as Long, _
- byval ModChars as Long)
- ' DataIn is a pointer to the memory containing the data to be converted.
- ' LengthOfDataIn contains the length of the data to be converted.
- ' DataOut is a pointer to the returning converted data.
- ' SizeOfDataOut is both passed and returned. Pass the size of DataOut.
- ' It must be at least the size of the returning converted data.
- ' The actual length of the returing converted data is returned.
- ' If the passed size is too small then the returning length will
- ' be set to -1.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '===========================<[ Disconnect ]>===========================
- Declare Sub sluDisconnect lib "SQLitening.Dll" alias "slDisconnect"
- ' Calls SQLitening.Dll directly.
- '==============================<[ Exe ]>===============================
- Declare Function sluExe lib "SQLiteningU.Dll" alias "sluExe" (_
- byval Statement as Long, _
- byval ModChars as Long) as Long
- ' Statement is a pointer to a null-terminated string.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '============================<[ Exe Bind ]>============================
- Declare Function sluExeBind lib "SQLiteningU.Dll" alias "sluExeBind" ( _
- byval Statement as Long, _
- byval BindDats as Long, _
- byval LengthOfBindDats as Long, _
- byval ModChars as Long) as Long
- ' Statement is a pointer to a null-terminated string.
- ' BindDats is a pointer to the binary dats.
- ' LengthOfBindDats contains the length of the binary dats.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '===========================<[ Field Get ]>============================
- Declare Sub sluF lib "SQLiteningU.Dll" alias "sluF" ( _
- byval ColumnNumber as Long, _
- byval FieldValue as Long, _
- byref SizeOfFieldValue as Long, _
- byval SetNumber as Long)
- ' FieldValue is a pointer to the memory which will receive the field value.
- ' A Null (hex '00') will be added to end.
- ' SizeOfFieldValue is both passed and returned. Pass the size of FieldValue.
- ' It must be at least the size of the returning field value + 1.
- ' The actual length of the returing field value is returned.
- ' If the passed size is too small then error -13 will be raised
- ' and the returning length will be set to -1.
- '=======================<[ Field Get Extended ]>=======================
- Declare Sub sluFX lib "SQLiteningU.Dll" alias "sluFX" ( _
- byval ColumnNumber as Long, _
- byval FieldValue as Long, _
- byref SizeOfFieldValue as Long, _
- byval SetNumber as Long, _
- byval ModChars as Long)
- ' FieldValue is a pointer to the memory which will receive the field value.
- ' A Null (hex '00') will be added to end (meaningless for a field
- ' containing binary data).
- ' SizeOfFieldValue is both passed and returned. Pass the size of FieldValue.
- ' It must be at least the size of the returning field value + 1.
- ' The actual length of the returing field value is returned.
- ' If the passed size is too small then error -13 will be raised
- ' and the returning length will be set to -1.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '=========================<[ Field Name Get ]>=========================
- Declare Sub sluFN lib "SQLiteningU.Dll" alias "sluFN" ( _
- byval ColumnName as Long, _
- byval FieldValue as Long, _
- byref SizeOfFieldValue as Long, _
- byval SetNumber as Long)
- ' ColumnName is a pointer to a null-terminated string.
- ' FieldValue is a pointer to the memory which will receive the field value.
- ' A Null (hex '00') will be added to end.
- ' SizeOfFieldValue is both passed and returned. Pass the size of FieldValue.
- ' It must be at least the size of the returning field value + 1.
- ' The actual length of the returing field value is returned.
- ' If the passed size is too small then error -13 will be raised
- ' and the returning length will be set to -1.
- '====================<[ Field Name Get Extended ]>=====================
- Declare Sub sluFNX lib "SQLiteningU.Dll" alias "sluFNX" ( _
- byval ColumnName as Long, _
- byval FieldValue as Long, _
- byref SizeOfFieldValue as Long, _
- byval SetNumber as Long, _
- byval ModChars as Long)
- ' ColumnName is a pointer to a null-terminated string.
- ' FieldValue is a pointer to the memory which will receive the field value.
- ' A Null (hex '00') will be added to end (meaningless for a field
- ' containing binary data).
- ' SizeOfFieldValue is both passed and returned. Pass the size of FieldValue.
- ' It must be at least the size of the returning field value + 1.
- ' The actual length of the returing field value is returned.
- ' If the passed size is too small then error -13 will be raised
- ' and the returning length will be set to -1.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '========================<[ Get Change Count ]>========================
- Declare Function sluGetChangeCount lib "SQLiteningU.Dll" alias "sluGetChangeCount" ( _
- byval ModChars as Long) as Long
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '========================<[ Get Column Count ]>========================
- Declare Function sluGetColumnCount lib "SQLitening.Dll" alias "slGetColumnCount" ( _
- byval SetNumber as Long) as Long
- ' Calls SQLitening.Dll directly.
- '========================<[ Get Column Name ]>=========================
- Declare Sub sluGetColumnName lib "SQLiteningU.Dll" alias "sluGetColumnName" ( _
- byval ColumnNumber as Long, _
- byval ColumnName as Long, _
- byref SizeOfColumnName as Long, _
- byval SetNumber as Long)
- ' ColumnName is a pointer to the memory which will receive the column
- ' name(s). Will return all column names if the passed column
- ' number is zero. If all column names are returned then it is
- ' a delimited text string which is $NUL seperated. A Null
- ' (hex '00') will be added to end (meaningless if all column
- ' names are returned).
- ' SizeOfColumnName is both passed and returned. Pass the size of ColumnName.
- ' It must be at least the size of the returning column name + 1.
- ' The actual length of the returing column name(s) is returned.
- ' If the passed size is too small then error -13 will be raised
- ' and the returning length will be set to -1.
- '=======================<[ Get Column Number ]>========================
- Declare Function sluGetColumnNumber lib "SQLiteningU.Dll" alias "sluGetColumnNumber" ( _
- byval ColumnName as Long, _
- byval rlSetNumber as Long) as Long
- '===========================<[ Get Error ]>============================
- Declare Sub sluGetError lib "SQLiteningU.Dll" alias "sluGetError" ( _
- byval Error as Long, _
- byref SizeOfError as Long)
- ' Error is a pointer to the memory which will receive the field value.
- ' A Null (hex '00') will be added to end.
- ' SizeOfError is both passed and returned. Pass the size of Error.
- ' It must be at least the size of the returning error + 1.
- ' The actual length of the returing error is returned.
- ' If the passed size is too small then error -13 will be raised
- ' and the returning length will be set to -1.
- '========================<[ Get Error Number ]>========================
- Declare Function sluGetErrorNumber lib "SQLitening.Dll" alias "slGetErrorNumber" () as Long
- ' Calls SQLitening.Dll directly.
- '============================<[ Get File ]>============================
- Declare Function sluGetFile lib "SQLiteningU.Dll" alias "sluGetFile" ( _
- byval FileName as Long, _
- byval FileData as Long, _
- byref SizeOfFileData as Long, _
- byval ModChars as Long) as Long
- ' FileName is a pointer to a null-terminated string.
- ' FileData is a pointer to the memory which will receive the file data.
- ' SizeOfFileData is both passed and returned. Pass the size of FileData.
- ' It must be at least the size of the returning file data.
- ' The actual length of the returing file data is returned.
- ' If the passed size is too small then error -9 will be raised.
- ' and the returning length will be set to -1.
- '===========================<[ Get Handle ]>===========================
- Declare Function sluGetHandle lib "SQLiteningU.Dll" alias "sluGetHandle" ( _
- byval ModChars as Long, _
- byval SetNumber as Long) as Long
- ' ModChars is a pointer to a null-terminated string. If not needed
- ' you may pass a zero.
- '=========================<[ Get Insert ID ]>==========================
- Declare Function sluGetInsertID lib "SQLitening.Dll" alias "slGetInsertID" as Quad
- ' Calls SQLitening.Dll directly. Returning a 64 bit integer.
- '============================<[ Get Row ]>=============================
- Declare Function sluGetRow lib "SQLiteningU.Dll" alias "sluGetRow" ( _
- byval SetNumber as Long, _
- byval ModChars as Long) as Long
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '===========================<[ Get Status ]>===========================
- Declare Sub sluGetStatus lib "SQLiteningU.Dll" alias "sluGetStatus" ( _
- byval rlRequest as Long, _
- byval Status as Long, _
- byref SizeOfStatus as Long)
- ' Status is a pointer to the memory which will receive the status
- ' data. The data is returned as a delimited text string.
- ' SizeOfStatus is both passed and returned. Pass the size of Status.
- ' It must be at least the size of the returning status data.
- ' The actual length of the returing status data is returned.
- ' If the passed size is too small then error -13 will be raised
- ' and the returning length will be set to -1.
- '=====================<[ Get Table Column Names ]>=====================
- Declare Sub sluGetTableColumnNames lib "SQLiteningU.Dll" alias "sluGetTableColumnNames" ( _
- byval TableName as Long, _
- byval ColumnNames as Long, _
- byref SizeOfColumnNames as Long)
- ' TableName is a pointer to a null-terminated string.
- ' ColumnNames is a pointer to the memory which will receive the column
- ' names. The names are returned as a delimited text string
- ' which is $NUL seperated.
- ' SizeOfColumnNames is both passed and returned. Pass the size of ColumnName.
- ' It must be at least the size of the returning column names.
- ' The actual length of the returing column names is returned.
- ' If the passed size is too small then error -13 will be raised
- ' and the returning length will be set to -1.
- '========================<[ Get Table Names ]>=========================
- Declare Sub sluGetTableNames lib "SQLiteningU.Dll" alias "sluGetTableNames" (_
- byval DataBase as Long, _
- byval TableNames as Long, _
- byref SizeOfTableNames as Long)
- ' DataBase is a pointer to a null-terminated string.
- ' TableNames is a pointer to the memory which will receive the table
- ' names. The names are returned as a delimited text string
- ' which is $NUL seperated.
- ' SizeOfTableNames is both passed and returned. Pass the size of TableName.
- ' It must be at least the size of the returning table names.
- ' The actual length of the returing table names is returned.
- ' If the passed size is too small then error -13 will be raised
- ' and the returning length will be set to -1.
- '=====================<[ Get Unused Set Number ]>======================
- Declare Function sluGetUnusedSetNumber lib "SQLitening.Dll" alias "slGetUnusedSetNumber" as Long
- ' Calls SQLitening.Dll directly.
- '======================<[ Is Column Name Valid ]>======================
- Declare Function sluIsColumnNameValid lib "SQLiteningU.Dll" alias "sluIsColumnNameValid" ( _
- byval ColumnName as Long, _
- byval SetNumber as Long) as Long
- ' ColumnName is a pointer to a null-terminated string.
- '=====================<[ Is Column Number Valid ]>=====================
- Declare Function sluIsColumnNumberValid lib "SQLitening.Dll" alias "slIsColumnNumberValid" (_
- byval ColumnNumber as Long, _
- byval SetNumber as Long) as Long
- ' Calls SQLitening.Dll directly.
- '============================<[ Is Open ]>=============================
- Declare Function sluIsOpen lib "SQLitening.Dll" alias "slIsOpen" as Long
- ' Calls SQLitening.Dll directly.
- '=========================<[ Is Field Null ]>==========================
- Declare Function sluIsFieldNull lib "SQLitening.Dll" alias "slIsFieldNull" ( _
- byval ColumnNumber as Long, _
- byval SetNumber as Long) as Long
- ' Calls SQLitening.Dll directly.
- '======================<[ Is Set Number Valid ]>=======================
- Declare Function sluIsSetNumberValid lib "SQLitening.Dll" alias "slIsSetNumberValid" ( _
- byval SetNumber as Long) as Long
- ' Calls SQLitening.Dll directly.
- '==========================<[ Pop Database ]>==========================
- Declare Sub sluPopDatabase lib "SQLiteningU.Dll" alias "sluPopDatabase" ( _
- byval Save as Long)
- ' Save is a pointer to the 21 byte save area set by slPushDatabase.
- ' If not needed you may pass a zero.
- '============================<[ Pop Set ]>=============================
- Declare Sub sluPopSet lib "SQLiteningU.Dll" alias "sluPopSet" ( _
- byval SetNumber as Long, _
- byval Save as Long, _
- byval LenghtOfSave as Long)
- ' Save is a pointer to the save area set by slPushSet. If not needed you
- ' may pass a zero.
- ' LengthOfSave contains the length of the save area. If not needed you
- ' may pass a zero.
- '=========================<[ Push Database ]>==========================
- Declare Sub sluPushDatabase lib "SQLiteningU.Dll" alias "sluPushDatabase" ( _
- byval Save as Long)
- ' Save is a pointer to a 21 byte area to receive the save data. If not
- ' needed you may pass a zero.
- '============================<[ Push Set ]>============================
- Declare Sub sluPushSet lib "SQLiteningU.Dll" alias "sluPushSet" ( _
- byval SetNumber as Long, _
- byval Save as Long, _
- byref SizeOfSave as Long)
- ' Save is a pointer to the save area set by slPushSet. If not needed you
- ' may pass a zero.
- ' SizeOfSave is both passed and returned. Pass the size of Save. It must
- ' be at least the size of the returning save data. This varies
- ' depending on the number of columns in the set and the size of
- ' the column names. The actual length of the retured save data
- ' is returned. If the passed size is too small then returning
- ' length will be set to -1.
- '============================<[ Put File ]>============================
- Declare Function sluPutFile lib "SQLiteningU.Dll" alias "sluPutFile" ( _
- byval FileName as Long, _
- byval FileData as Long, _
- byval LengthOfFileData as Long, _
- byval ModChars as Long) as Long
- ' FileName is a pointer to a null-terminated string.
- ' FileData is a pointer to the memory which will contains the file data.
- ' LengthOfFileData contains the length of the file data.
- '============================<[ Run Proc ]>============================
- Declare Function sluRunProc lib "SQLiteningU.Dll" alias "sluRunProc" ( _
- byval ProcName as Long, _
- byref Parm1 as Long, _
- byref Parm2 as Long, _
- byval Parm3 as Long, _
- byval LengthOfParm3 as Long, _
- byref SizeOfParm3 as Long, _
- byval Parm4 as Dword, _
- byval LengthOfParm4 as Long, _
- byref SizeOfParm4 as Long, _
- byval ModChars as Long) as Long
- ' ProcName is a pointer to a null-terminated string.
- ' Parm3 is a pointer to the memory which will contain the parm 3 data.
- ' LengthOfParm2 contains the length of the passed parm 3 data.
- ' SizeOfParm2 is both passed and returned. Pass the size of Parm3.
- ' It must be at least the size of the returning parm 3 data.
- ' The actual length of the returing parm 3 data is returned.
- ' If the passed size is too small then the returning length will
- ' be set to -1.
- ' Parm4 is a pointer to the memory which will contain the parm 4 data.
- ' LengthOfParm4 contains the length of the passed parm 4 data.
- ' SizeOfParm4 is both passed and returned. Pass the size of Parm4.
- ' It must be at least the size of the returning parm 4 data.
- ' The actual length of the returing parm 4 data is returned.
- ' If the passed size is too small then the returning length will
- ' be set to -1.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '==============================<[ Open ]>==============================
- Declare Function sluOpen lib "SQLiteningU.Dll" alias "sluOpen" ( _
- byval FileName as Long, _
- byval ModChars as Long) as Long
- ' FileName is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '==============================<[ Sel ]>===============================
- Declare Function sluSel lib "SQLiteningU.Dll" alias "sluSel" ( _
- byval Statement as Long, _
- byval SetNumber as Long, _
- byval ModChars as Long) as Long
- ' Statement is a pointer to a null-terminated string.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- '
- '========================<[ Set Process Mods ]>========================
- Declare Sub sluSetProcessMods lib "SQLiteningU.Dll" alias "sluSetProcessMods" ( _
- byval ModChars as Long)
- ' ModChars is a pointer to a null-terminated string.
- '======================<[ Sel Rel Named Locks ]>=======================
- Declare Function sluSetRelNamedLocks lib "SQLiteningU.Dll" alias "sluSetRelNamedLocks" ( _
- byval LockNames as Long, _
- byval ModChars as Long, _
- byval SelStatement as Long, _
- byval SelSetNumber as Long, _
- byval SelModChars as Long) as Long
- ' LockNames is a pointer to a null-terminated string.
- ' ModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- ' SelStatement is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
- ' SelModChars is a pointer to a null-terminated string. If not needed you
- ' may pass a zero.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement