4. FetchHash

[<<<] [>>>]

R = ODBC::FetchHash(DB,arr)

Use this function to fetch one row from the results after a successfully executed SELECT statement. The first argument to the function is DB the database handle. The second argument should be a variable. This variable will hold the hash-array containing the data of the actual row. The array is indexed from zero to 2*n-1 where n is the number of columns in the result set. Every even element (starting with index zero) will hold the name of a column and the next odd element of the array will hold the value of the column. This is according to the storage strategy of ScriptBasic for hashes.

After the successful execution of this function you will be able to access the value of the column named "column" with the syntax arr{"column"}. Note however that column names in SQL are usually case insensitive, but ScriptBasic hash indexing is case sensitive.

Use consecutive calls to this fucntion to get the rows of the result one after the other. You can mix consecutive calls to FetchHash and FetchArray.

The function returns -1 (TRUE) if fetching a row of data was successful or 0 (FALSE) if there are no more rows in the dataset. In the latter case arr will be undef.

See also FetchArray.

This function calls the ODBC functions SQLFetch, SQLDescribeCol, SQLGetData.

[<<<] [>>>]