Jump to content

"stream-like" behavior for AutoIt binary data


Veluxe
 Share

Recommended Posts

Hi,

I've required a streaming functionality written in plain AutoIt for in-memory streams based on AutoIt's binary data.

I did not found it here, so I just wrote it down, feel free to use it. Shame on me if its a duplicate.

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 3 -w 4 -w 5 -w 6
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

; Version 1.0.0
; _BinaryStream_Create()
; _BinaryStream_Available($aStream)
; _BinaryStream_Clear($aStream)
; _BinaryStream_GetLength($aStream)
; _BinaryStream_SetLength($aStream, $iLength)
; _BinaryStream_GetPosition($aStream)
; _BinaryStream_SetPosition($aStream, $iPosition)
; _BinaryStream_Write($aStream, $bData [, $iLength])
; _BinaryStream_Read($aStream [, $iLength])
; _BinaryStream_Peek($aStream [, $iLength])
; _BinaryStream_ToBinary($aStream [, $iPosition [, $iLength])

; #FUNCTION# ====================================================================================================================
; Name ..........: _BinaryStream_Create
; Description ...: Creates a new stream which is represented as a 1 dimensional array with 2 values:
;                  [0] = The binary data of the stream.
;                  [1] = The current position of the stream.
; Syntax ........: _BinaryStream_Create([$bData = Default])
; Parameters ....: $bData               - [optional] The initial value of the stream, empty by default.
; Return values .: On success: The stream represented as an array.
; Author ........: Veluxe
; ===============================================================================================================================
Func _BinaryStream_Create($bData = Default)
    Local $aStream[2] = [BinaryMid(Null, 1, 0), 0]

    If ($bData <> Default) And (BinaryLen($bData) > 0) Then
        $aStream[0] &= Binary($bData)
    EndIf

    Return $aStream
EndFunc   ;==>_BinaryStream_Create

; #FUNCTION# ====================================================================================================================
; Name ..........: _BinaryStream_Available
; Description ...: Returns the count of bytes available to read from the current stream position.
; Syntax ........: _BinaryStream_Available(Byref $aStream)
; Parameters ....: $aStream             - [in/out] The array that represents the stream which was created by _BinaryStream_Create().
; Return values .: On success: Returns the count of bytes available to read from the current stream position.
;                  On error:
;                  -1 : The passed stream is not a valid array!
;                  -2 : The passed stream has invalid dimensions, it must be a 1 dimensional array with a length of 2!
;                  -3 : The current position of the stream is outside the stream data boundaries!
; Author ........: Veluxe
; ===============================================================================================================================
Func _BinaryStream_Available(ByRef $aStream)
    If Not IsArray($aStream) Then Return SetError(-1, Default, -1)
    If (UBound($aStream, 0) <> 1) Or (UBound($aStream, 1) > 2) Then Return SetError(-2, Default, -2)

    Local $iStreamLength = BinaryLen($aStream[0])

    If ($aStream[1] < 0) Or ($aStream[1] > $iStreamLength) Then Return SetError(-3, Default, -3) ; Broken stream

    Return $iStreamLength - $aStream[1]
EndFunc   ;==>_BinaryStream_Available

; #FUNCTION# ====================================================================================================================
; Name ..........: _BinaryStream_Clear
; Description ...: Clears the specified stream. This will set its length and position to 0.
; Syntax ........: _BinaryStream_Clear(Byref $aStream)
; Parameters ....: $aStream             - [in/out] The array that represents the stream which was created by _BinaryStream_Create().
; Return values .: On success: Returns 1.
;                  On error:
;                  -1 : The passed stream is not a valid array!
;                  -2 : The passed stream has invalid dimensions, it must be a 1 dimensional array with a length of 2!
; Author ........: Veluxe
; ===============================================================================================================================
Func _BinaryStream_Clear(ByRef $aStream)
    If Not IsArray($aStream) Then Return SetError(-1, Default, -1)
    If (UBound($aStream, 0) <> 1) Or (UBound($aStream, 1) > 2) Then Return SetError(-2, Default, -2)

    $aStream[0] = BinaryMid(Null, 1, 0)
    $aStream[1] = 0

    Return 1
EndFunc   ;==>_BinaryStream_Clear

; #FUNCTION# ====================================================================================================================
; Name ..........: _BinaryStream_GetLength
; Description ...: Returns the length of the stream in count of bytes.
; Syntax ........: _BinaryStream_GetLength(Byref $aStream)
; Parameters ....: $aStream             - [in/out] The array that represents the stream which was created by _BinaryStream_Create().
; Return values .: On success: Returns the length of the stream in count of bytes.
;                  On error:
;                  -1 : The passed stream is not a valid array!
;                  -2 : The passed stream has invalid dimensions, it must be a 1 dimensional array with a length of 2!
; Author ........: Veluxe
; ===============================================================================================================================
Func _BinaryStream_GetLength(ByRef $aStream)
    If Not IsArray($aStream) Then Return SetError(-1, Default, -1)
    If (UBound($aStream, 0) <> 1) Or (UBound($aStream, 1) > 2) Then Return SetError(-2, Default, -2)

    Return BinaryLen($aStream[0])
EndFunc   ;==>_BinaryStream_GetLength

; #FUNCTION# ====================================================================================================================
; Name ..........: _BinaryStream_SetLength
; Description ...: Adjusts the length of the stream to the specified value. If the new length is lower than the previous length
;                  the stream position will be adjusted to the last byte of the new stream length. If the new stream length is
;                  greater than the previous length, the stream position will remain to its current value. The stream will get
;                  bytes of value 00 appended to its end until the length fits the new value.
;                  If the new length equals the old length the whole stream will remain to its current values.
; Syntax ........: _BinaryStream_SetLength(Byref $aStream, $iLength)
; Parameters ....: $aStream             - [in/out] The array that represents the stream which was created by _BinaryStream_Create().
;                  $iLength             - The new length of the stream.
; Return values .: On success: Returns the new length of the stream in count of bytes.
;                  On error:
;                  -1 : The passed stream is not a valid array!
;                  -2 : The passed stream has invalid dimensions, it must be a 1 dimensional array with a length of 2!
;                  -3 : The passed length is lower than 0!
; Author ........: Veluxe
; ===============================================================================================================================
Func _BinaryStream_SetLength(ByRef $aStream, $iLength)
    If Not IsArray($aStream) Then Return SetError(-1, Default, -1)
    If (UBound($aStream, 0) <> 1) Or (UBound($aStream, 1) > 2) Then Return SetError(-2, Default, -2)
    If $iLength < 0 Then Return SetError(-3, Default, -3)

    Local $iStreamLength = BinaryLen($aStream[0])

    If $iLength > $iStreamLength Then
        Local $bPadding = BinaryMid(0, 1, 0)
        Local $iPaddingLength = 0

        ; The following code creates a series of 00-bytes
        ; It will try to append 1 byte, if that fits into the specified length, it will double the 1 byte ...
        ; then it will retry to append 2 bytes, if that also fits into the length, it will double the 2 bytes ...
        ; then it will retry to append 4 bytes, if that ... etc.
        ; It will re-start at 1 byte again when the doubled data does not fit into the final series anymore.
        ; this will be continued until the series of n-bytes is finally created.
        While $iStreamLength < $iLength
            $bPadding = BinaryMid(0, 1, 1)
            $iPaddingLength = 1

            While ($iStreamLength + $iPaddingLength * 2) < $iLength
                $bPadding &= $bPadding
                $iPaddingLength *= 2
            WEnd

            $aStream[0] &= $bPadding
            $iStreamLength += $iPaddingLength
        WEnd
    ElseIf $iLength < $iStreamLength Then
        $aStream[0] = BinaryMid($aStream[0], 1, $iLength)

        If $aStream[1] > $iLength Then
            $aStream[1] = $iLength ; If the stream position would be outside the data it ...
            ; ... will be set to the end position within the new stream data - in any other ...
            ; ... case the stream position will remain to its value
        EndIf
    EndIf

    Return $iLength
EndFunc   ;==>_BinaryStream_SetLength

; #FUNCTION# ====================================================================================================================
; Name ..........: _BinaryStream_GetPosition
; Description ...: Returns the current position of the specified stream.
; Syntax ........: _BinaryStream_GetPosition(Byref $aStream)
; Parameters ....: $aStream             - [in/out] The array that represents the stream which was created by _BinaryStream_Create().
; Return values .: On success: Returns the current position of the specified stream.
;                  On error:
;                  -1 : The passed stream is not a valid array!
;                  -2 : The passed stream has invalid dimensions, it must be a 1 dimensional array with a length of 2!
; Author ........: Veluxe
; ===============================================================================================================================
Func _BinaryStream_GetPosition(ByRef $aStream)
    If Not IsArray($aStream) Then Return SetError(-1, Default, -1)
    If (UBound($aStream, 0) <> 1) Or (UBound($aStream, 1) > 2) Then Return SetError(-2, Default, -2)

    Return $aStream[1]
EndFunc   ;==>_BinaryStream_GetPosition

; #FUNCTION# ====================================================================================================================
; Name ..........: _BinaryStream_SetPosition
; Description ...: Sets the stream position to the specified value related to an origin.
; Syntax ........: _BinaryStream_SetPosition(Byref $aStream, $iPosition[, $iOrigin = Default])
; Parameters ....: $aStream             - [in/out] The array that represents the stream which was created by _BinaryStream_Create().
;                  $iPosition           - The position to set the stream to related to the origin.
;                  $iOrigin             - [optional] The origin where to set the position from, valid values are:
;                                               0 : From the begin of the stream (0)
;                                               1 : From the current position of the stream
;                                               2 : From the end of the stream (new position = length - offset)
;                                         The default origin is 0 - from the begin of the stream.
; Return values .: On success: A value greater or equal to 0, representing the new position of the stream.
;                  On error:
;                  -1 : The passed stream is not a valid array!
;                  -2 : The passed stream has invalid dimensions, it must be a 1 dimensional array with a length of 2!
;                  -3 : The passed position is lower than 0!
;                  -4 : The passed origin value is invalid! Valid values are: 0, 1 and 2. (see parameter description)
;                  -5 : The passed position related to the passed origin is resulting in a position outside the stream data!
; Author ........: Veluxe
; ===============================================================================================================================
Func _BinaryStream_SetPosition(ByRef $aStream, $iPosition, $iOrigin = Default)
    If Not IsArray($aStream) Then Return SetError(-1, Default, -1)
    If (UBound($aStream, 0) <> 1) Or (UBound($aStream, 1) > 2) Then Return SetError(-2, Default, -2)
    If $iPosition < 0 Then Return SetError(-3, Default, -3) ; Note No max validation here ...
    ; ... later on the calculated value will be validated against the max

    If $iOrigin = Default Then
        $iOrigin = 0 ; The origin is the start of the stream by default
    ElseIf ($iOrigin < 0) Or ($iOrigin > 2) Then
        Return SetError(-4, Default, -4)
    EndIf

    Local $iNewPosition = -1
    Local $iStreamLength = BinaryLen($aStream[0])

    Switch Int($iOrigin)
        Case 2 ; End
            $iNewPosition = $iStreamLength - $iPosition
        Case 1 ; Current
            $iNewPosition = $aStream[1] + $iPosition
        Case Else ; Begin
            $iNewPosition = $iPosition
    EndSwitch

    If $iNewPosition > $iStreamLength Then Return SetError(-5, Default, -5)

    $aStream[1] = $iNewPosition

    Return $aStream[1]
EndFunc   ;==>_BinaryStream_SetPosition

; #FUNCTION# ====================================================================================================================
; Name ..........: _BinaryStream_Write
; Description ...: Writes the specified binary data to the current stream position.
; Syntax ........: _BinaryStream_Write(Byref $aStream, $bData[, $iLength = Default])
; Parameters ....: $aStream             - [in/out] The array that represents the stream which was created by _BinaryStream_Create().
;                  $bData               - The binary data to write to the stream.
;                  $iLength             - [optional] The length of the passed binary data to write to the stream. (The whole data
;                                         by default)
; Return values .: On success: Returns the new position of the stream after the bytes were written.
;                  On error:
;                  -1 : The passed stream is not a valid array!
;                  -2 : The passed stream has invalid dimensions, it must be a 1 dimensional array with a length of 2!
;                  -3 : The current position of the stream is outside the stream data boundaries!
; Author ........: Veluxe
; ===============================================================================================================================
Func _BinaryStream_Write(ByRef $aStream, $bData, $iLength = Default)
    If Not IsArray($aStream) Then Return SetError(-1, Default, -1)
    If (UBound($aStream, 0) <> 1) Or (UBound($aStream, 1) > 2) Then Return SetError(-2, Default, -2)

    Local $iStreamLength = BinaryLen($aStream[0]) ; To avoid further BinaryLen() calls

    If ($aStream[1] < 0) Or ($aStream[1] > $iStreamLength) Then Return SetError(-3, Default, -3) ; Broken stream

    Local $iDataLength = BinaryLen($bData)
    If $iLength = Default Then
        $iLength = $iDataLength ; Write the whole input data
    ElseIf ($iLength <= 0) Or ($iDataLength <= 0) Or ($iLength > $iDataLength) Then
        Return SetError(-4, Default, -4) ; The length or the length of the input data is 0 ...
        ; ... or the length exceeds the length of the input data
    EndIf

    Local $bNewStreamData

    If $aStream[1] = $iStreamLength Then
        $bNewStreamData = $aStream[1]
    Else
        $bNewStreamData = BinaryMid($aStream[0], 1, $aStream[1])
    EndIf

    ; The user must already pass binary to avoid unexpected serialization!
    ; See parameters notes.
    If $iLength = $iDataLength Then
        $bNewStreamData &= Binary($bData)
    Else
        $bNewStreamData &= BinaryMid($bData, 1, $iLength)
    EndIf

    Local $iTempLength = BinaryLen($bNewStreamData)
    If $iStreamLength > $iTempLength Then
        $bNewStreamData &= BinaryMid($aStream[0], ($iTempLength + 1))
    EndIf

    $aStream[0] = $bNewStreamData
    $aStream[1] += $iLength

    Return $aStream[1]
EndFunc   ;==>_BinaryStream_Write

; #FUNCTION# ====================================================================================================================
; Name ..........: _BinaryStream_Read
; Description ...: Reads a specified amount of bytes from the given stream and increments the stream position.
; Syntax ........: _BinaryStream_Read(Byref $aStream[, $iLength = Default])
; Parameters ....: $aStream             - [in/out] The array that represents the stream which was created by _BinaryStream_Create().
;                  $iLength             - [optional] an integer value. Default is Default.
; Return values .: On success: The bytes that have been read from the stream as binary.
;                  On error:
;                  -1 : The passed stream is not an array.
;                  -2 : The dimensions of the passed stream array do not represent a valid stream.
;                  -3 : The stream position is 0 but the stream already contains data.
;                  -4 : The stream position is outside the stream boundaries.
; Author ........: Veluxe
; ===============================================================================================================================
Func _BinaryStream_Read(ByRef $aStream, $iLength = Default)
    If Not IsArray($aStream) Then Return SetError(-1, Default, -1)
    If (UBound($aStream, 0) <> 1) Or (UBound($aStream, 1) > 2) Then Return SetError(-2, Default, -2)

    Local $iStreamLength = BinaryLen($aStream[0]) ; To avoid multiple BinaryLen() calls

    If ($aStream[1] < 0) Or ($aStream[1] > $iStreamLength) Then Return SetError(-3, Default, -3) ; Broken stream

    If $iLength = Default Then
        $iLength = 1 ; Read 1 byte by default
    ElseIf ($iLength <= 0) Or ($iLength > ($iStreamLength - $aStream[1])) Then
        Return SetError(-4, Default, -4) ; The length is 0 or exceeds the length of the stream
    EndIf

    Local $bReadData = BinaryMid($aStream[0], ($aStream[1] + 1), $iLength)
    $aStream[1] += $iLength ; This is the difference to peek

    Return $bReadData
EndFunc   ;==>_BinaryStream_Read

; #FUNCTION# ====================================================================================================================
; Name ..........: _BinaryStream_Peek
; Description ...: Peeks a specified length of bytes from the given stream. The return value behaves like a read, but the stream
;                  position will not be incremented.
; Syntax ........: _BinaryStream_Peek(Byref $aStream[, $iLength = Default])
; Parameters ....: $aStream             - [in/out] The array that represents the stream which was created by _BinaryStream_Create().
;                  $iLength             - [optional] The count of bytes to peek from the stream. Default = 1.
; Return values .: On success: The n-bytes read from the current position.
;                  On error:
;                  -1 : The passed stream is not a valid array!
;                  -2 : The passed stream has invalid dimensions, it must be a 1 dimensional array with a length of 2!
;                  -3 : The current position of the stream is outside the stream data boundaries!
; Author ........: Veluxe
; ===============================================================================================================================
Func _BinaryStream_Peek(ByRef $aStream, $iLength = Default)
    If Not IsArray($aStream) Then Return SetError(-1, Default, -1)
    If (UBound($aStream, 0) <> 1) Or (UBound($aStream, 1) > 2) Then Return SetError(-2, Default, -2)

    Local $iStreamLength = BinaryLen($aStream[0]) ; To avoid multiple BinaryLen() calls

    If ($aStream[1] < 0) Or ($aStream[1] > $iStreamLength) Then Return SetError(-3, Default, -3) ; Broken stream

    If $iLength = Default Then
        $iLength = 1 ; Peek 1 byte by default
    ElseIf ($iLength <= 0) Or ($iLength > ($iStreamLength - $aStream[1])) Then
        Return SetError(-4, Default, -4) ; The length is 0 or exceeds the length of the stream
    EndIf

    Return BinaryMid($aStream[0], ($aStream[1] + 1), $iLength)
EndFunc   ;==>_BinaryStream_Peek

; #FUNCTION# ====================================================================================================================
; Name ..........: _BinaryStream_ToBinary
; Description ...: Returns the specified data as binary from the stream. This will not affect the stream position nor the length.
; Syntax ........: _BinaryStream_ToBinary(Byref $aStream[, $iPosition = Default[, $iLength = Default]])
; Parameters ....: $aStream             - [in/out] The array that represents the stream which was created by _BinaryStream_Create().
;                  $iPosition           - [optional] The start position of the data to return from the stream. (0 by default)
;                  $iLength             - [optional] The length of data to return from the specified position of the stream. (The
;                                         whole data by default)
; Return values .: On success: The data of the specified length from the given position of the stream.
;                  On error:
;                  -1 : The passed stream is not a valid array!
;                  -2 : The passed stream has invalid dimensions, it must be a 1 dimensional array with a length of 2!
;                  -3 : The specified position is outside the stream boundaries!
;                  -4 : The passed length of data is not available from the specified position in the stream!
; Author ........: Veluxe
; ===============================================================================================================================
Func _BinaryStream_ToBinary(ByRef $aStream, $iPosition = Default, $iLength = Default)
    If Not IsArray($aStream) Then Return SetError(-1, Default, -1)
    If (UBound($aStream, 0) <> 1) Or (UBound($aStream, 1) > 2) Then Return SetError(-2, Default, -2)

    Local $iStreamLength = BinaryLen($aStream[0])

    If $iPosition = Default Then
        $iPosition = 0
    ElseIf ($iPosition < 0) Or ($iPosition > $iStreamLength) Then
        Return SetError(-3, Default, -3) ; The position is out of range
    EndIf

    If $iLength = Default Then
        ; Everything from the specified position until the end of the stream
        $iLength = $iStreamLength - $iPosition
    ElseIf ($iLength <= 0) Or ($iLength > ($iStreamLength - $iPosition)) Then
        Return SetError(-4, Default, -4) ; The length is 0 or exceeds the length of the stream
    EndIf

    Return BinaryMid($aStream[0], $iPosition, $iLength)
EndFunc   ;==>_BinaryStream_ToBinary

 

It can be done faster, and in terms of speed it is not comparable to anything you know of streams from other languages.

 

 

Cheers

BinaryStream.au3

Link to comment
Share on other sites

Hint:

BinaryMid(Null, 1, 0) and BinaryMid(0, 1, 0) can be replaced by Binary('')

 

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

@Veluxe Thanks.

And :welcome: to the AutoIt forum.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Thanks

 

@jchd I'm gonna replace this, does the compiler replace it with a constant value in this case or will it always make a call to Binary() at runtime? I will measure this, since speed improvements would help myself alot.

Edited by Veluxe
Link to comment
Share on other sites

There is no "compilation", just verbatim code. The interpreter then executes exactly what you write.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...