comparison src/c/urweb.c @ 282:0236d9412ad2

Ran a prepared statement with one string parameter
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Sep 2008 09:28:13 -0400
parents 7d5860add50f
children c0e4ac23522d
comparison
equal deleted inserted replaced
281:7d5860add50f 282:0236d9412ad2
120 if (n >= lw_inputs_len) 120 if (n >= lw_inputs_len)
121 lw_error(ctx, FATAL, "For input name %s, index %d is out of range", name, n); 121 lw_error(ctx, FATAL, "For input name %s, index %d is out of range", name, n);
122 122
123 ctx->inputs[n] = value; 123 ctx->inputs[n] = value;
124 124
125 printf("[%d] %s = %s\n", n, name, value); 125 //printf("[%d] %s = %s\n", n, name, value);
126 } 126 }
127 127
128 char *lw_get_input(lw_context ctx, int n) { 128 char *lw_get_input(lw_context ctx, int n) {
129 if (n < 0) 129 if (n < 0)
130 lw_error(ctx, FATAL, "Negative input index %d", n); 130 lw_error(ctx, FATAL, "Negative input index %d", n);
131 if (n >= lw_inputs_len) 131 if (n >= lw_inputs_len)
132 lw_error(ctx, FATAL, "Out-of-bounds input index %d", n); 132 lw_error(ctx, FATAL, "Out-of-bounds input index %d", n);
133 printf("[%d] = %s\n", n, ctx->inputs[n]); 133 //printf("[%d] = %s\n", n, ctx->inputs[n]);
134 return ctx->inputs[n]; 134 return ctx->inputs[n];
135 } 135 }
136 136
137 char *lw_get_optional_input(lw_context ctx, int n) { 137 char *lw_get_optional_input(lw_context ctx, int n) {
138 if (n < 0) 138 if (n < 0)
654 if (b == lw_Basis_False) 654 if (b == lw_Basis_False)
655 return "FALSE"; 655 return "FALSE";
656 else 656 else
657 return "TRUE"; 657 return "TRUE";
658 } 658 }
659
660 char *lw_Basis_ensqlBool(lw_Basis_bool b) {
661 static lw_Basis_int true = 1;
662 static lw_Basis_int false = 0;
663
664 if (b == lw_Basis_False)
665 return (char *)&false;
666 else
667 return (char *)&true;
668 }