This topic is locked

PHPR 5.2b - Too clever with Fieldnames

12/23/2009 5:43:43 AM
PHPRunner General questions
K
KevinMillican author

Build 4044 / ODBC
Several tables in an existing database fail the SQL query, partly because PHPrunner 5.2b tries to be too clever creating aliases for existing fieldnames, see this screenshot :-

J
Jane 12/23/2009

Kevin,
what database do you use? Could you post whole SQL query here?

K
KevinMillican author 12/23/2009



Kevin,
what database do you use? Could you post whole SQL query here?


This is Paradox 7 Developer's Edition using the Intersolv ODBC driver supplied with it.
If tick the box on the PMI table, this is the SQL query PHPR tries to use by default :-
SELECT

uid,

Test AS Date,

Test AS Time,

SNo,

Time AS Time1,

Reading AS No,

Type,

Duration,

Units,

Sequence,

Contract AS No1,

DrawingR,

SpoolR,

TypeR,

ItemR,

CommentR,

NotesR,

Drawing AS No2,

Spool,

Comp AS Type1,

Item AS No3,

Comment,

Notes,

Operator,

Alloy,

Alloy1,

Alloy2,

Expected,

Accept,

Flags,

Sb,

Sb AS Error,

Sn,

Sn AS Error1,

Pd,

Pd AS Error2,

Ag,

Ag AS Error3,

Al,

Al AS Error4,

Mo,

Mo AS Error5,

Nb,

Nb AS Error6,

Zr,

Zr AS Error7,

Bi,

Bi AS Error8,

Pb,

Pb AS Error9,

Se,

Se AS Error10,

W,

W AS Error11,

Zn,

Zn AS Error12,

Cu,

Cu AS Error13,

Ni,

Ni AS Error14,

Co,

Co AS Error15,

Fe,

Fe AS Error16,

Mn,

Mn AS Error17,

Cr,

Cr AS Error18,

V,

V AS Error19,

Ti,

Ti AS Error20,

Recovered,

Contract

FROM PMI
If I use a routine developed to export my table to MySQL, the actual layout is like this :-
-- Paradox MySQL Export
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--

-- Table structure for table pmi

--
CREATE TABLE IF NOT EXISTS pmi (

uid int unsigned NOT NULL auto_increment,

Test Date date default NULL,

Test Time time default NULL,

SNo varchar(12) default NULL,

Time varchar(20) default NULL,

Reading No int default NULL,

Type varchar(10) default NULL,

Duration double default NULL,

Units varchar(4) default NULL,

Sequence varchar(10) default NULL,

Contract No varchar(20) default NULL,

DrawingR varchar(20) default NULL,

SpoolR varchar(10) default NULL,

TypeR varchar(20) default NULL,

ItemR varchar(20) default NULL,

CommentR varchar(40) default NULL,

NotesR mediumtext default NULL,

Drawing No varchar(20) default NULL,

Spool varchar(5) default NULL,

Comp Type varchar(20) default NULL,

Item No varchar(10) default NULL,

Comment varchar(20) default NULL,

Notes varchar(40) default NULL,

Operator varchar(20) default NULL,

Alloy varchar(20) default NULL,

Alloy1 varchar(60) default NULL,

Alloy2 varchar(60) default NULL,

Expected varchar(20) default NULL,

Accept varchar(2) default NULL,

Flags varchar(10) default NULL,

Sb double default NULL,

Sb Error double default NULL,

Sn double default NULL,

Sn Error double default NULL,

Pd double default NULL,

Pd Error double default NULL,

Ag double default NULL,

Ag Error double default NULL,

Al double default NULL,

Al Error double default NULL,

Mo double default NULL,

Mo Error double default NULL,

Nb double default NULL,

Nb Error double default NULL,

Zr double default NULL,

Zr Error double default NULL,

Bi double default NULL,

Bi Error double default NULL,

Pb double default NULL,

Pb Error double default NULL,

Se double default NULL,

Se Error double default NULL,

W double default NULL,

W Error double default NULL,

Zn double default NULL,

Zn Error double default NULL,

Cu double default NULL,

Cu Error double default NULL,

Ni double default NULL,

Ni Error double default NULL,

Co double default NULL,

Co Error double default NULL,

Fe double default NULL,

Fe Error double default NULL,

Mn double default NULL,

Mn Error double default NULL,

Cr double default NULL,

Cr Error double default NULL,

V double default NULL,

V Error double default NULL,

Ti double default NULL,

Ti Error double default NULL,

Recovered varchar(1) default NULL,

Contract varchar(10) default NULL,

PRIMARY KEY (uid)

) ENGINE=MyISAM DEFAULT CHARSET=latin1;
As you can see, all fields with a space character are being corrupted.

J
Jane 12/24/2009

Kevin,
thank you for pointing me to this bug.

We'll investigate it.

K
KevinMillican author 1/1/2010



Kevin,
thank you for pointing me to this bug.

We'll investigate it.


Just by way of a followup, if I manually correct all the fields in the SQL query, I can get a working PHPR application. However, if I then save the application and reopen it in PHPR build 4168, it corrupts the query even if I don't touch it.

Sergey Kornilov admin 1/1/2010

There seems to be an issue with field names and aliases:

Test AS Time,

SNo,

Time AS Time1,


As a first step make sure you do not choose aliases that are same as real field names.

Also I would not use reserved words as field names and aliases (time, date etc).
Also its not clear what are actual fields names. I.e. field appears as 'Test' in your query while in MySQL export it appears as 'Test Date'.

K
KevinMillican author 1/5/2010



There seems to be an issue with field names and aliases:

Test AS Time,

SNo,

Time AS Time1,


As a first step make sure you do not choose aliases that are same as real field names.

Also I would not use reserved words as field names and aliases (time, date etc).
Also its not clear what are actual fields names. I.e. field appears as 'Test' in your query while in MySQL export it appears as 'Test Date'.


The MySQL export from Paradox is an accurate representation of the original table.

PHPrunner is creating aliases that I don't want.
The field in my table named 'Test Timeis being interpreted by PHPrunner as a field calledTestand it is adding the alias;Time
The field in my table called
Timeis being aliased by PHPrunner asTime1presumably so that it doesn't clash with the alias it has incorrectly created two lines before.

A correct interpretation of the ODBC table would be :-

SELECT
uid,
Test Date,
Test Time,
SNo,
Time,
Reading No,
Type,
Duration,
Units,
Sequence,
Contract No,
DrawingR,
SpoolR,
TypeR,
ItemR,
CommentR,
NotesR,
Drawing No,
Spool,
Comp Type,
Item No,
Comment,
Notes,
Operator,
Alloy,
Alloy1,
Alloy2,
Expected,
Accept,
Flags,
Sb,
Sb Error,
Sn,
Sn Error,
Pd,
Pd Error,
Ag,
Ag Error,
Al,
Al Error,
Mo,
Mo Error,
Nb,
Nb Error,
Zr,
Zr Error,
Bi,
Bi Error,
Pb,
Pb Error,
Se,
Se Error,
W,
W Error,
Zn,
Zn Error,
Cu,
Cu Error,
Ni,
Ni Error,
Co,
Co Error,
Fe,
Fe Error,
Mn,
Mn Error,
Cr,
Cr Error,
V,
V Error,
Ti,
Ti Error`,

Recovered,

Contract

FROM PMI
I notice that if I correct this query manually as above, the PMI_settings.php file begins like this :-
// field labels

$fieldLabelsPMI = array();

$fieldLabelsPMI["English"]=array();

$fieldLabelsPMI["English"]["uid"] = "Uid";

$fieldLabelsPMI["English"]["Test_Date"] = "Test Date";

$fieldLabelsPMI["English"]["Test_Time"] = "Test Time";

$fieldLabelsPMI["English"]["SNo"] = "SNo";

$fieldLabelsPMI["English"]["Time"] = "Time";

$fieldLabelsPMI["English"]["ReadingNo"] = "Reading No";

$fieldLabelsPMI["English"]["Type"] = "Type";

$fieldLabelsPMI["English"]["Duration"] = "Duration";

$fieldLabelsPMI["English"]["Units"] = "Units";

....
Is the underscore "
" character being generated by PHPR too? - this isn't used in the actual table unless it's hidden from view in some way.

Sergey Kornilov admin 1/5/2010

Kevin,
I see what you saying now.
Please open a ticket at http://support.xlinesoft.com sending your Paradox database and PHPRunner project file for investigation.

K
KevinMillican author 1/7/2010



Please open a ticket at http://support.xlinesoft.com sending your Paradox database and PHPRunner project file for investigation.


Ticket 197811 opened
Thanks