...conditions as a hash (as seen above). To be on the safe side, use SQL fragments which are never overridden: >> Article.available.scoped(:conditions => [ 'articles.state = ?', 'deleted' ]) # SELECT * FROM `articles` WHERE ((articles.state = 'deleted...
...pgAdmin as a GUI. While you can do most things just like on an SQL console, you can use it to display EXPLAIN results in a more human-readable way...
...pgAdmin, connect to your server Pick a database from the left pane Click the "SQL" icon in the toolbar, or press Ctrl+E to open the query tool.
...from and to InnoDB tables while completely bypassing the parsing and planning overhead of SQL. This could potentially be very awesome because we would then have a distributed key/value store...
...that stores data in a way it can also be queried with complex SQL queries...
...error when using Graticule? Numerical argument out of domain - acos Similarly to the to_sql problem for some edge cases, Graticule::Distance::Spherical.distance (and possibly those of Graticule's other...
...the same coordinates (applies only for some). How to fix So, similar to the SQL fix, we just force the value we compute the arc cosine of into...
...db:migrate and stash you changes in the migration files. 2. Temporally change the sql mode mysql> SELECT @@global.sql_mode; +--------------------------------------------+ | @@global.sql_mode | +--------------------------------------------+ | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION | +--------------------------------------------+
The SQL code generated by Graticule's spherical distance computation is insufficient and can lead to NULL distances in edge cases. The reason for this is that MySQL is performing...
...it. Put the following into an initializer like config/initializers/graticule_spherical_to_sql_without_nulls.rb which patches Graticule's to_sql method: Graticule::Distance::Spherical.class_eval do def self.to_sql(options) options = { :units => :miles, :latitude_column...
It's generally not trivial to change a datetime's seconds, minutes, etc in SQL. Here is how it works when speaking PostgreSQL. Consider you have a timestamp column whose...
...be the one who messed up permissions on a shared database cluster. The following SQL code will find all table names and execute a DROP TABLE statement for each.
...this case means that all those commands are processed step by step, causing 4 SQL statements to change the table. In turn, your database needs to modify the table structure...
PostgreSQL supports the SQL OVERLAPS operator. You can use it to test if two date ranges overlap: => SELECT ('2001-02-16'::date, '2001-12-21'::date) OVERLAPS...
It's every developer's nightmare: SQL queries that get large and unwieldy. This can happen fairly quickly with the addition of multiple joins, a subquery and some complicated filtering...
When you load a record with find options that have SQL fragments in :select or :joins, ActiveRecord will make that record read-only. This is a protective measure by Rails...
...root, children, siblings, descendants) and all of them can be fetched in a single sql query. Additional features are STI support, named_scopes, depth caching, depth constraints, easy migration from...
tmp/* storage/* db/*.sqlite3 db/schema.rb db/structure.sql public/system .project .idea/ public/javascripts/all* public/stylesheets/all* public/stylesheets/*.css config/database.yml *~ *#* .#* .DS_Store webrat-*.html capybara-*.html rerun.txt coverage.data coverage/* dump_for_download.dump .~lock.* .*.swp C:\\nppdf32Log\\debuglog.txt
...against many common attacks: cross site scripting (XSS), cross site request forgery (CSRF) and SQL injection. Core members are knowledgeable and genuinely concerned with security. However, there are places where...
rack-mini-profiler is a powerful Swiss army knife for Rack app performance. Measure SQL queries, memory allocation and CPU time. This should probably not be loaded in production (the...
...m working on a problem for a client which involves connecting to a Microsoft SQL Server 2005 database from Linux using Ruby. Here’s what I did to get it...
...helping of DSL thrown in to save your Ruby-loving fingers from writing nasty SQL...
Best results in other decks
If you really, really have a good reason to write raw SQL (generally a bad practice), make sure you use the right call. Avoid ActiveRecord::Base.connection.execute in general, in particular...
Mit SQL spricht man mit relationalen Datenbanken. Ziele Verstehe die folgenden SQL Befehle SELECT WHERE ORDER INNER JOIN, LEFT JOIN GROUP BY LIMIT UPDATE INSERT and INSERT...
DELETE
...welchen Umständen kann hot_standby_feedback zu Problemen mit VACUUM und Indizes führen? Inhalte SQLZOO Tutorial: Übungsaufgaben in Tutorials Joins Visualizer: Explains the differences between various types of JOIN statements...