26368b16a37d3845623054270770df7e905c32f1 kent Fri Apr 19 10:06:02 2013 -0700 Adding index and auto keywords to autoSql columns. diff --git src/inc/asParse.h src/inc/asParse.h index 6616884..664a6f9 100644 --- src/inc/asParse.h +++ src/inc/asParse.h @@ -41,46 +41,56 @@ struct asTypeInfo { enum asTypes type; /* Numeric ID of low level type. */ char *name; /* Text ID of low level type. */ bool isUnsigned; /* True if an unsigned int of some type. */ bool stringy; /* True if a string or blob. */ char *sqlName; /* SQL type name. */ char *cName; /* C type name. */ char *listyName; /* What functions that load a list are called. */ char *nummyName; /* What functions that load a number are called. */ char *outFormat; /* Output format for printf. %d, %u, etc. */ char *djangoName; /* Django type name */ }; +struct asIndex +/* Information about an index */ + { + struct asIndex *next; /* In case it needs to be on a list. */ + char *type; /* 'primary' 'index' or 'uniq' to pass to SQL */ + int size; /* If nonzero only index prefix of this many chars. */ + }; + struct asColumn /* Info on one column/field */ { struct asColumn *next; /* Next column. */ char *name; /* Column name. */ char *comment; /* Comment string on column. */ struct asTypeInfo *lowType; /* Root type info. */ char *obName; /* Name of object or table. */ struct asObject *obType; /* Name of composite object. */ int fixedSize; /* 0 if not fixed size, otherwise size of list. */ char *linkedSizeName; /* Points to variable that holds size of list. */ struct asColumn *linkedSize; /* Column for linked size. */ bool isSizeLink; /* Flag to tell if have read link. */ bool isList; /* TRUE if a list. */ bool isArray; /* TRUE if an array. */ + bool autoIncrement; /* TRUE if we want to auto_increment this field. */ struct slName *values; /* values for symbolic types */ + struct asIndex *index; /* Possibly null index description. */ }; struct asObject /* Info on whole asObject. */ { struct asObject *next; char *name; /* Name of object. */ char *comment; /* Comment describing object. */ struct asColumn *columnList; /* List of columns. */ bool isTable; /* True if a table. */ bool isSimple; /* True if a simple object. */ }; struct dyString *asColumnToSqlType(struct asColumn *col); /* Convert column to a sql type spec in returned dyString */