从表单中提取值并向数据库服务发送如何参数(过滤器)

时间:2017-05-05 19:04:54

标签: mysql database forms orbeon

在我的配置中,我尝试下一个命令(BD mysql):

#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <ctime>

using namespace std;

typedef bool (*cmp_func)(int i0, int i1);


template<typename T>
void print_array(int n, T *x)
{
        cout << "[";
        for (int i = 0; i < n; ++i) {
                cout << setw(3) << x[i];
        }
        cout << " ]\n";
 }

template <typename T>
bool less_than(T i0, T i1) { return i0 < i1; }

template <typename T>
bool greater_than(T i0, T i1) { return i0 > i1; }

template <typename T>
bool is_sorted(int n, T *x, cmp_func cmp)
{
        for (int i = 1; i < n; ++i)
                if ((*cmp)(x[i], x[i-1]))
                        return false;

        return true;
}  

  template <typename T>
void exchange(T* x, int i, int j)
{
        T t = x[i];
        x[i] = x[j];
        x[j] = t;
}


template <typename T>
void insertion_sort(T *x, int l, int r, cmp_func cmp)
{
        for (int i = l+1; i <= r; ++i) {
                for (int j = i; j > l; --j){
                        if ((*cmp)(x[j], x[j-1]))
                                exchange(x, j, j-1);
                    cout << "  ";
                    print_array(r-l+1, x+l);
                }
        }
}

template <typename T>
void insertion_sort2(T *x, int l, int r, cmp_func cmp)
{
        for (int i = r; i > l; --i)
                if ((*cmp)(x[i], x[i-1]))
                        exchange(x, i, i-1);

        for (int i = l+2; i <= r; ++i) {
                int j = i;
                int v = x[i];
                while((*cmp)(v, x[j-1])) {
                        x[j] = x[j-1];
                        --j;
                }
                x[j] = v;

                cout << "  ";
                print_array(r-l+1, x+l);
        }
}

template <typename T>
void fill_random(T n, T *x)
{
        const int M = 100;

        srand(time(0));

        for (int i = 0; i < n; ++i)
                x[i] = rand() % M;
}

int main(int argc, char **argv)
{
        const int N = 10;
        int x[N];
        fill_random(N, x);
        print_array(N, x);

        insertion_sort(x, 0, N-1, &less_than);
        print_array(N, x);

        if (is_sorted(N, x, &less_than))
                cout << "SORTED\n";
        else
                cout << "NOT SORTED\n";

        return EXIT_SUCCESS;
}

此数据库服务符合drowpdown,但当我包含句子SELECT user, name, lastname FROM Cordloc where user=<sql:param type="xs:string" select="/form/section-1/usuario"/> 时, 这不起作用。

我尝试使用show en drowdown名称用户,但使用用户登录orbeon进行过滤(在表格中是相同的值“orbeon”)。

拜托,请帮助我。

非常感谢。

0 个答案:

没有答案