Class: Teradata::SuccessStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/teradata/connection.rb

Constant Summary collapse

ACTIVITY_ECHO =
33

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stmt_no, act_cnt, warn_code, n_fields, act_type, warning) ⇒ SuccessStatus

Returns a new instance of SuccessStatus.



451
452
453
454
455
456
457
458
# File 'lib/teradata/connection.rb', line 451

def initialize(stmt_no, act_cnt, warn_code, n_fields, act_type, warning)
  @statement_no = stmt_no
  @activity_count = act_cnt
  @warning_code = warn_code
  @num_fields = n_fields
  @activity_type = act_type
  @warning = warning
end

Instance Attribute Details

#acitivity_typeObject (readonly)

Returns the value of attribute acitivity_type.



462
463
464
# File 'lib/teradata/connection.rb', line 462

def acitivity_type
  @acitivity_type
end

#activity_countObject (readonly)

Returns the value of attribute activity_count.



461
462
463
# File 'lib/teradata/connection.rb', line 461

def activity_count
  @activity_count
end

#n_fieldsObject (readonly)

Returns the value of attribute n_fields.



463
464
465
# File 'lib/teradata/connection.rb', line 463

def n_fields
  @n_fields
end

#statement_noObject (readonly)

Returns the value of attribute statement_no.



460
461
462
# File 'lib/teradata/connection.rb', line 460

def statement_no
  @statement_no
end

#warningObject (readonly)

Returns the value of attribute warning.



465
466
467
# File 'lib/teradata/connection.rb', line 465

def warning
  @warning
end

#warning_codeObject (readonly)

Returns the value of attribute warning_code.



464
465
466
# File 'lib/teradata/connection.rb', line 464

def warning_code
  @warning_code
end

Class Method Details

.parse(parcel_data) ⇒ Object



445
446
447
448
449
# File 'lib/teradata/connection.rb', line 445

def SuccessStatus.parse(parcel_data)
  stmt_no, _, act_cnt, warn_code, n_fields, act_type, warn_len  = parcel_data.unpack('CCLSSSS')
  warning = parcel_data[13, warn_len]
  new(stmt_no, act_cnt, warn_code, n_fields, act_type, warning)
end

Instance Method Details

#echo?Boolean

Returns:

  • (Boolean)


504
505
506
# File 'lib/teradata/connection.rb', line 504

def echo?
  @activity_type == ACTIVITY_ECHO
end

#error?Boolean

Returns:

  • (Boolean)


491
492
493
# File 'lib/teradata/connection.rb', line 491

def error?
  false
end

#error_codeObject



471
472
473
# File 'lib/teradata/connection.rb', line 471

def error_code
  0
end

#failure?Boolean

Returns:

  • (Boolean)


487
488
489
# File 'lib/teradata/connection.rb', line 487

def failure?
  false
end

#infoObject



475
476
477
# File 'lib/teradata/connection.rb', line 475

def info
  nil
end

#inspectObject



467
468
469
# File 'lib/teradata/connection.rb', line 467

def inspect
  "\#<Success \##{@statement_no} cnt=#{@activity_count}>"
end

#messageObject



479
480
481
# File 'lib/teradata/connection.rb', line 479

def message
  ''
end

#succeeded?Boolean

Returns:

  • (Boolean)


483
484
485
# File 'lib/teradata/connection.rb', line 483

def succeeded?
  true
end

#valueObject



495
496
# File 'lib/teradata/connection.rb', line 495

def value
end

#warned?Boolean

Returns:

  • (Boolean)


498
499
500
# File 'lib/teradata/connection.rb', line 498

def warned?
  @warning_code != 0
end