sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Ruby MySQL module in Sketchup

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 332 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      Pauline01
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • daikuD Offline
        daiku
        last edited by

        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

        Clark Bremer
        http://www.northernlightstimberframing.com

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement