Tuesday, November 06, 2012

MySQL

  • Administration
    • Startup on OS X: sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
    • Shutdown: sudo mysqladmin shutdown
    • Listing the content of the database in XML: mysqldump -X --user=orbeon --password=orbeon orbeon orbeon_form_data | less
    • Connecting to the database from the command line as user orbeon: mysql --user=orbeon --password=orbeon orbeon
  • DDL and testing
    • Employees test database
      • Removed from the beginning of employees.sql the lines that create the employees database
      • Import with mysql --user=orbeon --password=orbeon orbeon < employees.sql
  • XML functions
    • ExtractValue(xml, '/path/to/value')
    • UpdateXML(xml, '/path/to/node', '<new-node/>')
      • Replaces <node> by <new-node> (not the content of <node>)
    • load_file('/path/to/file')
      • Need to grant file permission
        • mysql --user=root mysql
        • grant file on *.* to 'orbeon'@'localhost';
      • File needs to be in a place where MySQL can read
        • sudo -u _mysql cat /tmp/BidForm.xml
  • Issues
    • "To deep XML"
      • Bug        
      • Verified with 5.1.15
      • On the bug thread, someone had this with 5.5.9