Ruby MySQL module in Sketchup
-
helloooooo!
I have a problem!
I run a script ruby with ruby console in sketchup.In this script i need to do MySQL queries, i have MySQL module in my Ruby 1.9, when i run my script with prompt ruby console (no with ruby console in sketchup), all MySQL queries are ok ( at begining i need: require "mysql" ).
How i can do to have the same things with Sketchup when I use: require "mysql"???
To test i need to run this script which require "mysql":
#############################################################
require "mysql"
begin
# connect to the MySQL server
dbh = Mysql.real_connect("localhost", "testuser", "testpass", "Motor_control")
# get server version string and display it
puts "Server version: " + dbh.get_server_info
rescue Mysql::Error => e
puts "Error code: #{e.errno}"
puts "Error message: #{e.error}"
puts "Error SQLSTATE: #{e.sqlstate}" if e.respond_to?("sqlstate")
ensure
# disconnect from server
dbh.close if dbh
end###########################################################
thx to help me
Pauline
-
Hi Pauline.
If I understand correctly, your problem is executing a "require" command from the console window? If so, here are 2 things to keep in mind:
- Specify the full path (note how in my example, the first fails, but the second works)
- Use the '/' character, not '' for the separator.
@unknownuser said:
require 'reglue.rb'
false
require 'C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/reglue.rb'
true
Advertisement