}
// Text
- if (!$this->num() or !preg_match('/^\d+(\.\d*)?$/',$v)) { # text criteria value
+ if (!$this->numeric() or !preg_match('/^\d+(\.\d*)?$/',$v)) { # text criteria value
if (strtolower($v)=='null') $v = '';
return $this->name.' '.($not ? 'NOT ' : '').'LIKE '.$this->db()->quote(str_replace('*','%',$v));
# Use the module out when format unknow
$out_conf = null;
if ($this->p('out') or !preg_match('/^('.join('|',
- array( 'table','div','csv','xml','json','yaml' )
+ array( 'table','div','csv','xml','json','yaml','sql' )
).')$/',$format))
{
return $count;
}
+ /*-----------------------------------------------------------------
+ Sql
+ -----------------------------------------------------------------*/
+ public function rows_begin_sql() {
+ return '';
+ }
+
+ public function rows_rec_sql(&$row) {
+ $values = array();
+
+ foreach ($row as $k=>$v) {
+ $f = $this->fields($k);
+ $values[] = $f->quote($v);
+ }
+
+ return "INSERT INTO ".$this->sql_name()." (".join(',',array_keys($row)).") VALUE(".join(',',array_values($values)).");\n";
+ }
+
+ public function rows_end_sql() {
+ return '';
+ }
+
/*-----------------------------------------------------------------
Text
-----------------------------------------------------------------*/
),
'json' => array(
'enclose' => array('['.NB_EOL,NB_EOL.']'),
- 'function.ext' => 'json_encode',
+ 'function' => 'json_encode',
'eol' => NB_EOL,
'rec' => ',',
),
public static function row($o,&$row) {
- #if (isset($o['eol'])) $row = rtrim($row,$o['eol']);
- #bye($o['function']);
- if (isset($o['function.ext'])) {
- echo $o['function.ext']($row);
- return true;
- }
if (isset($o['function'])) {
echo $o['function']($row,$o);
return true;
}
- #if (!isset($o['sep'])) $o['sep'] = "\t"; out_csv($row,$o);
out_tag($row,$o);
return false;
}