예제 #1
0
void XaLanguage::List() {

	vector<string> WhereFields={};
	vector<string> WhereValues={};
	vector<string> OrderByFields={};
	vector<string> GroupByFields={};

	string PassedLimit=HTTP.GetHttpParam("limit");
	int Limit={0};

	if (PassedLimit!="NoHttpParam") {
		Limit=FromStringToInt(PassedLimit);
	};

	string OrderBy=HTTP.GetHttpParam("order_by");
	string Status=HTTP.GetHttpParam("status");

	vector<string> ReturnedFields=ListPrepare({"XaLanguage"},"/XaLanguage/fieldset/field");

	DbResMap DbRes=XaLibSql::Select(DB_READ,"XaLanguage",{ReturnedFields},{WhereFields}, {WhereValues}, {OrderByFields},{GroupByFields},Limit);
	RESPONSE.Content=ListResponse(DbRes,ReturnedFields);	
	//Quali campi
	//
	/*
	vector<string> FieldsToRead = XaLibModel::ReadPrepare({"XaLanguage"},"/XaLanguage/fieldset/field");
	DbResMap DbRes = ReadExecute("XaLanguage",FieldsToRead,HTTP.GetHttpParam("id"));
	RESPONSE.Content= ReadResponse(DbRes,FieldsToRead);
	*/
};
예제 #2
0
파일: XaMedia.cpp 프로젝트: XAllegro/Xaas
void XaMedia::List(){
    
	string XaDomainMediaCategory_ID=HTTP.GetHttpParam("XaDomainMediaCategory_ID");
        string XaField_ID=HTTP.GetHttpParam("XaField_ID");
        string XaTable=HTTP.GetHttpParam("XaTable");

	string XPathExpr="/XaMedia/fieldset/field";
	vector<string> XmlFiles = {"XaMedia"};


	//LOAD XML FOR MODEL
	xmlDocPtr XmlDomDoc=XaLibDom::DomFromFile(AddXmlFile(XmlFiles),0);

	//GET NUMBER OF FILEDS
	int FieldsNum=XaLibDom::GetNumRowByXPathInt(XmlDomDoc,XPathExpr);

	string QryFields="SELECT R.id";
	string QryJoin="";

	for (auto i=0;i<FieldsNum;i++) {

		string j=to_string(i+1);

		if (XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+j+"]/list")=="yes") {

			if (XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+j+"]/type")=="select-single-domain") {
				string FieldName=XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+j+"]/name");
				QryFields+=",X"+j+".name AS "+FieldName;
				QryJoin+=" LEFT JOIN XaDomain X"+j+" ON X"+j+".id=R."+FieldName;
			} else if (XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+j+"]/type")=="input-text"){
				QryFields+=",R."+XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+j+"]/name");
			} else if (XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+j+"]/type")=="input-number"){
				QryFields+=",R."+XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+j+"]/name");
			} else if (XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+j+"]/type")=="select-boolean"){
				QryFields+=",R."+XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+j+"]/name");
			} else if (XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+j+"]/type")=="external-key"){
				QryFields+=",R."+XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+j+"]/name");
			}
			
			LOG.Write("INF", __FILE__, __FUNCTION__,__LINE__,"Field to retrieve for the list ->"+XaLibDom::GetElementValueByXPath(XmlDomDoc,XPathExpr+"["+ to_string(i+1) + "]/name"));
		};

	};

	QryFields+=" FROM XaMedia R";

	LOG.Write("INF", __FILE__, __FUNCTION__,__LINE__,"Query Fields ->"+QryFields);
	LOG.Write("INF", __FILE__, __FUNCTION__,__LINE__,"Query Join ->"+QryJoin);
	
	string Qry=QryFields+QryJoin;
	Qry+=" WHERE R.status=1 AND R.XaField_ID="+XaField_ID+" AND R.XaTable='"+XaTable+"' AND R.XaDomainMediaCategory_ID="+XaDomainMediaCategory_ID;

	LOG.Write("INF", __FILE__, __FUNCTION__,__LINE__,"Query ->"+Qry);

    DbResMap DbRes=XaLibSql::FreeQuerySelect(DB_READ,Qry);

	vector<string> ListFields=ListPrepare({"XaMedia"},"/XaMedia/fieldset/field",0);

	RESPONSE.Content=ListResponse(DbRes,ListFields);
};
예제 #3
0
파일: XaMedia.cpp 프로젝트: XAllegro/Xaas
void XaMedia::ListComplete(){

	string XaDomainMediaCategory_ID=HTTP.GetHttpParam("XaDomainMediaCategory_ID");
        string XaField_ID=HTTP.GetHttpParam("XaField_ID");
        string XaTable=HTTP.GetHttpParam("XaTable");
	
	// inserire la condizione su marked=1 per area non logati (XaUser_ID non valorizzato)
        
        string Qry="SELECT M.id,M.XaField_ID,M.preferred,M.position,CONCAT('data:',D.type,';base64,',D.thumbnail) thumbnail,D.type "
                   "FROM XaMedia M LEFT JOIN XaMediaData D ON D.XaMedia_ID=M.id WHERE M.status=1  AND M.XaField_ID="+XaField_ID+" AND M.XaTable='"+XaTable+"' AND M.XaDomainMediaCategory_ID="+XaDomainMediaCategory_ID;

	LOG.Write("INF", __FILE__, __FUNCTION__,__LINE__,"Query ->"+Qry);

        DbResMap DbRes=XaLibSql::FreeQuerySelect(DB_READ,Qry);

	vector<string> ListFields=ListPrepare({"XaMediaComplete"},"/XaMediaComplete/fieldset/field",0);

	RESPONSE.Content=ListResponse(DbRes,ListFields);
};
예제 #4
0
void XaUserAddressPhone::ListByUser() {

	string XaUser_ID=HTTP.GetHttpParam("XaUser_ID");

	vector<string> WhereFields={"XaUser_ID","status"};
	vector<string> WhereValues={XaUser_ID,"1"};
	vector<string> OrderByFields={};
	vector<string> GroupByFields={};

	int Limit={0};

	string OrderBy=HTTP.GetHttpParam("order_by");

	vector<string> ReturnedFields=ListPrepare({"XaUserAddressPhone"},"/XaUserAddressPhone/fieldset/field");

	DbResMap DbRes=XaLibSql::Select(DB_READ,"XaUserAddressPhone",{ReturnedFields},{WhereFields}, {WhereValues}, {OrderByFields},{GroupByFields},Limit);
	RESPONSE.Content=ListResponse(DbRes,ReturnedFields);	

};
예제 #5
0
void XaUserAddressPhone::List() {

	vector<string> WhereFields={};
	vector<string> WhereValues={};
	vector<string> OrderByFields={};
	vector<string> GroupByFields={};

	string PassedLimit=HTTP.GetHttpParam("limit");
	int Limit={0};

	if (PassedLimit!="NoHttpParam") {
		Limit=FromStringToInt(PassedLimit);
	};

	string OrderBy=HTTP.GetHttpParam("order_by");
	string Status=HTTP.GetHttpParam("status");

	vector<string> ReturnedFields=ListPrepare({"XaUserAddressPhone"},"/XaUserAddressPhone/fieldset/field");

	DbResMap DbRes=XaLibSql::Select(DB_READ,"XaUserAddressPhone",{ReturnedFields},{WhereFields}, {WhereValues}, {OrderByFields},{GroupByFields},Limit);
	RESPONSE.Content=ListResponse(DbRes,ReturnedFields);

};
예제 #6
0
파일: share.c 프로젝트: mingpen/OpenNT
/*
 *  Now checks whether sharename exists before creating queue
 *  6-20-90 JONN
 */
VOID NEAR make_queue(TCHAR FAR * queue, TCHAR * dests)
{
    USHORT                  err;                /* API return status */
    USHORT                  available;          /* num entries available */
    PRQINFO FAR *           pq;
    USHORT                  equal;
    struct share_info_0 FAR *   share_info;         /* dummy share_info buffer */

    if ((err = MNetShareGetInfo(NULL,
                                queue,
                                0,
                                (LPBYTE*)&share_info))
            != NERR_NetNameNotFound)
    {
        if (err == NERR_Success)
            ErrorExit(NERR_DuplicateShare);
        else
            ErrorExit(err);
    }

    NetApiBufferFree((TCHAR FAR *) share_info);

    pq = (PRQINFO FAR *) MGetBuffer(LITTLE_BUFFER_SIZE);

    if ((err = (USHORT) DosPrintQGetInfo(NULL,
                                queue,
                                1,
                   (TCHAR FAR *) pq,
                                LITTLE_BUFFER_SIZE,
                                &available))        ||
            (pq->fsStatus & PRQ_STATUS_MASK) == PRQ_PENDING)
    {
        if (err && err != NERR_QNotFound)
            ErrorExit(err);
        if (!YorN(APE_CreatQ, 1))
            NetcmdExit(2);

        _tcscpy(pq->szName,queue);
        pq->uPriority = PRQ_DEF_PRIORITY;
        pq->uStartTime = 0;
        pq->uUntilTime = 0;
        pq->pszSepFile = NULL_STRING;
        pq->pszPrProc = NULL_STRING;

        if (err = ListPrepare(&dests, 
                              NAMETYPE_PATH | INLC_FLAGS_CANONICALIZE, 
                              TRUE))
                ErrorExit(err);

        pq->pszDestinations = dests;
        pq->pszParms = NULL_STRING;
        pq->pszComment = NULL_STRING;

        if (err = (USHORT) DosPrintQAdd(NULL, 1, (TCHAR FAR *) pq,
          LITTLE_BUF_SIZE))
            ErrorExit(err);

        InfoPrintInsTxt(APE_QueueMade, queue);
    }
    else
    {
        /* Q exists */
        if (dests == NULL)
            return;

        /* Check if dest lists match */
        if (err = LUI_ListCompare(NULL,
                        dests,
                        pq->pszDestinations,
                        (ULONG) NAMETYPE_PATH,
                        &equal))
            ErrorExit(err);
        if (!equal)
            ErrorExit(APE_ShareNoMatch);
    }

    NetApiBufferFree((TCHAR FAR *) pq);
}