6 #include <wvdbusconn.h>
14 //A bool to select whether or not the column info from an incoming
15 //message is important or not.
18 int vxtype_to_pgtype(WvStringParm vxtype
)
20 if (vxtype
== "String")
21 return PG_TYPE_VARCHAR
;
22 else if (vxtype
== "Int64")
24 else if (vxtype
== "Int32")
26 else if (vxtype
== "Int16")
28 else if (vxtype
== "UInt8")
30 else if (vxtype
== "Bool")
32 else if (vxtype
== "Double")
33 return PG_TYPE_FLOAT8
;
34 else if (vxtype
== "Uuid")
35 return PG_TYPE_VARCHAR
;
36 else if (vxtype
== "Binary")
38 else if (vxtype
== "DateTime")
39 return VX_TYPE_DATETIME
;
40 else if (vxtype
== "Decimal")
41 return PG_TYPE_NUMERIC
;
47 VxResultSet() : process_colinfo(true)
49 res
= QR_Constructor();
55 void set_field_info(int col
, const char *colname
, OID type
, int typesize
)
57 mylog("Col#%d is '%s', type=%d, size=%d\n", col
, colname
, type
, typesize
);
60 // FIXME: This will destroy old data
61 mylog("!!!!!! Resizing colinfo array, destroying data !!!!!!\n");
63 QR_set_num_fields(res
, maxcol
+1);
65 QR_set_field_info_v(res
, col
, colname
, type
, typesize
);
66 assert(!strcmp(QR_get_fieldname(res
, col
), colname
));
69 operator QResultClass
* () const
79 void _runquery(WvDBusConn
&conn
, const char *func
, const char *query
);
80 void return_versaplex_db();
81 void process_msg(WvDBusMsg
&msg
);
90 VxStatement(StatementClass
*_stmt
)
99 * things need to think that this statement is finished so the
100 * results can be retrieved.
102 stmt
->status
= STMT_FINISHED
;
104 /* set up the current tuple pointer for SQLFetch */
105 stmt
->currTuple
= -1;
106 SC_set_rowset_start(stmt
, -1, FALSE
);
107 SC_set_current_col(stmt
, -1);
110 ret
= DiscardStatementSvp(stmt
, ret
, FALSE
);
115 ret
= SC_initialize_and_recycle(stmt
);
118 void set_result(VxResultSet
&rs
)
120 SC_set_Result(stmt
, rs
);
122 /* the binding structure for a statement is not set up until
123 * a statement is actually executed, so we'll have to do this
126 extend_column_bindings(SC_get_ARDF(stmt
), rs
.numcols());
129 RETCODE
retcode() const
146 return ret
== SQL_SUCCESS
;
151 ConnectionClass
*conn
= SC_get_conn(stmt
);
156 void runquery(VxResultSet
&rs
, const char *func
, const char *query
);
159 #endif // __VXHELPERS_H