#define EMAILS "emails" //emails tables
#define SESSIONS "sessions" //session tables
-/*
-\f
-*/
-/********************************************************/
-/* */
-/* Procedure to drop result issued by a successfull*/
-/* command. */
-/* */
-/********************************************************/
-static SQLRES *dropresult(SQLTYP *sql,SQLRES *rs)
-
-{
-#define OPEP "devsql.c:dropresult,"
-
-if (rs!=(SQLRES *)0) {
- switch(sql->sqldb) {
- case db_postgres :
- rs=(SQLRES *)pos_dropresult((POSRES *)rs);
- break;
- case db_maria :
- rs=(SQLRES *)pos_dropresult((MARRES *)rs);
- break;
- default :
- (void) rou_alert(0,"%s Unexpected type='%d' (BUG!?)",
- OPEP,(int)sql->sqldb);
- rs=(SQLRES *)0;
- break;
- }
- }
-return rs;
-#undef OPEP
-}
-/*
-\f
-*/
-/********************************************************/
-/* */
-/* Procedure to get the ASCII form of field located*/
-/* in a specific tuple + name in sqlresult. */
-/* */
-/********************************************************/
-static char *getvalue(SQLTYP *sql,SQLRES *rs,int tuple,const char *fieldname)
-
-{
-#define OPEP "devsql.c:getvalue,"
-
-char *value;
-
-value=(char *)0;
-switch(sql->sqldb) {
- case db_postgres :
- value=pos_getvalue((POSRES *)rs,tuple,fieldname);
- break;
- case db_maria :
- value=mar_getvalue((MARRES *)rs,tuple,fieldname);
- break;
- default :
- (void) rou_alert(0,"%s Unexpected type='%d' (BUG!?)",
- OPEP,(int)sql->sqldb);
- break;
- }
-if (value==(char *)0) {
- (void) rou_alert(0,"%s value is NULL for field=<%s> (BUG!?)",OPEP,fieldname);
- value="00000"; //force value!
- }
-return value;
-#undef OPEP
-}
#ifdef GETFIELD
/*
\f
*/
/********************************************************/
/* */
-/* Procedure to the number of tupple within a */
-/* result issued by a successfull command. */
-/* */
-/********************************************************/
-static int nbrtupple(SQLTYP *sql,SQLRES *rs)
-
-{
-#define OPEP "devsql.c:nbrtupple,"
-
-int numrow;
-
-numrow=0;
-switch(sql->sqldb) {
- case db_postgres :
- numrow=pos_nbrtupple((POSRES *)rs);
- break;
- case db_maria :
- numrow=mar_nbrtupple((MARRES *)rs);
- break;
- default :
- (void) rou_alert(0,"%s Unexpected type='%d' (BUG!?)",
- OPEP,(int)sql->sqldb);
- break;
- }
-return numrow;
-
-#undef OPEP
-}
-/*
-\f
-*/
-/********************************************************/
-/* */
-/* Procedure to create a data search request and */
-/* submit it to the to the proper database daemon. */
-/* */
-/********************************************************/
-static SQLRES *gettupple(SQLTYP *sql,const char *fmt,...)
-
-{
-#define OPEP "devsql.c:gettupple,"
-
-SQLRES *rs;
-va_list args;
-char *cmd;
-
-rs=(SQLRES *)0;
-va_start(args,fmt);
-if ((rou_vasprintf(&cmd,fmt,args))>0) {
- switch(sql->sqldb) {
- case db_postgres :
- rs=(SQLRES *)pos_gettupple(sql->db.psql,cmd);
- break;
- case db_maria :
- rs=(SQLRES *)mar_gettupple(sql->db.msql,cmd);
- break;
- default :
- (void) rou_alert(0,"%s Unexpected type='%d' (BUG!?)",
- OPEP,(int)sql->sqldb);
- break;
- }
- (void) free(cmd);
- }
-va_end(args);
-return rs;
-
-#undef OPEP
-}
-/*
-\f
-*/
-/********************************************************/
-/* */
/* Procedure to create an SQL pointer for proper */
/* database type. */
/* */
va_end(args);
return number;
+#undef OPEP
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Procedure to get the ASCII form of field located*/
+/* in a specific tuple + name in sqlresult. */
+/* */
+/********************************************************/
+PUBLIC char *sql_getvalue(SQLPTR *sqlptr,SQLRES *rs,int row,const char *name)
+
+{
+#define OPEP "devsql.c:sql_getvalue,"
+
+char *value;
+SQLTYP *sql;
+
+value=(char *)0;
+sql=(SQLTYP *)sqlptr;
+switch(sql->sqldb) {
+ case db_postgres :
+ value=pos_getvalue((POSRES *)rs,row,name);
+ break;
+ case db_maria :
+ value=mar_getvalue((MARRES *)rs,row,name);
+ break;
+ default :
+ (void) rou_alert(0,"%s Unexpected type='%d' (BUG!?)",
+ OPEP,(int)sql->sqldb);
+ break;
+ }
+if (value==(char *)0) {
+ (void) rou_alert(0,"%s value is NULL for field=<%s> (BUG!?)",OPEP,name);
+ value="00000"; //force value!
+ }
+return value;
+#undef OPEP
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Procedure to create a data search request and */
+/* submit it to the to the proper database daemon. */
+/* */
+/********************************************************/
+PUBLIC SQLRES *sql_gettupple(SQLPTR *sqlptr,const char *fmt,...)
+
+{
+#define OPEP "devsql.c:sql_gettupple,"
+
+SQLRES *rs;
+SQLTYP *sql;
+va_list args;
+char *cmd;
+
+rs=(SQLRES *)0;
+sql=(SQLTYP *)sqlptr;
+va_start(args,fmt);
+if ((rou_vasprintf(&cmd,fmt,args))>0) {
+ switch(sql->sqldb) {
+ case db_postgres :
+ rs=(SQLRES *)pos_gettupple(sql->db.psql,cmd);
+ break;
+ case db_maria :
+ rs=(SQLRES *)mar_gettupple(sql->db.msql,cmd);
+ break;
+ default :
+ (void) rou_alert(0,"%s Unexpected type='%d' (BUG!?)",
+ OPEP,(int)sql->sqldb);
+ break;
+ }
+ (void) free(cmd);
+ }
+va_end(args);
+return rs;
+
+#undef OPEP
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Procedure to the number of tupple within a */
+/* result issued by a successfull command. */
+/* */
+/********************************************************/
+PUBLIC int sql_getnbrtupple(SQLPTR *sqlptr,SQLRES *rs)
+
+{
+#define OPEP "devsql.c:sql_getnbrtupple,"
+
+int numrow;
+
+numrow=0;
+SQLTYP *sql;
+sql=(SQLTYP *)sqlptr;
+switch(sql->sqldb) {
+ case db_postgres :
+ numrow=pos_nbrtupple((POSRES *)rs);
+ break;
+ case db_maria :
+ numrow=mar_nbrtupple((MARRES *)rs);
+ break;
+ default :
+ (void) rou_alert(0,"%s Unexpected type='%d' (BUG!?)",
+ OPEP,(int)sql->sqldb);
+ break;
+ }
+return numrow;
+
+#undef OPEP
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* Procedure to drop result issued by a successfull*/
+/* command. */
+/* */
+/********************************************************/
+PUBLIC SQLRES *dropresult(SQLPTR *sqlptr,SQLRES *rs)
+
+{
+#define OPEP "devsql.c:sql_dropresult,"
+
+if (rs!=(SQLRES *)0) {
+ SQLTYP *sql;
+
+ sql=(SQLTYP *)sqlptr;
+ switch(sql->sqldb) {
+ case db_postgres :
+ rs=(SQLRES *)pos_dropresult((POSRES *)rs);
+ break;
+ case db_maria :
+ rs=(SQLRES *)pos_dropresult((MARRES *)rs);
+ break;
+ default :
+ (void) rou_alert(0,"%s Unexpected type='%d' (BUG!?)",
+ OPEP,(int)sql->sqldb);
+ rs=(SQLRES *)0;
+ break;
+ }
+ }
+return rs;
#undef OPEP
}
/*