mysql

Can Exist query MySQL?

Greetings Gurus... Is there a way to interface with a remote mysql db from within an Exist database stored xquery? I am working on a stack that uses php as the main programming language, and xqueries are either stored on exist or they are passed along to the exist server using the php javabridge. Currently, what I have to do is constru...

MySQL concatenate to column while selecting

I'm dealing with a bit of a legacy database here, and I'm having some trouble with writing a search query. The two tables concerned are products and tours (multiple per product). My general query looks like this: SELECT products.*, tours.* FROM products INNER JOIN tours ON products.id=tours.product_id GROUP BY products.id Now here'...

How do I transform "ТеÑ" (it is russian word) into something readable?

Hello, I got MySQL DB which contains UTF8 column with such "ТеÑ" records. PHP's mb_detect_encoding() told me that this is UTF-8. How can I transform this "horror" into something readable? Thank you ...

Using an overall WHERE clause when using UNIONS in sql

Hi, I am trying to return the MATCH() AGAINST() results against several tables using UNIONS, the only problem is some rows return a relevance of 0, I want to exclude these. After the unions is there a way to use 'WHERE relevance > 0' Below is a bit of my SQL SELECT pages.content AS search, page_info.url AS link, MATCH(pages.content) AG...

Methods of using a long varchar key as a lookup key

I'm building a commenting mechanism into an application that allows a programmer/plugin author to implement comment threads in a simple manner. The way I wanted to do this is by using a unique identifier for the comment threads, which took the hard work away from the developer by using a unique key for the thread, where you can place co...

Mysql result not returned if count 0

I've got access levels and pages. Pages <=many-to-many=> Levels I need to count how many opened pages does each level has. But the levels doesn't happen to come out if pageCount is 0. SELECT levels.id, levels.name, COUNT(pages.id) as pageCount FROM levels LEFT JOIN page_levels ON levels.id = page_levels.level_id LEFT JO...

mySQL images upload

I need a simple code to upload images to mySQL using PHP... short! snippet... and is it possible to upload an html, css file to mySQL?... its reason is complicated but all answers are appreciated!... EDIT:: say I have 1000 users.. and they each have their own layout for their page.. So inside their MYSQL record will be a html file, css f...

Is there a way to find / replace a string across all tables in a mysql database?

I'm thinking this isn't possible without doing a dump, searching / replacing within the .sql file, and then reimporting it, but figured I'd ask anyway... Basically, is there a way to search for "samplestring" within all of the fields, within all of the tables, within one database and replace it with "examplestring"? ...

Need to remove ASCII character

I'm pulling some text from a database, which contains some carriage returns. When I put them straight into html, they get interpreted as � . I've tried a bunch of different ways to remove them, but haven't seemed to have any luck. Any thoughts? ...

MySQL / Ruby on Rails - How to "SUM" in a :has_many case

Hi there, I have the following tables: User :has_many Purchases Item :has_many Purchases Item has a column "amount" (can be + or -) and I need to find all Users that have a positive SUM of "Item.amounts" (over all Purchases each one has made). How does this query look like? (I'm not sure how to handle "SUM" correctly, in this c...

CSV import problem; on different servers import throws error or succeeds

Hi folks, We recently migrated a site from Superb.net to MediaTemple. Part of the upkeep of this site is a 60000+ record export (in 3 CSVs) from Raiser's Edge which I import into mySQL. The tables retained the same schema before and after the move. This week when I went to do my import I found that each of the CSVs caused an invalid ...

MySQL update statement to store ranking positions

Hi, I'm trying to get my head around a query and I just can't figure it out. I would appreciate if someone give me a pointer. As a simple example of what I'm trying to achieve, I have these records in the database Score|Ranking ------------- 100 |0 200 |0 300 |0 And I would like the Ranking field to contain 1,2,3 based on who's got...

MySQL driver module issue with Movable Type

I am able to get mt-check to run, but it says that DBD::MySQL module is not installed. Here is what it says: DBI (version >= 1.21) Your server has DBI installed (version 1.52). DBD::mysql Your server does not have DBD::mysql installed, or DBD::mysql requires another module that is not installed. The DBD::mysql database driver is requi...

Lazy deletion of table rows

is there any software that does "lazy" deletion of the rows from the table. I would like to do maintenance of my tables when my server is idle, and ideally i should be able to define what "idle" is (num of database connections/system load/ requests per second). Is there anything remotely similar to this? ...

PHP + Mysql queries for a real Beginner

After years of false starts, I'm finally diving head first into learning to code PHP. After about 10 failed previous attempts to learn, it's getting exciting and finally going fairly well. The project I'm using to learn with is for work. I'm trying to import 100+ fixed width text files into a MySql database. So far so good I'm getting...

SQL query at least one of something

Hello, I have a bunch of Users, each of whom has many Posts. Schema: Users: id Posts: user_id, rating How do I find all Users who have at least one post with a rating above, say, 10? I'm not sure if I should use a subQuery for this, or if there's an easier way. Thanks! ...

Connecting to MySQL with .NET Connector and SSL. Does it need a client certificate?

I am considering establishing an encrypted connection from a .NET app toward a remote MySQL database. According to the manual, there is a SSL Mode option to do that. The example provided in the tutorial rely on a client X509 certificate. Is the client certificate absolutely needed, or can I just connect with SSL Mode=Required and a login...

OODBMS postgreSQL array Fields real Use ?

I am new to PostgreSQL, mainly used MySQL before and SQLServer(for Clients Pressure; donno much), I've gone through several OODBMS Introductories over some Google Search. Most of them mainly focuses on Table <-> Object Mapping. But When using some Generic ORM Layer with any RDBMS Things are Hapily Mapped. So do we really need OODBMS ? I...

[Database design] Modeling temporal logging across multiple nodes

Hello, I am creating a database for an application that logs data for several different nodes. The data logged looks like this: timestamp several integer values several floating point values maybe a string or two Each node is polled separately. I would be creating a log entry between every 10 minutes and every 10 seconds (variable ...

How to cascade persist using JPA/EclipseLink

I am having problems performing a cascade persist operation on a parent entity. When the child entity is persisted, the reference (generated id) to the parent entity is null. How would I get this to persist correctly? Thanks, RG Entities: @Entity public class Contact { @Id @GeneratedValue(strategy=GenerationType.TABLE, gen...