mysql_value_string

mysql_value_string — converts a Gamma value into a string for use in an SQL statement.

Syntax

mysql_value_string (value)
    

Arguments

value

Any Gamma expression.

Returns

A string representation of the Gamma value suitable for use in an SQL statement.

Description

This function converts the supplied value into a string that is suitable for inclusion in an SQL statement. It will convert a number to its string representation, and will convert a string into that string surrounded by double quotes, with embedded double quotes escaped using backslash characters. Any other data type will be converted to its string representation.

Example

Gamma> require("MySQLSupport");
"/usr/cogent/require/MySQLSupport.g"
Gamma> mysql_value_string("Hi there.");
"\"Hi there.\""
Gamma>  mysql_value_string(27);
"27"
Gamma> mysql_value_string(27.2);
"27.199999999999999289"
Gamma> mysql_value_string(date());
"\"Fri Apr 18 11:11:20 2003\""
Gamma> mysql_value_string(#3 + 4);
"(+ 3 4)"
Gamma> mysql_value_string(2003-04-17);
"1982"
Gamma> mysql_value_string(#2003-04-17);
"(- (- 2003 4) 17)"