orm: order by id by default
							parent
							
								
									e3f00ff28b
								
							
						
					
					
						commit
						a4b159a80f
					
				| 
						 | 
					@ -107,7 +107,7 @@ fn (mut g Gen) sql_select_expr(node ast.SqlExpr) {
 | 
				
			||||||
	if node.has_where && node.where_expr is ast.InfixExpr {
 | 
						if node.has_where && node.where_expr is ast.InfixExpr {
 | 
				
			||||||
		g.expr_to_sql(node.where_expr)
 | 
							g.expr_to_sql(node.where_expr)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	g.writeln('"));')
 | 
						g.writeln(' order by id"));')
 | 
				
			||||||
	// Dump all sql parameters generated by our custom expr handler
 | 
						// Dump all sql parameters generated by our custom expr handler
 | 
				
			||||||
	binds := g.sql_buf.str()
 | 
						binds := g.sql_buf.str()
 | 
				
			||||||
	g.sql_buf = strings.new_builder(100)
 | 
						g.sql_buf = strings.new_builder(100)
 | 
				
			||||||
| 
						 | 
					@ -137,7 +137,7 @@ fn (mut g Gen) sql_select_expr(node ast.SqlExpr) {
 | 
				
			||||||
		//
 | 
							//
 | 
				
			||||||
		g.writeln('int _step_res$tmp = sqlite3_step($g.sql_stmt_name);')
 | 
							g.writeln('int _step_res$tmp = sqlite3_step($g.sql_stmt_name);')
 | 
				
			||||||
		if node.is_array {
 | 
							if node.is_array {
 | 
				
			||||||
			g.writeln('\tprintf("step res=%d\\n", _step_res$tmp);')
 | 
								//g.writeln('\tprintf("step res=%d\\n", _step_res$tmp);')
 | 
				
			||||||
			g.writeln('\tif (_step_res$tmp == SQLITE_DONE) break;')
 | 
								g.writeln('\tif (_step_res$tmp == SQLITE_DONE) break;')
 | 
				
			||||||
			g.writeln('\tif (_step_res$tmp = SQLITE_ROW) ;') // another row
 | 
								g.writeln('\tif (_step_res$tmp = SQLITE_ROW) ;') // another row
 | 
				
			||||||
			g.writeln('\telse if (_step_res$tmp != SQLITE_OK) break;')
 | 
								g.writeln('\telse if (_step_res$tmp != SQLITE_OK) break;')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -402,3 +402,7 @@ fn strip(s string) string {
 | 
				
			||||||
	// strip('\nabc\r\n') => 'abc'
 | 
						// strip('\nabc\r\n') => 'abc'
 | 
				
			||||||
	return s.trim('\r\n')
 | 
						return s.trim('\r\n')
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pub fn not_found() Result {
 | 
				
			||||||
 | 
						return Result{}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue