= CS_VERSION_100
])
None
is returned as the
CS_CONTEXT object when the result code is not
CS_SUCCEED
.
from sybasect import * status, ctx = cs_ctx_alloc(CS_VERSION_100) if status != CS_SUCCEED: raise 'cs_ctx_alloc'
= CS_VERSION_100
])
None
is returned as the
CS_CONTEXT object when the result code is not
CS_SUCCEED
.
from sybasect import * status, ctx = cs_ctx_global(CS_VERSION_100) if status != CS_SUCCEED: raise 'cs_ctx_global'
For all types of obj other than CS_DATAFMT a buffer will be initialised which contains a single value.
buf = DataBuf('hello') if cmd.ct_param(buf) != CS_SUCCEED: raise 'ct_param'
When obj is a CS_DATAFMT object an empty buffer will be created according to the attributes of the CS_DATAFMT object. It is most common to create and bind a buffer in a single operation via the ct_bind() method of the CS_COMMAND class.
For example, the following code creates a set of buffers for retrieving 16 rows at a time. Note that it is your responsibility to ensure that the buffers are not released until they are no longer required.
status, num_cols = cmd.ct_res_info(CS_NUMDATA) if status != CS_SUCCEED: raise 'ct_res_info' bufs = [] for i in range(num_cols): status, fmt = cmd.ct_describe(i + 1) if status != CS_SUCCEED: raise 'ct_describe' fmt.count = 16 status, buf = cmd.ct_bind(i + 1, fmt) if status != CS_SUCCEED: raise 'ct_bind' bufs.append(buf)
= -1
][, scale = -1
])
The obj argument can accept any of the following types;
IntType
, LongType
, FloatType
, StringType
,
or NumericType
.
If greater than or equal to zero the precision and scale
arguments are used as the precision and scale
attributes of the CS_DATAFMT
which is used in the Sybase
cs_convert() function to create the new NumericType
object. The default values for these arguments depends upon the type
being converted to NumericType.
Type | precision | scale |
IntType |
16 |
0 |
LongType |
# of digits in str() conversion |
0 |
FloatType |
CS_MAX_PREC |
12 |
StringType |
# digits before decimal point | # digits after decimal point |
NumericType |
input precision | input scale |
The values expected for the type_code argument things like;
CS_CHAR_TYPE
, CS_TINYINT_TYPE
, etc.
CS_DATAFMT
structure.
CS_IODESC
structure.
CS_LAYER
macro to the
msgnumber argument.
CS_ORIGIN
macro to the
msgnumber argument.
CS_SEVERITY
macro to the
msgnumber argument.
CS_NUMBER
macro to the
msgnumber argument.