GetData - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Result

 GetData
 get the data stored in a column of the current row

 Calling Sequence result:-GetData( index, opt )

Parameters

 result - Result module index - string or integer; the column from which to get the data opt - (optional) equation of the form stream=boolean

Description

 • GetData returns the data element in the row indicated by the row cursor and in the column index.
 • GetData accepts one optional argument that affects the format of the returned value.
 stream = true or false
 For some large binary and character elements it may be inconvenient or even impossible to transfer the entire object to Maple at once.  By passing stream=true, GetData will return a DataInterfaceStream module instead of the object.  The DataInterfaceStream module allows the data to be retrieved in pieces.  stream=true is valid only for elements of type CHAR, VARCHAR, LONGVARCHAR, BINARY, VARBINARY, and LONGVARBINARY.
 • If index is an integer, it is the index of the column in the table. If index is a string, then it is the name of the column.
 • If the current row is not a data row, then an error is raised.
 • Using GetData and Next is the preferred method for walking the data of a Result module.

Examples

Create a Result.

 > $\mathrm{driver}≔{\mathrm{Database}}_{\mathrm{LoadDriver}}\left(\right):$
 > $\mathrm{conn}≔\mathrm{driver}:-\mathrm{OpenConnection}\left(\mathrm{url},\mathrm{name},\mathrm{pass}\right):$$\mathrm{res}≔\mathrm{conn}:-\mathrm{ExecuteQuery}\left("SELECT id,name,number,mass FROM animals"\right):$$\mathrm{res}:-\mathrm{Next}\left(\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{res}:-\mathrm{GetData}\left(1\right)$
 ${1}$ (2)
 > $\mathrm{res}:-\mathrm{GetData}\left(2\right)$
 ${"fish"}$ (3)
 > $\mathrm{res}:-\mathrm{GetData}\left(3\right)$
 ${100}$ (4)
 > $\mathrm{res}:-\mathrm{GetData}\left(4\right)$
 ${0.0100000000000000002}$ (5)
 > $\mathrm{res}:-\mathrm{GetData}\left("id"\right)$
 ${1}$ (6)
 > $\mathrm{res}:-\mathrm{GetData}\left("name"\right)$
 ${"fish"}$ (7)
 > $\mathrm{res}:-\mathrm{GetData}\left("number"\right)$
 ${100}$ (8)
 > $\mathrm{res}:-\mathrm{GetData}\left("mass"\right)$
 ${0.0100000000000000002}$ (9)
 > $\mathrm{res}≔\mathrm{conn}:-\mathrm{ExecuteQuery}\left("SELECT * FROM stream"\right):$$\mathrm{res}:-\mathrm{Next}\left(\right)$
 ${\mathrm{true}}$ (10)
 > $\mathrm{res}:-\mathrm{GetData}\left(1\right)$
 ${"the quick brown fox jumped over the lazy dog"}$ (11)
 > $\mathrm{res}:-\mathrm{GetData}\left(2\right)$

 [   1..127 1-D Array    ] [ Data Type: integer[1] ] [ Storage: rectangular  ] [    Order: C_order     ]

 > $\mathrm{str}≔\mathrm{res}:-\mathrm{GetData}\left(1,\mathrm{stream}=\mathrm{true}\right):$$\mathrm{str}:-\mathrm{Read}\left(5\right)$
 ${"the q"}$ (12)
 > $\mathrm{str}:-\mathrm{Skip}\left(5\right);$$\mathrm{str}:-\mathrm{Read}\left(5\right)$
 ${"brown"}$ (13)
 > $\mathrm{str}≔\mathrm{res}:-\mathrm{GetData}\left(2,\mathrm{stream}=\mathrm{true}\right):$$\mathrm{str}:-\mathrm{Read}\left(5\right)$
 $\left[{1}{,}{2}{,}{3}{,}{4}{,}{5}\right]$ (14)
 > $\mathrm{str}:-\mathrm{Skip}\left(5\right);$$\mathrm{str}:-\mathrm{Read}\left(5\right)$
 $\left[{11}{,}{12}{,}{13}{,}{14}{,}{15}\right]$ (15)