Quote:
	
	
		| 
					Originally Posted by Stefan  The database is databases/main.dbUse "as" for renaming columns of the result. You can also access the result as array, like rows[][]
 | 
	
 Ah good, thanks.
Could you perhaps make a function for converting arrays into a format suitable for SQL statements? Basically making it into a large string, using single quotes around strings, and escaping the single quotes in the string. I figure that would be better if not done by script.
And, I'd also like a server option for reporting SQLite errors and such on RC.
This is the equivalent script:
	PHP Code:
	
		
			
public function sqlarray(array) {
  temp.out = "";
  temp.sz = array.size();
  
  if (temp.sz < 1)
    return "";
  if (temp.array[0].type() == 0)
    temp.out @= temp.array[0];
  else
    temp.out @= this.sqlescape(temp.array[0]);
  for (temp.i = 1; temp.i < temp.array.size(); temp.i ++) {
    if (temp.array[i].type() == 0)
      temp.out @= "," @ temp.array[i];
    else
      temp.out @= "," @ this.sqlescape(temp.array[i]);
  }
  return temp.out;
}
public function sqlescape(rstr) {
  temp.p = temp.rstr.positions("'");
  if (temp.p.size() > 0)
    for (temp.e = temp.p.size() - 1; temp.e > -1; temp.e --)
      temp.rstr = replacesubstring(temp.rstr, temp.p[temp.e], 1, "''");
  return "'" @ temp.rstr @ "'";
}
// replacesubstring from util_string
public function replacesubstring(string, position, length, newstring) {
  if (temp.position < 0) {
    return;
  }
  return temp.string.substring(0, temp.position) @
         temp.newstring @
         temp.string.substring(temp.position + temp.length, -1);
}