Mercurial > urweb
comparison src/postgres.sml @ 1011:16f7cb0891b6
Initial support for char in SQL
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 22 Oct 2009 16:15:56 -0400 |
parents | 38a376dc7401 |
children | ea9f03ac2710 |
comparison
equal
deleted
inserted
replaced
1010:6b0f3853cc81 | 1011:16f7cb0891b6 |
---|---|
37 fun p_sql_type t = | 37 fun p_sql_type t = |
38 case t of | 38 case t of |
39 Int => "int8" | 39 Int => "int8" |
40 | Float => "float8" | 40 | Float => "float8" |
41 | String => "text" | 41 | String => "text" |
42 | Char => "char" | |
42 | Bool => "bool" | 43 | Bool => "bool" |
43 | Time => "timestamp" | 44 | Time => "timestamp" |
44 | Blob => "bytea" | 45 | Blob => "bytea" |
45 | Channel => "int8" | 46 | Channel => "int8" |
46 | Client => "int4" | 47 | Client => "int4" |
49 fun p_sql_type_base t = | 50 fun p_sql_type_base t = |
50 case t of | 51 case t of |
51 Int => "bigint" | 52 Int => "bigint" |
52 | Float => "double precision" | 53 | Float => "double precision" |
53 | String => "text" | 54 | String => "text" |
55 | Char => "character" | |
54 | Bool => "boolean" | 56 | Bool => "boolean" |
55 | Time => "timestamp without time zone" | 57 | Time => "timestamp without time zone" |
56 | Blob => "bytea" | 58 | Blob => "bytea" |
57 | Channel => "bigint" | 59 | Channel => "bigint" |
58 | Client => "integer" | 60 | Client => "integer" |
254 string "uw_sqlfmtFloat = \"%g::float8%n\";", | 256 string "uw_sqlfmtFloat = \"%g::float8%n\";", |
255 newline, | 257 newline, |
256 string "uw_Estrings = 1;", | 258 string "uw_Estrings = 1;", |
257 newline, | 259 newline, |
258 string "uw_sqlsuffixString = \"::text\";", | 260 string "uw_sqlsuffixString = \"::text\";", |
261 newline, | |
262 string "uw_sqlsuffixChar = \"::char\";", | |
259 newline, | 263 newline, |
260 string "uw_sqlsuffixBlob = \"::bytea\";", | 264 string "uw_sqlsuffixBlob = \"::bytea\";", |
261 newline, | 265 newline, |
262 string "uw_sqlfmtUint4 = \"%u::int4%n\";", | 266 string "uw_sqlfmtUint4 = \"%u::int4%n\";", |
263 newline], | 267 newline], |
503 | String => | 507 | String => |
504 if wontLeakStrings then | 508 if wontLeakStrings then |
505 e | 509 e |
506 else | 510 else |
507 box [string "uw_strdup(ctx, ", e, string ")"] | 511 box [string "uw_strdup(ctx, ", e, string ")"] |
512 | Char => box [e, string "[0]"] | |
508 | Bool => box [string "uw_Basis_stringToBool_error(ctx, ", e, string ")"] | 513 | Bool => box [string "uw_Basis_stringToBool_error(ctx, ", e, string ")"] |
509 | Time => box [string "uw_Basis_unsqlTime(ctx, ", e, string ")"] | 514 | Time => box [string "uw_Basis_unsqlTime(ctx, ", e, string ")"] |
510 | Blob => box [string "uw_Basis_stringToBlob_error(ctx, ", | 515 | Blob => box [string "uw_Basis_stringToBlob_error(ctx, ", |
511 e, | 516 e, |
512 string ", ", | 517 string ", ", |
641 fun p_ensql t e = | 646 fun p_ensql t e = |
642 case t of | 647 case t of |
643 Int => box [string "uw_Basis_attrifyInt(ctx, ", e, string ")"] | 648 Int => box [string "uw_Basis_attrifyInt(ctx, ", e, string ")"] |
644 | Float => box [string "uw_Basis_attrifyFloat(ctx, ", e, string ")"] | 649 | Float => box [string "uw_Basis_attrifyFloat(ctx, ", e, string ")"] |
645 | String => e | 650 | String => e |
651 | Char => box [string "uw_Basis_attrifyChar(ctx, ", e, string ")"] | |
646 | Bool => box [string "(", e, string " ? \"TRUE\" : \"FALSE\")"] | 652 | Bool => box [string "(", e, string " ? \"TRUE\" : \"FALSE\")"] |
647 | Time => box [string "uw_Basis_attrifyTime(ctx, ", e, string ")"] | 653 | Time => box [string "uw_Basis_attrifyTime(ctx, ", e, string ")"] |
648 | Blob => box [e, string ".data"] | 654 | Blob => box [e, string ".data"] |
649 | Channel => box [string "uw_Basis_attrifyChannel(ctx, ", e, string ")"] | 655 | Channel => box [string "uw_Basis_attrifyChannel(ctx, ", e, string ")"] |
650 | Client => box [string "uw_Basis_attrifyClient(ctx, ", e, string ")"] | 656 | Client => box [string "uw_Basis_attrifyClient(ctx, ", e, string ")"] |