mysql

db:seed not loading models

I'm trying to seed my database with the standard db/seeds.rb method. This works fine on my development machine, but on my server, I get: $ sudo rake db:seed RAILS_ENV=production --trace ** Invoke db:seed (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:seed rake aborted! uninitialized constant Permiss...

Read changes from within a transaction

Whatever changes made to the MySQL database, are those changes readable within the same transaction? Or should I commit the transaction to read the changes? I could easily test this. But putting a question in SO brings up a lot of good suggestions. Thanks for any input. ...

PHP prepared statement: Why is this throwing a fatal error?

Have no idea whats going wrong here. Keeps throwing... Fatal error: Call to a member function prepare() on a non-object ...every time it gets to the $select = $dbcon->prepare('SELECT * FROM tester1');part. Can somebody shed some light as to what I'm doing wrong? function selectall() //returns array $client[][]. first br...

How to connect Mysql server with Asp.net 2008

How to connect Mysql server (free one) with Asp.net 2008. ...

What's the appropriate reference for writing a MySql driver?

I have to use erlang-mysql-driver in my application, but it has been distressingly unreliable. Since it isn't being maintained, I don't see any option but to fix it myself. The problem is, I've never written nor worked on a database driver, and I don't know where to start. Mainly, I can't find the relevant documentation that specifies ho...

Why doesn't my Perl DBI query return any results in a CGI script?

I'm using DBI for the first time (and not long started Perl [2 weeks]) and I can't seem to get any results from the database. Here's what I have: if( defined( $get{findAllPages} ) && defined( $post{ki} ) ){ my ($database, $hostname, $port, $password, $user ); $database = "#########"; $hostname = "localhost"; $password = "#...

Need help with MySQL JOINs dealing with four tables

I need help with a MySQL query. This example is much simpler than the one I actually need, but it's similar. Here are my example tables, I tried to make it easy to read. posts --------------- id date 1 2010 2 2010 posts_tags --------------- post_id tag_id 1 1 1 2 1 ...

extracting date from datetime column

If the column TxnDate is datetime type shouldn't the first query work just as the second one? (02:13) mysql>select * from Response where date(TxnDate) = '2010-02-05'; Empty set (0.11 sec) (02:14) mysql>select * from Response where trim(date(TxnDate)) = '2010-02-05'; ... ... 207 rows in set (0.12 sec) I can not reproduce this problem....

Securing a database from Java clients

The concept I have uses a central MySql database which has many Java clients running and using this database (connecting directly). The clients would be publically available, so security becomes an issue. As Java can be decompiled, I cannot put the security part of this system into the client application. I'll need to have an initial us...

How to group by and order By datetime Cakephp?

Hi how do I group by and order by a datetime field with CakePHP? ...

How to predict/calculate field length of numeric values (INT) in MySQL?

In phpmyadmin there is a field length which you may specify, usually set to 11 on INT if nothing is specified. Field Name: ID Field Type: INT(11) // This is what I need to figure out! How can I calculate the length, and what does the length actually stand for? Does it mean how many digits? Bytes? And what is Unsigned and Signed g...

Is there a MySQL tool that generates SQL queries for you?

Is there any software for Windows that allows you to setup your tables and then tell the software what you want to SELECT given the conditions and it will tell you the SQL query that you need? Thanks. ...

SQL Error when using apostrophes

I'm getting the following error whenever I try to post something with an apostrophe in it: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near... For example when I'm trying to post/using INSERT something like "I'm working hard".It's getting me an error....

Securing php application

Hi , I have built a cms from scratch in PHP and I need a little help with getting it more secure. Basically I have arranged all my important files as followed: /var/www/TESTUSERNAME/includes/val.php Is this a secure way to stop people from getting hold of my values ? Would it be a better to store these values in a database then ru...

populating mysql database

I have a file with over a million lines of data, each line is a record. I can go through the file, read the line and do a insert, but this can take up to 2 hours. Is there a faster way like uploading a sql file? ...

MySql multiple selects batching in .net

I have a situation in my application. For each x-axis point in my chart, I am plotting 5 y-axis values. To calculate each of these 5 values, I need to make 4 different queries. Ie, for each x-axis point I need to fire 20 sql queries. Now, I need to plot 40 such points in the my chart. Its resulting in a pathetic performance where it ta...

Implementing custom fields with ALTER TABLE

We are currently thinking about different ways to implement custom fields for our web application. Users should be able to define custom fields for certain entities and fill in/view this data (and possibly query the data later on). I understand that there are different ways to implement custom fields (e.g. using a name/value table or us...

Indexing table with duplicates MySQL/SQL Server with millions of records

I need help in indexing in MySQL. I have a table in MySQL with following rows: ID Store_ID Feature_ID Order_ID Viewed_Date Deal_ID IsTrial The ID is auto generated. Store_ID goes from 1 - 8. Feature_ID from 1 - let's say 100. Viewed Date is Date and time on which the data is inserted. IsTrial is either 0 or 1. You can ignore Order_ID an...

Select query question

Hello! I have a table in a mysql-database with the fields "name", "title", "cd_id", "tracks" The entries look like this: Schubert | Symphonie Nr 7 | 27 | 2 Brahms | Symphonie Nr 1 | 11 | 4 Brahms | Symphonie Nr 2 | 27 | 4 Shostakovich | Jazz Suite Nr 1 | 19 | 3 To get the tracks per cd (cd_id) I have written this script: #!/usr/bin/...

Fine-tuning my MySQL relations database and how to use JOIN on it?

I am very new to mysql and databases, so I need help here... How should I use JOIN to fetch a record from the tables below, when the only given variable is the ad_id? category and category options are filled in manually i.e. the users may not alter them. So they are only reference tables, but I am not sure this is how I should do it......