Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 10 of 14 total |
Problem with DataType |
Wed, Feb 15 2012 8:01 AM | Permanent Link |
Colin Wood VirtualTec P/L | Hi, The code below works fine in dbisam but when I run it using an elevatedb table it compiles happily but crashes somewhere on the line containing the DataTypeToDisplayString(). Should I have changed it to something else?
Any help appreciated. Col with FieldDefs do begin for I:=0 to Count-1 do begin with TargetTable do begin Append; FieldByName('Position').AsInteger := I+1; FieldByName('FieldName').AsString := Items[I].Name; FieldByName('DataType').AsString := DataTypeToDisplayString(Items[I].DataType); FieldByName('Size').AsInteger := Items[I].Size; FieldByName('Required').AsBoolean := Items[I].Required; //FieldByName('Description').AsString := Items[I].Description; FieldByName('TableName').AsString := TargetName; Post; end; end; end; |
Wed, Feb 15 2012 7:10 PM | Permanent Link |
Colin Wood VirtualTec P/L | Forgot to mention, the error displayed is just a "Access violation at address..." error.
|
Sun, Feb 19 2012 6:42 PM | Permanent Link |
Colin Wood VirtualTec P/L | this is the code that's in the DataTypeToDisplayString function...
function DataTypeToDisplayString(DataType: TFieldType): string; var DataTypePos: Integer; begin Result:='Unknown'; with DataTypesList do begin DataTypePos:=IndexOfObject(TObject(DataType)); if (DataTypePos <> -1) then Result:=DataTypesList[DataTypePos]; end; end; |
Mon, Feb 20 2012 3:57 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Colin
Have you tried tracing into the function. An AV usually means that an object hasn't been instantiated. In this case probably DataTypesList Roy Lambert [Team Elevate] |
Tue, Feb 21 2012 8:30 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Colin,
<< Hi, The code below works fine in dbisam but when I run it using an elevatedb table it compiles happily but crashes somewhere on the line containing the DataTypeToDisplayString(). Should I have changed it to something else? >> That function is specific to DBISAM and is only intended for use with the DBISAM utilities. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Feb 21 2012 6:10 PM | Permanent Link |
Colin Wood VirtualTec P/L | <<That function is specific to DBISAM and is only intended for use with the
DBISAM utilities.>> I'm wanting to create a dictionary of fields contained within my database. Is there another way I can determine what the field type is in an elevatedb table? |
Wed, Feb 22 2012 2:51 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Colin
><<That function is specific to DBISAM and is only intended for use with the >DBISAM utilities.>> > >I'm wanting to create a dictionary of fields contained within my database. Is there another way I can determine what the field type is in an elevatedb table? I'm not sure why you want to do this. With ElevateDB there is already a dictionary of fields - its the catalog. To see what I mean go into EDBManager, select your database and then run the following sql select * from information.tablecolumns Roy Lambert [Team Elevate] |
Wed, Feb 22 2012 3:37 AM | Permanent Link |
Colin Wood VirtualTec P/L | Hi Roy,
In my app I want to include a feature where my clients can customise the text captions for the various edit fields, as well as customising Hint descriptions and the like. As part of that feature I want to tell them what type of data can be entered into each field and what the maximum field length is. I also want to be able to add a utility function for myself that looks at all the fields of various tables and ensures that I haven’t created fields that are a certain size in a table and a completely different size(or data type) in another. In the past I’ve done this by importing the table columns info into a table rather than using an external app such as the EDBManager. My problem is I can retrieve the table name, field name and size and put them into the appropriate field in a table, but I can’t seem to get the field type description, which is a necessary element of the process. Col |
Wed, Feb 22 2012 4:11 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Colin
OK you haven't made the mental leap between DBISAM and ElevateDB yet<vbg> With DBISAM the field definitions were stored in the table files (the .dat as I remember) with ElevateDB ALL (and I do mean ALL) of the database definitions are stored in the catalog. This is a separate file from the tables. Any and all of the information relating to the table definitions can now be found by querying the catalog. If you look up Information schema and Configuration database in the OLH you'll start to get an idea of what's there. Its one hell of a shift of mind set and it took me a long time to get part of the way there as it will anyone not used to operating with SQL. I used EDBManager as a method of quickly letting you see what was there. What you need to do for your app is create a query the SQL would be: select Name,Type, Length, (NOT Nullable), Description, ??? from information.tablecolumns I have no idea where TargetName will come from and then use the resultset as you do the current table. Be warned though, if you want to edit this result set you can't. You'll have to create either a temporary table or an in-memory table to do this. Roy Lambert [Team Elevate] |
Wed, Feb 22 2012 8:12 AM | Permanent Link |
Colin Wood VirtualTec P/L | <<OK you haven't made the mental leap between DBISAM and ElevateDB yet<vbg> >> Hi Roy, I thought I had, but <sigh> it seems not. Thanks for pointing me in the right direction. I appreciate the help. Col |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Thursday, May 23, 2024 at 07:54 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |