SybConnection class

index

# SybConnection

SybConnection implements CS_CONNECTION structure of SyBase Client Library.

### Class Method

new ( ctx )
  Creates a SybConnection object anew.
  (This method corresponds to ct_con_alloc of Sybase Client Library.)

  Parameters

    ctx --- SybContext object

open ( server, user, passwd=nil, appname=nil, hostname=nil )
  Creates a SybConnection object anew, and connects to a server

  If error has occurred, then it raise a RuntimeError exception.

  Parameters

  - server
    The name of the server to connect to.
  - user
    The name used to log into the server.
  - passwd
    The password used to log into the server.
  - appname
    The application name.
  - hostname
    The host machine name

### Methods

connect ( server, user, passwd=nil, appname=nil)
  Connects to a server
  (This method corresponds to ct_connect of Sybase Client Library.)

  If error has occurred, then it raise a RuntimeError exception.

  Parameters

  - server
    The name of the server to connect to.
  - user
    The name used to log into the server.
  - passwd
    The password used to log into the server.
  - appname
    The application name.

close ( force=false )
  Close a server connection
  (This method corresponds to ct_close of Sybase Client Library.)

  If the force parameter is true, the connection is closed whether or not results are pending, and without notifying the server.

  Returns TRUE if it was successful, FALSE otherwise.

delete ( force=false )
  Close a server connection if it is existing, and deallocates the connection object

  If the force parameter is TRUE, the connection is closed whether or not results are pending, and without notifying the server.

  Returns TRUE if it was deleted successfully.

setprop ( proptype, val )
  Sets Client-Library properties at the connection structure levels.
  This method corresponds to ct_con_props(CS_SET) of Sybase Client Library.

  The proptype parameter must be a constant that is defined in SybConstant module.

  Returns TRUE if it was successful

getprop ( proptype)
  Retrieves Client-Library properties at the connection structure levels.
  This method corresponds to ct_con_props(CS_GET) of Sybase Client Library.

  The proptype parameter must be a constant that is defined in SybConstant module.

setopt ( option, val)
  Sets the value of server options.
  This method corresponds to ct_options(CS_SET) of Sybase Client Library.

  The option parameter must be a constant that is defined in SybConstant module.

  Returns TRUE if it was successful.

getopt ( option )
  Retrieves the value of server options.
  This method corresponds to ct_options(CS_GET) of Sybase Client Library.

  The option parameter must be a constant that is defined in SybConstant module.