Loading ...
Sorry, an error occurred while loading the content.

MySQL verb improvments

Expand Messages
  • creecode
    Hello all, After diving into the MySQL example connection script and getting a crash when I didn t have the right user/password combo I m thinking we should
    Message 1 of 3 , Jul 2 2:38 PM
    • 0 Attachment
      Hello all,

      After diving into the MySQL example connection script and getting a
      crash when I didn't have the right user/password combo I'm thinking we
      should make the following improvement. A little background. The
      crash didn't occur in the connect verb but in the getErrorMessage
      verb. The crash happened because the database connection ID was nil.
      Now of course I could check the id myself and deal with a nil value
      but I think we should strive to make the verbs more robust.

      For every verb that takes a database connection ID we could add this
      check...

      if ( dbid == NULL ) {

      langerrormessage ( "\pInvalid MySQL database connection ID." );

      return ( false );

      }

      I'm also thinking we should tune the error messages to use language
      that is more like what the user will encounter when reading docs about
      the verbs. For example. Use database connection ID instead of
      connection object.

      I don't think we need to rush on this but would be good to address soon.

      Toodle-looooooooooooo
      creecode
    • David Gewirtz
      Thomas, that seems perfectly reasonable. We want to do stepwise improvement on this stuff, now that we have basic functionality. Sorry about being offline this
      Message 2 of 3 , Jul 7 6:46 PM
      • 0 Attachment
        Thomas, that seems perfectly reasonable. We want to do stepwise
        improvement on this stuff, now that we have basic functionality.

        Sorry about being offline this week... had a bit of a thing to deal
        with. I'm back.

        -- David

        --- In frontierkernel@yahoogroups.com, "creecode" <creecode@...> wrote:
        >
        > Hello all,
        >
        > After diving into the MySQL example connection script and getting a
        > crash when I didn't have the right user/password combo I'm thinking we
        > should make the following improvement. A little background. The
        > crash didn't occur in the connect verb but in the getErrorMessage
        > verb. The crash happened because the database connection ID was nil.
        > Now of course I could check the id myself and deal with a nil value
        > but I think we should strive to make the verbs more robust.
        >
        > For every verb that takes a database connection ID we could add this
        > check...
        >
        > if ( dbid == NULL ) {
        >
        > langerrormessage ( "\pInvalid MySQL database connection ID." );
        >
        > return ( false );
        >
        > }
        >
        > I'm also thinking we should tune the error messages to use language
        > that is more like what the user will encounter when reading docs about
        > the verbs. For example. Use database connection ID instead of
        > connection object.
        >
        > I don't think we need to rush on this but would be good to address soon.
        >
        > Toodle-looooooooooooo
        > creecode
        >
      • creecode
        One more improvement I d like to throw in with the dbid NULL check. For the mysqlgetrowverb function I d like to add the following after... if ( ! setheapvalue
        Message 3 of 3 , Jul 9 5:27 PM
        • 0 Attachment
          One more improvement I'd like to throw in with the dbid NULL check.

          For the mysqlgetrowverb function I'd like to add the following after...

          if ( ! setheapvalue ( h, stringvaluetype, &val ) ) // convert handle
          to value
          goto error;

          bundle { // coerce certain numeric MYSQL_TYPE_ to kernel number types

          tyvaluetype type;

          switch ( field -> type ) {

          case MYSQL_TYPE_LONG:
          case MYSQL_TYPE_LONGLONG:

          type = doublevaluetype;

          break;

          case MYSQL_TYPE_INT24:
          case MYSQL_TYPE_SHORT:

          type = longvaluetype;

          break;

          case MYSQL_TYPE_TINY:

          type = intvaluetype;

          break;

          default:

          type = NULL;

          } // switch

          if ( type != NULL )
          if ( ! coercevalue ( &val, type ) )
          goto error;

          } // bundle

          This is by no means a comprehensive conversion of mysql numeric types
          to kernel numeric types. If you can convert additional types, go for it!

          I found these pages useful when trying to suss out the conversions...

          http://dev.mysql.com/doc/refman/5.0/en/c-api-datatypes.html

          http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

          http://www.scripting.com/frontier/manual/chapter04.html

          http://pages.sbcglobal.net/mattneub/frontierDef/ch10.html

          Toodle-loooooooooo.......
          creecode
        Your message has been successfully submitted and would be delivered to recipients shortly.