Menu

#118 [PHP]Getting CUBRID_SCH_CROSS_REFERENCE's value will fail when passing three parameters to cubrid_schema() method

open
nobody
None
5
2012-03-10
2012-03-10
Jira Trac
No

Test Build: CUBRID 2008 R4.1 (8.4.1.1018) (64bit release build for linux_gnu)
OS: Linux 64
Description:
Passing three parameter to cubrid_schema($conn_identifier,CUBRID_SCH_CROSS_REFERENCE, $class_name) method,
Getting value will fail.
Would parameter in the fourth place be $attr_name of cubrid_schema ( resource $conn_identifier , int $schema_type [, string $class_name [, string $attr_name ]] ) method
Would't parameter in the fourth place be $class_name of cubrid_schema()

Description in [cubrid_schema()|http://www.php.net/manual/en/function.cubrid-schema.php] method
array cubrid_schema ( resource $conn_identifier , int $schema_type [, string $class_name [, string $attr_name ]] )

if passing class_name to the third and fourth place, getting value CUBRID_SCH_CROSS_REFERENCE will success.
if passing class_name to third place and passing attr_name to fourth place ,getting value of CUBRID_SCH_CROSS_REFERENCE will fail.
if passing class_name to third place and no passing value to fourth place, getting value will fail.

Wouldn't passing class_name to the fourth place's parameter.
Would parameter in fourth place be $attr_name.

Statements in CROSS_REFERENCE_test.phpt
{noformat}
$conn = cubrid_connect(localhost, 33113, demodb,dba,);
cubrid_execute($conn,drop table if EXISTS ssss;);
cubrid_execute($conn,drop table if EXISTS aaaa;);
cubrid_execute($conn,drop table if EXISTS album;);
cubrid_execute($conn,CREATE TABLE album(id CHAR(10) primary key,title VARCHAR(100), artist VARCHAR(100)););
cubrid_execute($conn,CREATE TABLE aaaa(aid CHAR(10), uid int primary key););
cubrid_execute($conn,CREATE TABLE ssss(album CHAR(10),dsk INTEGER,FOREIGN KEY (album) REFERENCES album(id), FOREIGN KEY (dsk) REFERENCES aaaa(uid)););

print(First: \n);
$schema1 = cubrid_schema($conn,CUBRID_SCH_CROSS_REFERENCE,ssss);
var_dump($schema1);

print(\nSecond: \n);
$schema2 = cubrid_schema($conn,CUBRID_SCH_CROSS_REFERENCE,ssss,'dsk');
var_dump($schema2);

print(\nThird: \n);
$schema3 = cubrid_schema($conn,CUBRID_SCH_CROSS_REFERENCE,aaaa,ssss);
var_dump($schema3);

cubrid_disconnect($conn);

{noformat}

Actual result:
{noformat}
First:
PHP Warning: Error: CAS, -1004, Invalid argument in /home/php/phpTestcases/_01_schema/CROSS_REFERENCE_test.phpt on line 12
bool(false)

Second:
array(0) {
}

Third:
array(1) {
[0]=
array(9) {
[PKTABLE_NAME]=
string(4) aaaa
.......
}
}
{noformat}

Expect result:
Would you tell the user more detail about how to using cubrid_schema() method about CUBRID_SCH_CROSS_REFERENCE schema in cubrid php website

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.