Author | Topic: DacSqlStatement - SQL string modified internaly | |
---|---|---|
Itai Dishon | DacSqlStatement - SQL string modified internaly on Sat, 07 Mar 2015 08:15:18 +0100 Hi, The DacSqlStatement is some how modifying the output to the server for a pass-through SQL statement. oStmt := DacSqlStatement(oSession) oStmt:fromChar(cStr) oStmt:build() oStmt:Execute() Ooriginal string passed to the statment object CREATE OR REPLACE FUNCTION actasign_isam_actasignid() RETURNS trigger AS $BODY$ BEGIN NEW.__order_actasignid_actasignid = (lpad(NEW.actasignid::text,8, ' ') || '@' || lpad(NEW.__record::text,10,'0')); RETURN NEW; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE COST 100; ALTER FUNCTION actasign_isam_actasignid() OWNER TO postgres; The result at the server - look at the line start with "NEW" CREATE OR REPLACE FUNCTION actasign_isam_actasignid() RETURNS trigger AS $BODY$ BEGIN NEW.__order_actasignid_actasignid = (lpad(NEW.actasignidNULL,8, ' ') || '@' || lpad(NEW.__recordNULL,10,'0')); RETURN NEW; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE COST 100; ALTER FUNCTION actasign_isam_actasignid() OWNER TO postgres; Itai Dishon | |
Andreas Herdt | Re: DacSqlStatement - SQL string modified internaly on Mon, 16 Mar 2015 17:36:33 +0100 Hi Itai, With Xbase++ PassThrough SQL the character combination "::" has a special meaning. For an example please refer to SqlStatmement:asString(). If you depend on the special PostgreSql syntax you may escape the "::" characters with a backslash. Please try the following: (...) NEW.actasignid\::text (...) The statement class should create proper SQL then. With my best regards, Andreas Herdt Alaska Software -------------------------------------------------------------------- Technical Support: support@alaska-software.com News Server: news.alaska-software.com Homepage: http://www.alaska-software.com WebKnowledgeBase: http://www.alaska-software.com/kbase.shtm Fax European Office: +49 (0) 61 96 - 77 99 99 23 Fax US Office: +1 (646) 218 1281 -------------------------------------------------------------------- "Itai Dishon" schrieb im Newsbeitrag news:e2c35a5$e8c5f22$2e9f25@news.alaska-software.com... Hi, The DacSqlStatement is some how modifying the output to the server for a pass-through SQL statement. oStmt := DacSqlStatement(oSession) oStmt:fromChar(cStr) oStmt:build() oStmt:Execute() Ooriginal string passed to the statment object CREATE OR REPLACE FUNCTION actasign_isam_actasignid() RETURNS trigger AS $BODY$ BEGIN NEW.__order_actasignid_actasignid = (lpad(NEW.actasignid::text,8, ' ') || '@' || lpad(NEW.__record::text,10,'0')); RETURN NEW; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE COST 100; ALTER FUNCTION actasign_isam_actasignid() OWNER TO postgres; The result at the server - look at the line start with "NEW" CREATE OR REPLACE FUNCTION actasign_isam_actasignid() RETURNS trigger AS $BODY$ BEGIN NEW.__order_actasignid_actasignid = (lpad(NEW.actasignidNULL,8, ' ') || '@' || lpad(NEW.__recordNULL,10,'0')); RETURN NEW; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE COST 100; ALTER FUNCTION actasign_isam_actasignid() OWNER TO postgres; Itai Dishon |