C++Builder6 enum

From: Charl Roux <charl(dot)roux(at)hotmail(dot)com>
To: Postgre-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: C++Builder6 enum
Date: 2013-03-15 11:06:26
Message-ID: DUB103-W5ACD143501DF0F1164ADE85ED0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi,

I am using C++Builder6 on WinXPSP3, with Devart's dbExpress driver. I declared a enumeration type called 'professionEnum', which is used by my variable 'profession'. I get an error: 'Cannot access field 'rootcause' as type Text', if I try and enter a value into the enum field.

1. I create the table as follows:
CREATE TABLE IF NOT EXISTS
status(
statusCode BIGINT PRIMARY KEY,
description VARCHAR(50),
level SMALLINT,
rootCause rootCauseEnum,
material VARCHAR(100),
actionTaken VARCHAR(50)
)

2. I add an enum type 'rootCauseEnum' as follows:
AnsiString SQL;

SQL = "CREATE TYPE ";
SQL = SQL + edtEnumerationType->Text; // My entry: rootCauseEnum
SQL = SQL + " AS ENUM ( ";
SQL = SQL + edtEnumerationList->Text; // My entry: 'none','unknown','elec','oil'
SQL = SQL + " )";

int errorCode = frmDataModule->eyeConnection->ExecuteDirect(SQL);

3. I add a record to the status table from the command prompt which works fine as follows:
eye=# INSERT INTO status VALUES( 100002, 'Running', 0, 'none', 'Not applicable', 'NA');

4.I add a record to the status table from C++Builder as follows:
I have an edit box for every field, as I enter the following all is fine:
statusCode=100003
description=Stopped
level=0
As I enter any of the following into the rootCause field:
rootCause=none
rootCause=1
I get the following error:
Cannot access field 'rootcause' as type Text.
Therefore before I apply the updates to the table, i get the error.

The field 'rootCause' is indicated as (Memo) in run-time.

This worked fine when I used MySQL. With MySQL I can enter
rootCause=none
or

rootCause=1

Thanks.

Charl

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2013-03-15 11:16:57 unexpected lock waits (was Re: Do not understand why this happens)
Previous Message Devrim Gündüz 2013-03-15 03:04:13 Re: Fedora 18 x86_64 repodata/repomd.xml: [Errno 14] curl#22 - "The requested URL returned error: 404 Not Found" on PostgreSQL 9.2