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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement