phalcon / phalcon-devtools

Phalcon Developer Tools
https://docs.phalcon.io/latest/en/devtools
Other
1.33k stars 629 forks source link

Error Phalcon DevTools Models Oracle #1274

Open verde3ro opened 5 years ago

verde3ro commented 5 years ago

I have the following problem when generating the models of an Oracle database.

phalcon create-all-models --mapcolumn --doc --force --schema=MGR_ARVYC

Phalcon DevTools (3.4.0)

ERROR: SQLSTATE[HY000]: General error: 24337 OCIStmtExecute: ORA-24337: statement handle not prepared (ext\pdo_oci\oci_statement.c:159)

I hope you can help me.

Jeckerson commented 5 years ago

@verde3ro Can you provide example models when it occurs?

verde3ro commented 5 years ago

@Jeckerson, Occurs when generating models with Phalcon DevTools or Web Tools.

2019-03-19 08_50_03-Window 2019-03-19 08_50_44-Window

Jeckerson commented 5 years ago

@verde3ro Please execute model generation per single table and provide output of SHOW CREATE TABLE of tables where it occurs.

verde3ro commented 5 years ago

@Jeckerson, Execution generation of model per single table:

Table:

CREATE TABLE "AV_USUARIO_C" 
   (    "ID" NUMBER DEFAULT NULL NOT NULL ENABLE, 
    "USUARIO" VARCHAR2(20 BYTE) DEFAULT '' NOT NULL ENABLE, 
    "PASSWORD" VARCHAR2(50 BYTE) DEFAULT '', 
    "NOMBRE" VARCHAR2(250 BYTE) DEFAULT '' NOT NULL ENABLE, 
    "CORREO" VARCHAR2(100 BYTE) DEFAULT '', 
    "ESTATUS" VARCHAR2(5 BYTE) DEFAULT 'AC' NOT NULL ENABLE, 
    "USUARIO_I" VARCHAR2(20 BYTE) DEFAULT '' NOT NULL ENABLE, 
    "FECHA_I" DATE DEFAULT SYSDATE NOT NULL ENABLE, 
    "USUARIO_U" VARCHAR2(20 BYTE), 
    "FECHA_U" DATE, 
    "CORRECTO" NUMBER(1,0) DEFAULT 0, 
    "USUARIO_EBS" VARCHAR2(20 BYTE) DEFAULT '', 
     CONSTRAINT "AV_USUARIO_PK" PRIMARY KEY ("ID"), 
     CONSTRAINT "AV_USUARIO_UX" UNIQUE ("USUARIO")
   ) ;

Configuration:

 'database' => [
        'adapter'     => 'Oracle',
        'host'        => '127.0.0.1:1521/XE',
        'username'    => 'MGR_ARVYC',
        'password'    => 'password01',
        'dbname'      => '(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))) (CONNECT_DATA=(SID=XE)))',
        'charset'     => 'utf8',
    ],

Execution:

2019-03-19 08_50_44-Window 2019-03-19 11_38_27-Window 2019-03-19 11_38_39-Window

Jeckerson commented 5 years ago

Option config hasn't been defined is related to another task. That means that your table name will be generated after #1292 will be merged.

Try to find another table that generate this error: ERROR: SQLSTATE[HY000]: General error: 24337 OCIStmtExecute: ORA-24337: statement handle not prepared (ext\pdo_oci\oci_statement.c:159)

verde3ro commented 5 years ago

I did not understand the comment:

Option config hasn't been defined is related to another task. That means that your table name will be generated after #1292 will be merged.

Any table in the schema generate the error when created the model.

ERROR: SQLSTATE[HY000]: General error: 24337 OCIStmtExecute: ORA-24337: statement handle not prepared
 (ext\pdo_oci\oci_statement.c:159)

2019-04-02 10_20_21-Error Phalcon DevTools Models Oracle · Issue #1274 · phalcon_phalcon-devtools

Jeckerson commented 5 years ago

I did not understand the comment:

You posted screenshot where error is different https://user-images.githubusercontent.com/13452905/54629138-8c121800-4a3c-11e9-87fd-f0ea4daa64d0.png

Jeckerson commented 5 years ago

So your issue is actual.

verde3ro commented 5 years ago

yes it's actual

verde3ro commented 5 years ago
ERROR: SQLSTATE[HY000]: General error: 24337 OCIStmtExecute: ORA-24337: statement handle not prepared
 (ext\pdo_oci\oci_statement.c:159)

2019-04-02 10_20_21-Error Phalcon DevTools Models Oracle · Issue #1274 · phalcon_phalcon-devtools

2019-04-02 10_58_22-Phalcon WebTools - Firefox Developer Edition

Jeckerson commented 3 years ago

Can be fixed only when Incubator DB Component is ready for Phalcon v4.

https://github.com/phalcon/incubator-db

flyingangel commented 3 years ago

Error Option namespace hasn't been defined when generating a class with constraint relation.

There's 2 typos in the file Model.php

if ($this->modelOptions->hasOption('namespace')) instead of if ($this->modelOptions->getOption('namespace'))

Devtool tag 4.0.5

Jeckerson commented 3 years ago

@flyingangel I think your issue isn't related to this one. Please create separate one.