-basic insert logic of new DB API
This commit is contained in:
parent
c002f458ce
commit
94fbb1c211
@ -114,6 +114,7 @@ BEGIN
|
||||
);
|
||||
END $$;
|
||||
|
||||
-- FIXME: also have INSERT on AML decisions to update AML status!
|
||||
|
||||
INSERT INTO exchange_tables
|
||||
(name
|
||||
|
@ -37,6 +37,33 @@ TEH_PG_insert_aml_decision (
|
||||
const struct TALER_AmlOfficerPublicKeyP *decider_pub,
|
||||
const struct TALER_AmlOfficerSignatureP *decider_sig)
|
||||
{
|
||||
GNUNET_break (0); // FIXME: not implemeted!
|
||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||
struct PostgresClosure *pg = cls;
|
||||
uint32_t ns = (uint32_t) new_status;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_auto_from_type (h_payto),
|
||||
TALER_PQ_query_param_amount (new_threshold),
|
||||
GNUNET_PQ_query_param_uint32 (&ns),
|
||||
GNUNET_PQ_query_param_timestamp (&decision_time),
|
||||
GNUNET_PQ_query_param_string (justification),
|
||||
GNUNET_PQ_query_param_auto_from_type (decider_pub),
|
||||
GNUNET_PQ_query_param_auto_from_type (decider_sig),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
PREPARE (pg,
|
||||
"insert_aml_decision",
|
||||
"INSERT INTO aml_history "
|
||||
"(h_payto"
|
||||
",new_threshold_val"
|
||||
",new_threshold_frac"
|
||||
",new_status"
|
||||
",decision_time"
|
||||
",justification"
|
||||
",decider_pub"
|
||||
",decider_sig"
|
||||
") VALUES "
|
||||
"($1, $2, $3, $4, $5, $6, $7, $8);");
|
||||
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||
"insert_aml_decision",
|
||||
params);
|
||||
}
|
||||
|
@ -36,6 +36,29 @@ TEH_PG_insert_aml_officer (
|
||||
bool read_only,
|
||||
struct GNUNET_TIME_Absolute last_change)
|
||||
{
|
||||
GNUNET_break (0); // FIXME: not implemeted!
|
||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_auto_from_type (decider_pub),
|
||||
GNUNET_PQ_query_param_auto_from_type (master_sig),
|
||||
GNUNET_PQ_query_param_string (decider_name),
|
||||
GNUNET_PQ_query_param_bool (is_active),
|
||||
GNUNET_PQ_query_param_bool (read_only),
|
||||
GNUNET_PQ_query_param_absolute_time (&last_change),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
PREPARE (pg,
|
||||
"insert_aml_staff",
|
||||
"INSERT INTO aml_staff "
|
||||
"(decider_pub"
|
||||
",master_sig"
|
||||
",decider_name"
|
||||
",is_active"
|
||||
",read_only"
|
||||
",last_change"
|
||||
") VALUES "
|
||||
"($1, $2, $3, $4, $5, $6);");
|
||||
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||
"insert_aml_staff",
|
||||
params);
|
||||
}
|
||||
|
@ -38,6 +38,34 @@ TEH_PG_insert_kyc_attributes (
|
||||
size_t enc_attributes_size,
|
||||
const void *enc_attributes)
|
||||
{
|
||||
GNUNET_break (0); // FIXME: not implemeted!
|
||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_auto_from_type (h_payto),
|
||||
GNUNET_PQ_query_param_auto_from_type (kyc_prox),
|
||||
GNUNET_PQ_query_param_string (provider_section),
|
||||
(NULL == birthdate)
|
||||
? GNUNET_PQ_query_param_null ()
|
||||
: GNUNET_PQ_query_param_string (birthdate),
|
||||
GNUNET_PQ_query_param_timestamp (&collection_time),
|
||||
GNUNET_PQ_query_param_timestamp (&expiration_time),
|
||||
GNUNET_PQ_query_param_fixed_size (enc_attributes,
|
||||
enc_attributes_size),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
PREPARE (pg,
|
||||
"insert_kyc_attributes",
|
||||
"INSERT INTO kyc_attributes "
|
||||
"(h_payto"
|
||||
",kyc_prox"
|
||||
",provider"
|
||||
",birthdate"
|
||||
",collection_time"
|
||||
",expiration_time"
|
||||
",encrypted_attributes"
|
||||
") VALUES "
|
||||
"($1, $2, $3, $4, $5, $6, $7);");
|
||||
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||
"insert_kyc_attributes",
|
||||
params);
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ TEH_PG_insert_wire (void *cls,
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
/* used in #postgres_insert_wire() */
|
||||
PREPARE (pg,
|
||||
"insert_wire",
|
||||
"INSERT INTO wire_accounts "
|
||||
|
@ -36,6 +36,27 @@ TEH_PG_update_aml_officer (
|
||||
bool read_only,
|
||||
struct GNUNET_TIME_Absolute last_change)
|
||||
{
|
||||
GNUNET_break (0); // FIXME: not implemeted!
|
||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_auto_from_type (decider_pub),
|
||||
GNUNET_PQ_query_param_auto_from_type (master_sig),
|
||||
GNUNET_PQ_query_param_string (decider_name),
|
||||
GNUNET_PQ_query_param_bool (is_active),
|
||||
GNUNET_PQ_query_param_bool (read_only),
|
||||
GNUNET_PQ_query_param_timestamp (&last_change),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
PREPARE (pg,
|
||||
"update_aml_staff",
|
||||
"UPDATE aml_staff SET "
|
||||
" master_sig=$2"
|
||||
",decider_name=$3"
|
||||
",is_active=$4"
|
||||
",read_only=$5"
|
||||
",last_change=$6"
|
||||
" WHERE decider_pub=$1 AND last_change < $6;");
|
||||
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||
"update_aml_staff",
|
||||
params);
|
||||
}
|
||||
|
@ -38,6 +38,31 @@ TEH_PG_update_kyc_attributes (
|
||||
size_t enc_attributes_size,
|
||||
const void *enc_attributes)
|
||||
{
|
||||
GNUNET_break (0); // FIXME: not implemeted!
|
||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||
struct PostgresClosure *pg = cls;
|
||||
struct GNUNET_PQ_QueryParam params[] = {
|
||||
GNUNET_PQ_query_param_auto_from_type (h_payto),
|
||||
GNUNET_PQ_query_param_auto_from_type (kyc_prox),
|
||||
GNUNET_PQ_query_param_string (provider_section),
|
||||
(NULL == birthdate)
|
||||
? GNUNET_PQ_query_param_null ()
|
||||
: GNUNET_PQ_query_param_string (birthdate),
|
||||
GNUNET_PQ_query_param_timestamp (&collection_time),
|
||||
GNUNET_PQ_query_param_timestamp (&expiration_time),
|
||||
GNUNET_PQ_query_param_fixed_size (enc_attributes,
|
||||
enc_attributes_size),
|
||||
GNUNET_PQ_query_param_end
|
||||
};
|
||||
|
||||
PREPARE (pg,
|
||||
"update_kyc_attributes",
|
||||
"UPDATE kyc_attributes SET "
|
||||
" kyc_prox=$2"
|
||||
",birthdate=$4"
|
||||
",collection_time=$5"
|
||||
",expiration_time=$6"
|
||||
",encrypted_attributes=$7"
|
||||
" WHERE h_payto=$1 AND provider_section=$3;");
|
||||
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
|
||||
"update_kyc_attributes",
|
||||
params);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user