[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r37187 - in gnunet/src: include my
From: |
gnunet |
Subject: |
[GNUnet-SVN] r37187 - in gnunet/src: include my |
Date: |
Thu, 19 May 2016 18:30:11 +0200 |
Author: christophe.genevey
Date: 2016-05-19 18:30:11 +0200 (Thu, 19 May 2016)
New Revision: 37187
Modified:
gnunet/src/include/gnunet_my_lib.h
gnunet/src/my/my.c
Log:
GNUNET extract result libgnunetmy
Modified: gnunet/src/include/gnunet_my_lib.h
===================================================================
--- gnunet/src/include/gnunet_my_lib.h 2016-05-19 13:30:48 UTC (rev 37186)
+++ gnunet/src/include/gnunet_my_lib.h 2016-05-19 16:30:11 UTC (rev 37187)
@@ -95,7 +95,7 @@
/**
* Information to pass to @e conv. Size of @a data.
*/
- unsigned long data_len;
+ unsigned long data_len ;
};
@@ -222,13 +222,12 @@
*/
#define GNUNET_MY_result_spec_auto_from_type(dst)
GNUNET_MY_result_spec_fixed_size ((dst), sizeof (*(dst)))
-
/**
* FIXME.
+ *
*/
int
-GNUNET_MY_extract_result (struct GNUNET_MYSQL_Context *mc,
- struct GNUNET_MYSQL_StatementHandle *stmt,
+GNUNET_MY_extract_result (MYSQL_BIND * result,
int row,
struct GNUNET_MY_ResultSpec *specs);
Modified: gnunet/src/my/my.c
===================================================================
--- gnunet/src/my/my.c 2016-05-19 13:30:48 UTC (rev 37186)
+++ gnunet/src/my/my.c 2016-05-19 16:30:11 UTC (rev 37187)
@@ -90,5 +90,49 @@
return GNUNET_OK;
}
+/**
+ * Extract results from a query result according
+ * to the given specification. If colums are NULL,
+ * the destination is not modified, and #GNUNET_NO is returned
+ *
+ *
+ * @param result
+ * @param row, the row from the result to extract
+ * @param result specificatio to extract for
+ * @return
+ #GNUNET_YES if all results could be extracted
+ #GNUNET_NO if at least one result was NULL
+ #GNUNET_SYSERR if a result was invalid
+*/
+int
+GNUNET_MY_extract_result (MYSQL_BIND * result,
+ int row,
+ struct GNUNET_MY_ResultSpec *specs)
+{
+ unsigned int i ;
+ int had_null = GNUNET_NO ;
+ int ret ;
+ for(i = 0 ; NULL != specs[i].conv ; i++)
+ {
+ struct GNUNET_MY_ResultSpec * spec ;
+
+ spec = &specs[i] ;
+ ret = spec->conv(spec->conv_cls,
+ NULL, //wait GNUNET_MY_QueryParam
+ result);
+
+ if(ret == GNUNET_SYSERR)
+ return GNUNET_SYSERR ;
+
+ if(spec->result_size != NULL)
+ *spec->result_size = spec->dst_size;
+ }
+
+ if(GNUNET_YES == had_null)
+ return GNUNET_NO ;
+
+ return GNUNET_OK ;
+}
+
/* end of my.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r37187 - in gnunet/src: include my,
gnunet <=