mSQL client class.
Msql#close
-
Close the connection with the connected server.
- Exceptions:
-
Msql#connect([host], [database_name])
-
See Msql.connect.
- Exceptions:
-
Msql#copy_db(src_db, dest_db)
-
Copy a database from the src_db to the dest_db.
This is administrator operation.
- Exceptions:
-
Msql#create_db(db_name)
-
Create new database named db_name.
This is administrator operation.
- Exceptions:
-
Msql#drop_db(db_name)
-
Delete database named db_name completely.
This is administrator operation.
- Exceptions:
-
Msql#database
-
Get selected database name (same as specified in Msql.connect or
Msql#connect or Msql#select_db).
- Returns:
-
Msql#get_host
-
Get connected host name (same as specified in Msql.connect or Msql#connect).
- Returns:
-
Msql#get_host_info
-
Get connected host name and connection protocol name.
- Returns:
-
Msql#get_sequence_info
-
Get information of sequence.
- Returns:
-
Msql#get_server_stats
-
Get states of the connected server (for console ouput).
Output config file name, max connections, current connections, server running as user and connection table.
Msql#get_server_info
-
Get version of the connected mSQL server.
- Returns:
-
Msql#list_dbs
-
Get all database names on the connected server.
- Returns:
-
- Exceptions:
-
Msql#list_fields(table_name)
-
Get all filed names on the table specified the table_name.
- Returns:
-
- Exceptions:
-
Msql#list_index(table_name, index)
-
Get information of the index on the table specified the table_name.
- Returns:
-
- Exceptions:
-
Msql#list_tables
-
Get all table names on the connected server.
- Returns:
-
- Exceptions:
-
Msql#move_db(src_db, dest_db)
-
Move a database from the src_db to the dest_db.
This is administrator operation.
- Exceptions:
-
Msql#query(query)
-
Execute query.
Must do Msql#select_db before this operaion.
- Returns:
-
- Exceptions:
-
Msql#reload_acls
-
Reload ACL(Access Control List) file.
This is administrator operation.
- Exceptions:
-
Msql#select_db(db_name)
-
Select database on the connected server.
Must do this before Msql#query.
- Exceptions:
-
Msql#shutdown
-
Shutdown connected server.
This is administrator operation.
- Exceptions:
-
Msql#store_result
Msql#get_result
-
Get query results (SELECT statement).
Must do Msql#query before this operaion.
And must do this operaion before execute next Msql#query.
- Returns:
-
- Exceptions:
-
mSQL query result class.
MsqlResult#data_seek(pos)
-
Set cursor at pos.
MsqlResult#fetch_row fetch a row at a position of the cursor.
MsqlResult#each_field {|field|...}
-
Iterated access to each filed.
(notice: start at cursor position)
MsqlResult#each_field_with_index {|field, index|...}
-
Iterated access to each filed with index number.
(notice: start at cursor position)
MsqlResult#each_row {|row|...}
-
Iterated access to each row.
(notice: start at cursor position)
MsqlResult#each_row_with_index {|row, index|...}
-
Iterated access to each row with index number.
(notice: start at cursor position)
MsqlResult#fetch_all_fields
-
Get all fields.
(notice: range of fields is from the cursor position to the end)
- Returns:
-
MsqlResult#fetch_all_rows
-
Get all rows.
(notice: range of rows is from the cursor position to the end)
- Returns:
-
MsqlResult#fetch_field
-
Fetch one field from the result.
- Returns:
-
MsqlField: information of the field.
ex. As if a MsqlResult instance has a result such as
+---------------------+-----------+
| name | genre |
+---------------------+-----------+
| Anthony & Cleopatra | Tragedies |
| Corilanus | Tragedies |
| Hamlet | Tragedies |
| Julius Caesar | Tragedies |
| King Lear | Tragedies |
+---------------------+-----------+
then fetch_field returns field object of 'name'
and the cursor move to the next 'genre' field
(next fetch_field return this field).
nil: no more fileds.
MsqlResult#fetch_hash
-
Fetch one row as hash from the result.
- Returns:
-
Hash: key is field name and value is element.
ex. As if a MsqlResult instance has a result such as
+---------------------+-----------+
| name | genre |
+---------------------+-----------+
| Anthony & Cleopatra | Tragedies |
| Corilanus | Tragedies |
| Hamlet | Tragedies |
| Julius Caesar | Tragedies |
| King Lear | Tragedies |
+---------------------+-----------+
then fetch_hash returns
{"name"=>"Anthony & Cleopatra", "genre"=>"Tragedies"}
and the cursor move to the next row.
nil: no more rows.
MsqlResult#fetch_row
-
Fetch one row from the result.
- Returns:
-
Array: array of (String) elements of each fields.
ex. As if a MsqlResult instance has a result such as
+---------------------+-----------+
| name | genre |
+---------------------+-----------+
| Anthony & Cleopatra | Tragedies |
| Corilanus | Tragedies |
| Hamlet | Tragedies |
| Julius Caesar | Tragedies |
| King Lear | Tragedies |
+---------------------+-----------+
then fetch_row returns
["Anthony & Cleopatra", "Tragedies"]
and the cursor move to the next row:
["Corilanus", "Tragedies"](next fetch_row return this row).
nil: no more rows.
MsqlResult#field_seek(pos)
-
Set cursor at pos.
MsqlResult#fetch_field fetch a field at a position of the cursor.
MsqlResult#num_fields
-
Get number of fields of the results.
- Returns:
-
MsqlResult#num_rows
-
Get number of rows of the results.
- Returns:
-
mSQL field has a information of column.
Sequence information.