default_form = ap_pstrdup(p, "");
inherits_from = ap_pstrdup(p, class_name);
if( !(strlen(inherits_from) > 2) ) cou_error( cnx, "class_name shorter thar 3 chars");
corec = NULL;
while ( (strlen(default_form) == 0) && (strlen(inherits_from) > 2) )
{
__CREATE_QUERY("SELECT default_form, inherits_from FROM co_%s_meta_class WHERE class_name='%s'" , par_area, inherits_from);
__SQL_GET_RESULT
if(cor_GetTupleCount(cnx, corec) != 1)
{
cou_sendMessageX(cnx, ap_psprintf(p, "getDefaultFormByName: zla nazwa klasy bazowa: '%s' obecna: '%s'", class_name, inherits_from), CO_MSG_FORCE);
cou_setReturnValue(cnx, ap_pstrdup(p, ""), CO_STRING);
return -1;
};
default_form = cor_GetCopyOfValue(cnx, corec, 0,0);
inherits_from = cor_GetCopyOfValue(cnx, corec, 0,1);
};
cou_sendMessageX(cnx, ap_psprintf(p, "SEND_DATA: %d", cnx->send_data), CO_MSG_DEBUG);
__CREATE_JS
cou_setReturnValue(cnx, default_form, CO_STRING);