mysql

Hibernate CollectionOfElements doesn't auto create table in SQL server

Hi, Using auto update (hibernate.hbm2ddl.auto=update) I have a entity which is supppose to create two tables: myentity and myentityconfigurationProperties. This works fine in Mysql 5, but in SQL server 2005 it doesnt create the property table. Anyone knows anything about this? I havn't tried creating the table myself, I'd like to avoid ...

Use silverlight to query mysql

I have a silverlight application which reads data from a db and displays them in a grid. As far as i understand it there are two ways to do it. 1) Read db with a server-side language, such as php, create a file in the server which you can later use in Silverlight to read the data. 2) Connect "directly" using Silverlight code with your db...

fsockopen error I want to skip

$sock = fsockopen($url_parts['host'], (isset($url_parts['port']) ? (int)$url_parts['port'] : 80), $errno, $errstr, 30); if (!$sock) return false; I have list on my db for urls, that I am visiting, and occassionally I get this: I am getting "Fatal error: Maximum execution time of 30 seconds exceeded..." Its expected, since it goes to ...

postgres column alias problem

As a newbie to Postgresql (I'm moving over because I'm moving my site to heroku who only support it, I'm having to refactor some of my queries and code. Here's a problem that I can't quite understand the problem with: PGError: ERROR: column "l_user_id" does not exist LINE 1: ...t_id where l.user_id = 8 order by l2.geopoint_id, l_user_i...

Turn off warnings and errors on php/mysql

I am getting expected notices and warnings, and would like to turn them off on my php file. errors are: Warning: fsockopen() and notices are: Notice: A non well formed numeric value encountered in I am planning to use cron for this php script, and do not want to get any errors or notices logged anywhere... ie cpanel error log etc... ...

What is the best way to create a number-used-once security token in PHP?

For security purposes, I would like to create a security token for every CRUD operation on a site running a LAMP stack. The security token would be attached to the a href URL and would be verified after the user clicks on the link before displaying or doing anything. First of all, are using security tokens a good first step in securing ...

MySQL GROUP BY behavior

Given the following table 'foo' ID | First Name | Last Name ---------------------------- 67 John Smith ---------------------------- 67 Bill Jacobs What first_name and last_name will the following query return and why? SELECT * FROM foo WHERE ID = 67 GROUP BY ID ...

Constraint like check constraints, not null constraints on MyISAM Storage Engines in MySQL

Can we use constraint like check constraints, not null constraints on MyISAM Storage Engines in MySQL? ...

MySQL datetime fields and daylight savings time -- how do I reference the "extra" hour?

I'm using the America/New York timezone. In the Fall we "fall back" an hour -- effectively "gaining" one hour at 2am. At the transition point the following happens: it's 01:59:00 -04:00 then 1 minute later it becomes: 01:00:00 -05:00 So if you simply say "1:30am" it's ambiguous as to whether or not you're referring to the first tim...

Relevant search results from a MySQL table

What's the best way of generating super relevant results from a MySQL table? I have a list of sites in a table with a title, description and tags. How can I set up a SELECT query/search function in PHP that will find user typed keywords in all three of those columns, and whilst remaining as quick as possible keep the following in mind:...

How to make MySQL return empty day when doing a group by date?

I have a MySQL query like this: SELECT DAYNAME(CreatedAt) AS TheDay, SUM(Amount) AS TheSum FROM OrderTransactions GROUP BY TheDay # Returns an array like: # Array # ( # [0] => Array # ( # [TheDay] => Thursday # [TheSum] => 0.02 # ) # # [1] => Array # ( # [TheDay] => W...

Is it true that MyISAM engine is more preferable than InnoDB when we are building clustered storage? Why if it is so?

I heard this today during interview for java developer. I had to list some advantages of MyISAM over InnoDB and why it's still being widely used. And they were waiting to hear from me the answer as the title of this question. As I understand from their own answer: MyISAM doesn't have foreign keys and DB can be easily clustered (one tabl...

How to select rows where a column value is empty/null using Zend_Db?

I have an SQLite database, eventually will be a MySQL database and I'm using Zend Framework. I'm trying to fetch all the rows in a table where the 'date_accepted' column is empty/null/doesn't have a value. This is what I have so far: public function fetchAllPending() { $select = $this->getDbTable()->select(); $select->where('date_acce...

How can I create a multi-hierarchical 'tree'? (If it can be called a tree)

Hi, i have a list of say courses and certificates and fun_days. These are all called objects. Every object has its requirements object_requirements. A requirement can be either one of the objects or several of them. You can take any object without object_requirements as a starting point. "Everybody is allowed to have those objects." S...

Is there an easy way for users to print Flash (Open Flash Charts) from their browser?

Is there any easy way to print Flash Charts (Open Flash Charts 2) within a web page. Flash doesn't seem to print at all. I'm maintaining a health site for a client, and we use Open Flash Charts to draw multiple line charts for patients dynamic data. The client would like for patients to be able to easily print these charts, although Fla...

Mysql/php Connection, Config, Index, Query, buffers, nfi im out of options.

Hi there, first of all, my main question: What are some good troubleshooting techniques when you run into a variable problem regarding slow database access. Background: I have a system that is handling multiple db connections so that I may use unbuffered queries on the main table select. I have an issue where I see a pause on a very si...

IP Filtering/Matching by host mask with PHP & MySQL

Hey there, I'm wanting to do something similar to this: http://stackoverflow.com/questions/594112/matching-an-ip-to-a-cidr-mask-in-php5 Except, I want to store a list of disallowed IP/Masks in a MySQL table and check for a match. Just like the example in the link, something like '10.2.0.0/16' would be a row in the table and then I wan...

How do you write a conditional in a MySQL select statement?

I'm using MySQL, and I want to do a sort of ternary statement in my SQL like: SELECT USER_ID, ((USER_ID = 1) ? 1 : 0) AS FIRST_USER FROM USER The results would be similar to: USER_ID | FIRST_USER 1 | 1 2 | 0 3 | 0 etc. How does one accomplish this? ...

MYSQL + php, insert automatically on new table?

I will create 5 tables, namely data1, data2, data3, data4 and data5 tables. Each table can only store 1000 data records. When a new entry or when I want to insert a new data, I must do a check, $data1 = mysql_query(SELECT * FROM data1); <?php if(mysql_num_rows($data1) > 1000){ $data2 = mysql_query(SELECT * FROM data2); if(m...

Help with Hibernate Collection Foreign Key Mapping

Hi, I'm running into significant difficulty getting my mapping file to work with a collection of elements via a foreign key in Hibernate. Java will try to load these files below and won't have any runtime exceptions, but the events table is never loaded as an object of an employee (it will remain null, but every other attribute loads fr...