| ctx) |
CS_CONTEXT structure
internally for conversions and calculations. You must allocate a
context via cs_ctx_alloc() and establish the internal
context using this function.
| file) |
None or an
object which has write(data) and flush() methods.
The function returns the previous debug file. The default file is
None.
Setting a debug file does not enable debug messages. To produce debug messages you need to set the debug member of a context, connection, command, etc.
[version = CS_VERSION_100]) |
result = cs_ctx_alloc(version, &ctx);
Returns a tuple containing the Sybase result code and a new instance
of the CS_CONTEXT class constructed from the ctx value
returned by cs_ctx_alloc(). None is returned as the
CS_CONTEXT object if the result code is not CS_SUCCEED.
[version = CS_VERSION_100]) |
result = cs_ctx_global(version, &ctx);
Returns a tuple containing the Sybase result code and a new instance
of the CS_CONTEXT class constructed from the ctx value
returned by cs_ctx_global(). None is returned as the
CS_CONTEXT object if the result code is not CS_SUCCEED.
| obj) |
For all types of obj other than CS_DATAFMT a buffer will be initialised which contains a single value.
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)
obj [, precision = -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 |
obj [, type = CS_MONEY_TYPE]) |
The obj argument can accept any of the following types;
IntType, LongType, FloatType, StringType,
or MoneyType.
Passing CS_MONEY4_TYPE in the type argument will create a
smallmoney value instead of the default money.
str [, type = CS_DATETIME_TYPE]) |
The str argument must be a string.
Passing CS_DATETIME4_TYPE in the type argument will
create a smalldatetime value instead of the default
datetime.
| type_code) |
The values expected for the type_code argument things like;
CS_CHAR_TYPE, CS_TINYINT_TYPE, etc.
| ) |
CS_DATAFMT structure.
| ) |
CS_IODESC structure.
| msgnumber) |
CS_LAYER macro to the
msgnumber argument.
| msgnumber) |
CS_ORIGIN macro to the
msgnumber argument.
| msgnumber) |
CS_SEVERITY macro to the
msgnumber argument.
| msgnumber) |
CS_NUMBER macro to the
msgnumber argument.