• Welcome, Guest. Please login.
 
October 25, 2021, 09:42:17 PM

News:

Welcome to the SQLitening support forums!


slGetFieldDataTypes returns 4 if slExeBind?

Started by cj, January 04, 2013, 03:27:07 AM

Previous topic - Next topic

cj

January 04, 2013, 03:27:07 AM Last Edit: January 04, 2013, 03:31:00 AM by cj
Fred,
Thank you for all the help you have given and have a great year!


#COMPILE EXE "\sql\bin\DataTypes"
#DIM ALL
%Use_slExeBind = 1
%Use_slExe     = 1
%DropTable     = 1
%NumberRecords = 2
#INCLUDE "\sql\inc\sqlitening.inc"
FUNCTION PBMAIN AS LONG
  LOCAL sql, sResult AS STRING, NumberOfRecords AS LONG
  slOpen    "test.db3","C"
  #IF %DropTable
  slExe     "Drop Table If Exists T1"
  #ENDIF
  slExe     "Create Table If not Exists T1(F1)"
  #IF %Use_slExeBind
    sResult = "slExeBind" + $CR
    FOR NumberOfRecords = 1 TO %NumberRecords
      sql = slBuildBindDat ("One")
      slExeBind slBuildInsertOrUpdate("T1", "?"), sql
      sql = "Select * FROM T1"
      sResult=sResult + slGetFieldDataTypes(sql)+ $CRLF
    NEXT
    sResult = sResult + $CRLF
  #ENDIF
  #IF %Use_slExe
    sResult = sResult + "slEXE" + $CRLF
    FOR NumberOfRecords = 1 TO %NumberRecords
      slExe     "Insert into T1 values('One')
      sql = "Select * FROM T1"
      sResult=sResult +slGetFieldDataTypes(sql) + $CRLF
    NEXT
  #ENDIF
  ? sResult,,"slGetFieldDataTypes"
END FUNCTION

Fred Meier

The resulting data type depends on the ModChar used in slBuildBindData, default will be Blob.

QuoteFunction slBuildBindDat alias "slBuildBindDat" (rsData as String, _
                                                optional byval rsModChars as String)Export as String
'   Returns a BindDat entry which is a specially formatted string required
'   by slExeBind.  Data contains the value you want converted into a BindDat.
'   A BindDat(s) is required to be passed to slExeBind.  The returned data
'   may also be compressed and/or encrypted.  If an error occurs then the
'   return value will be an empty string.  Use slGetError or slGetErrorNumber
'   to determine the error.
'   ModChars:
'      B = Bind as Blob.  This is the default.
'      C = Compress the data. Only use with Blob or Text.
'      N = Encrypt the data. Only use with Blob or Text. Requires a crypt key to
'          be set using slSetProcessMods.
'      T = Bind as Text.  Default is to bind as Blob.
'      i = Bind as Integer 32 bit (must be the only ModChar).  Default is to bind as Blob.
'      I = Bind as Integer 64 bit (must be the only ModChar).  Default is to bind as Blob.
'      D = Bind as Double (must be the only ModChar).  Default is to bind as Blob.
'      Z = Bind as Null (must be the only ModChar).  Default is to bind as Blob.
'      Note: If both C and N then will first compress and then encrypt.