Professional Web Applications Themes

Factoring Enum Out of Code - MySQL

I am writing a batch file to create some tables. Two or more of these tables have a field called category which should be an ENUM. As its a big ENUM, say 100 entries, I dont like to reproduce its definition twice. Is there any preprocessing syntax that can be used to improve the code? Have: CREATE TABLE t1 ( category ENUM ( ... ), .... ) CREATE TABLE t2 ( category ENUM ( ... ), .... ) Conceptually I want: CATEGORY_ENUM = ENUM (...) CREATE TABLE t1 ( category CATEGORY_ENUM, .... ) CREATE TABLE t2 ( category CATEGORY_ENUM, .... ...

  1. #1

    Default Factoring Enum Out of Code

    I am writing a batch file to create some tables. Two or more of these
    tables have a field called category which should be an ENUM. As its a
    big ENUM, say 100 entries, I dont like to reproduce its definition
    twice. Is there any preprocessing syntax that can be used to improve
    the code?

    Have:

    CREATE TABLE t1 (
    category ENUM ( ... ),
    ....
    )

    CREATE TABLE t2 (
    category ENUM ( ... ),
    ....
    )

    Conceptually I want:

    CATEGORY_ENUM = ENUM (...)

    CREATE TABLE t1 (
    category CATEGORY_ENUM,
    ....
    )

    CREATE TABLE t2 (
    category CATEGORY_ENUM,
    ....
    )

    pietromas@gmail.com Guest

  2. #2

    Default Re: Factoring Enum Out of Code

    On 24 May, 10:47, com wrote: 

    With that size of ENUM firld, I would be looking at a separate
    Category table instead.

    Captain Guest

  3. #3

    Default Re: Factoring Enum Out of Code

    On May 24, 11:01 am, Captain Paralytic <com> wrote: 







    >
    > With that size of ENUM firld, I would be looking at a separate
    > Category table instead.[/ref]

    Thats a helpful suggestion thanks, but for arguments sake is what I
    originally asked about possible in any way?

    pietromas@gmail.com Guest

  4. #4

    Default Re: Factoring Enum Out of Code

    com wrote: 
    >> With that size of ENUM firld, I would be looking at a separate
    >> Category table instead.[/ref]
    >
    > Thats a helpful suggestion thanks, but for arguments sake is what I
    > originally asked about possible in any way?
    >[/ref]

    No.

    But any halfway decent text editor will allow you to copy/paste.

    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    net
    ==================
    Jerry Guest

Similar Threads

  1. Enum Problems
    By Oldman in forum ASP.NET Web Services
    Replies: 3
    Last Post: July 4th, 10:29 AM
  2. enum like C/C++
    By Roee Bachar in forum Macromedia Flash
    Replies: 1
    Last Post: November 29th, 09:50 PM
  3. enum serialization
    By eran in forum ASP.NET Web Services
    Replies: 2
    Last Post: September 21st, 08:13 PM
  4. Simulating VB Enum
    By Douglas Harter in forum PERL Beginners
    Replies: 3
    Last Post: August 28th, 12:38 AM
  5. factoring out a query result to reuse it in a loop
    By lindawie in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: June 30th, 10:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139