I am using the MySql Connector C++ to store a JPEG image from a file into the database. I am using the prepared statement. After execution of the prepared statement, only the first 64 bytes of the file are copied into the database.
My research of examples show that no iteration is necessary and the examples assume that the prepared ...
I am doing an ActiveRecord find on a model as such
@foo = MyModel.find(:all, :select => 'year')
As you can see, I only need the year column from this, so my ideal output would be
["2008", "2009", "2010"]
Instead, though, I get an a hash of the models, with each one containing the year, as such:
[#<MyModel year: "2008">, #<MyModel ...
Hi Guys,
I have two table "TempStore" and "Store" with the same column called "Items".
There is data in "TempStore" table which I need to move over to "Store" table which requires few modifications.
I need to iterate over "TempStore" data (i.e. items) and insert into Store...
More specifically: How can I iterate over TempStore (in sq...
I enabled logging slow queries and set the minimum time to 0. I know that the logging is enabled because the startup of mysqld is being logged. But, when I access my website's php pages using my browser and cause queries to run, no queries are being logged.
Is there something special I need to do to make this work with php?
Thanks in...
I am using a form through a PHP CMS system, that defines custom fields and such.
One of the custom fields allows for an input field which does a smart search. What this means is that when you start typing, it shows the records that match, quite similar to google suggest.
The smartsearch input field relies on a stored mysql search, and ...
I am working on an application the stores time values in a database e.g Expected time of Arrival and actual time of arrival. What is the best way of storing these fields in a database?
What SQL query can I use to obtain the time difference between the two fields?
...
If I have three queries and rows from the queries are not all alike. How can I write an SQL statement that will combine all three queries and all their rows of data into one final query??
The query I'm using currently leaves some of the rows off, I'm assuming because the rows are not all equal, and from my understanding Access does not ...
I have 2 tables, purchases and sales with each having a date field and a cost field.
I want to generate reports of a few different types, for example I want to show profit and loss over each month or year, or to show how often a particular item sold for a given arbitrary time period ( probably based on user input)
Is it terribly comple...
Good afternoon,
After computing a rather large vector (a bit shorter than 2^20 elements), I have to store the result in a database.
The script takes about 4 hours to execute with a simple code such as :
#Do the processing
myVector<-processData(myData)
#Sends every thing to the database
lapply(myVector,sendToDB)
What do you think is ...
Hello,
I am trying to set up a normalised MySQL database containing the three following tables. The first table contains a list of items which can be described by various tags. The third table contains the various tags used to describe the items in the first table. The middle table relates the other two tables to each other. In each...
How is possible to get rows count of rowset in OLE DB? I have filled RowSet using CCommand and CAccessor and now I dont know how to get rows count.
I can go through all rows using MoveNext() but it does not seem efective.
Thanks
...
There is a simple database in Sequel:
DB = Sequel.sqlite
DB.create_table :items do
primary_key :id
DateTime :date
String :name
end
items = DB[:items]
items.insert(:name => 'abc', :date => DateTime.now)
items.insert(:name => 'ghi', :date => DateTime.now)
items.insert(:name => 'def', :date => DateTime.now)
The question: is...
I would like to create a SQL query, which does the following..
- I have a few parameters, for instance like "John","Smith"
- Now I have a articles tables with a content column, which I would like to be searched
- Now, How can I find out the rows in the articles table, which has the any one of those values("John","Smith")
I cannot use...
Hey all
how to combine 2 different tables where they contain the same fields but different data, example
Cash_Expenses
{
exp_date
exp_cat_id
exp_amount
exp_remark
}
Cheque_Espenses
{
exp_date
exp_cat_id
exp_cheque_NO
exp_amount
exp_remark
}
exp_cat
{
cat_id
Cat_name
}
now what i am trying to do is that i want to combine those t...
Hey all,
I am using this query using UNION, where both fields that contains the amount are combined into one table, and i wanted to split them into 2 fields, first for cash and other for cheque
SELECT exp_cat.cat_name, SUM(exp_cheque.exp_amount) AS Cheque
FROM exp_cat INNER JOIN exp_cheque ON exp_cat.ID = exp_cheque.exp_cat_id
GROUP BY...
Hi I'm working on a project which requires I use a large number of columns in my Access SQL queries. A typical query contains several fields such as the one below:
SELECT ([Score1]+[Score2]+[Score3])*.5 AS [Scores], [Subject] FROM [ScoresTable]
WHERE ([Score1]+[Score2]+[Score3])*.5 > 500
Is there any way to assign the value of ([Score...
I have the following table in my database:
tbl1
PK
ClientID
ScheduleDay
Time1Start
Time1Stop
Time2Start
Time2Stop
Time3Start
Time3Stop
Status
Here is some sample data
ID ClientID ScheduleDay Time1Start Time1Stop Time2Start Time2Stop Time3Start Time3Stop
-- -------- ----------- ---------- --------- ---------- --------- ---------- -...
Hi i have a proble in finding solution.
I have 3 tables:
Customer
customer_id
customer_name
Relation
subscription_id
customer_id
Subscriptions
One customer can have relation with many subscriptions and i want to display data like so:
customer_id, customer_name, subscription_first, subscription_second, subscription_n
...all i...
I need to get the db table informations like columns detail, pk/uk/check/fk constraints etc. for popular databases (Oracle, MySql, MSSql , DB2 etc). I know each database provide some way or other to retreive the schema information. Does somebody know the generic way to collect the schema information from different databases (Some sort of...
I'm fetching data from a text file or log periodically and it gets inserted in the database every time fetched. Is there a way in MySQL that the insert is only done when the log files are updated or I have to do it using the programming language ? I mean Is there a type of insert that when It sees a duplicate primary key, It doesn't give...