Switch to: V9V8V7V6V5

Valentina for Ruby Reference

This is a list of Valentina-specific calls in Ruby, including example code for each call, including a description, return value and examples.

Valentina class

Class constants

List of constants – Description of Valentina class constants.

Class methods

cacheSize() – Returns the cache size.

connect(), real_connect(), new() – Connects to a Valentina Server and returns a Valentina object.

debugLevel() – Returns the debug level.

escape_string(), quote() – Quotes a string for SQL query.

get_client_info(), client_info() – Returns the client version information.

init() – Returns Valentina object. It not connects to a Valentina Server.

version() – Returns the Valentina kernel version as number.

Object methods

affected_rows() – Get number of affected rows in previous V4Ruby operation.

cacheSize() – Return cache size.

client_encoding() – Return the name of the character set.

close() – Close connection.

connect(), real_connect() – Open a connection to a Valentina Server. Same as Valentina.real_connect().

create_db() – Create database.

db_query() –- Run Valentina Server query implicitly telling to what database.

errno() – Return error number.

error() – Return error message.

escape_string(), quote() – Escapes a string for use in a query.

insert_id() – Get the ID generated from the previous INSERT operation.

ping() – Ping a server connection.

query(), real_query() - Send Valentina query and store result. Return Valentina::Result object.

select_db() – Select Valentina Server database.

Valentina::Result class

Object methods

data_seek() – Move internal result pointer.

fetch_field() – Get column information from a result and return as an object.

fetch_fields() – Return array of Valentina::Field object's.

fetch_hash() – Return row as Hash.

fetch_lengths() – Get the length of each output in a result.

fetch_row() – Return row as Array.

field_seek() – Set result pointer to a specified field offset.

free() – Free memory of result table.

num_fields() – Get number of fields in result.

num_rows() – Get number of rows in result.

Iterator

each() {[x] …} – 'x' is array of column values.

each_hash() {[x] …} – 'x' is hash of column values, and the keys are the column names.

Valentina::Field class

Object variables (read only)

blob – Blob field.

def – Default value.

flags – Field flag.

max_length – Maximum field length.

multiple_key – Multiple key.

name – Field name.

not_null – Not null.

num – Numeric.

pri_key – Primary key.

table – Table name.

type – Field type.

unique_key – Unique key.

unsigned – Unsigned.

zerofill – Zerofill.

Object methods

hash() – Return field as Hash. obj.name == obj.hash['name']

ValentinaError class

Object methods

errno() – Return error number.

error() – Return error message.