Error status number -30038. - MySQL Database
Horacio Villanueva <[email protected]>
| Newsgroups | gmane.comp.lang.4gl.aubit.general |
|---|---|
| Message-ID | <CA+-DnDGeACQJtC9Hkhs1WJ19W46rFAVT22xWjzBn+VJ79A_=3w@mail.gmail.com> |
Hi Guys,
I have a problem to query a MySQL table and Fill data on a Form
(Same code on Informix works greats...)
The error is:
Err:Program ./Menu stopped at 'query_cust1.4gl', line number 61.
Error status number -30038.
Field name not found.
4gl function call stack :
customer.4gl (Line 13) calls query_cust1()
MAIN
Environment:
export AUBITDIR=/opt/aubit4gl
export AUBITDIR_SRC=/opt/aubit4glsrc
export AWK=gawk
#
export PATH=$PATH:$AUBITDIR/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AUBITDIR/lib
#
export A4GL_PRINTSCRKEY=CONTROL-P
export A4GL_PRINTSCRFILE=+$DBSCREENOUT
export ODDOPTIONS=N
#
## MySQL Connection
export LEXDIALECT=INFORMIX
export A4GL_SQLTYPE=mysql
export A4GL_LEXTYPE=C
## Database User/Password
export A4GL_SQLACL=Aubit_to_MySQL
# -EOF-
The 4gl Code:
#query_cust1.4gl
GLOBALS "globals.4gl"
########################################
FUNCTION query_cust1()
########################################
DEFINE q_cust CHAR(200),
selstmt CHAR(250),
answer CHAR(1),
found_some SMALLINT,
invalid_resp SMALLINT
WHILE TRUE
DISPLAY
" Press Accept to search for customer data, Cancel to exit w/out
searching."
AT 15,1 ATTRIBUTE (REVERSE, YELLOW)
LET int_flag = FALSE
CONSTRUCT BY NAME q_cust ON customers.customerNumber,
customers.customerName,
customers.addressLine1,
customers.addressLine2,
customers.city,
customers.state,
customers.postalCode,
customers.contactLastName,
customers.contactFirstName,
customers.phone
IF int_flag THEN
LET int_flag = FALSE
EXIT WHILE
END IF
--* User hasn't pressed Cancel, clear out selection instructions
DISPLAY
" "
AT 15, 1
--* Check to see if user has entered search criteria
IF q_cust = " 1=1" THEN
IF NOT answer_yes("Do you really want to see all customers?
(n/y):")
THEN
CONTINUE WHILE
END IF
END IF
--* Create and prepare the SELECT statement
LET selstmt = "SELECT * FROM customers WHERE ", q_cust CLIPPED
PREPARE st_selcust FROM selstmt
DECLARE c_cust CURSOR FOR st_selcust
--* Execute the SELECT statement and open the cursor to access the
rows
OPEN c_cust
--* Fetch first row. If fetch successful, rows found
LET found_some = 0
FETCH c_cust INTO gr_customer.*
IF (status = 0) THEN
LET found_some = 1
END IF
WHILE (found_some = 1)
--* Display first customer
DISPLAY BY NAME gr_customer.*
--* Fetch next customer (fetch ahead)
FETCH NEXT c_cust INTO gr_customer.*
IF (status = NOTFOUND) THEN
LET found_some = -1
EXIT WHILE
END IF
--* Ask user if going to view next row
IF NOT answer_yes("Display next customer? (n/y):") THEN
LET found_some = -2
END IF
END WHILE
--* Notify user of various "error" conditions
CASE found_some
WHEN -1
CALL msg("End of selected customers.")
WHEN 0
CALL msg("No customers match search criteria.")
WHEN -2
CALL msg("Display terminated at your request.")
END CASE
CLOSE c_cust
END WHILE
DISPLAY
" "
AT 15,1
CLEAR FORM
END FUNCTION -- query_cust1 --
The Per Form is:
DATABASE stores_demo
SCREEN
{
Customer Number : [f000 ] Customer Name : [f001 ]
Address: [f002 ]
[f003 ]
City : [f004 ] State:[f5] Zip Code:[f006 ]
Contact Name: [f007 ][f008 ]
Telephone : [f009 ]
}
TABLES
customers
ATTRIBUTES
f000 = customers.customerNumber, NOENTRY;
f001 = customers.customerName;
f002 = customers.addressLine1;
f003 = customers.addressLine2;
f004 = customers.city;
f5 = customers.state, UPSHIFT;
f006 = customers.postalCode;
f007 = customers.contactFirstName;
f008 = customers.contactLastName;
f009 = customers.phone, PICTURE = "###-###-#### XXXXX";
The Structure of the Table is:
mysql> show columns from customers;
+------------------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+-------------+------+-----+---------+-------+
| customerNumber | int(11) | NO | PRI | NULL | |
| customerName | varchar(50) | NO | | NULL | |
| contactLastName | varchar(50) | NO | | NULL | |
| contactFirstName | varchar(50) | NO | | NULL | |
| phone | varchar(50) | NO | | NULL | |
| addressLine1 | varchar(50) | NO | | NULL | |
| addressLine2 | varchar(50) | YES | | NULL | |
| city | varchar(50) | NO | | NULL | |
| state | varchar(50) | YES | | NULL | |
| postalCode | varchar(15) | YES | | NULL | |
| country | varchar(50) | NO | | NULL | |
| salesRepEmployeeNumber | int(11) | YES | | NULL | |
| creditLimit | double | YES | | NULL | |
+------------------------+-------------+------+-----+---------+-------+
Hope can you guide me to solve this.
--thanks--
--
Salu2
Un cerebro holgazán es la morada del demonio, y ese demonio se llama
Alzheimer
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Aubit4gl-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss