Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

strange query

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it a bug? i receive a Data Truncation sql error.
in generic_queries.sql

SearchModel.searchByTime = INSERT INTO jforum_search_results (topic_id, session, time) SELECT DISTINCT t.topic_id, ?, NOW() FROM jforum_topics t, jforum_posts p \
WHERE t.topic_id = p.topic_id \
AND p.post_time > ?

(i get this error with interbase and jaybird jdbc driver. I am using a slightly different query for interbase but i changed only some names in variable and subsituted NOW() with CURRENT_TIME).

What is the meaning of this query and why the "?" near DISTINCT?
[originally posted on jforum.net by agori]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The ? will receive the user's sessionId.. After processing, it will look like



Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
shouldn't you use CURRENT_TIMESTAMP instead of CURRENT_TIME ?
[originally posted on jforum.net by marc]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes! i have current_timestamp now, but the same error occurrs.
Interbase works correctly with that insert, so maybe the problem is in the jdbc-driver (jaybird).
[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SearchModel.searchByTime = INSERT INTO jforum_search_results \(topic_id, session, jtime) \
SELECT DISTINCT t.topic_id, ?, CURRENT_TIMESTAMP \
FROM jforum_topics t, jforum_posts p \
WHERE t.topic_id = p.topic_id AND p.post_time > ?

p.post_time is a varchar and in SearchModel you perform a setString to fill that parameter. How can ">" works well on string?

[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
posttime is of type timestamp. It has been changed since rc5 from long to timestamp.
[originally posted on jforum.net by marc]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have rc5 and in mysql_db_struct.sql post_time field is not time or long, it is VARCHAR(13).

DROP TABLE IF EXISTS jforum_posts;
CREATE TABLE jforum_posts (
post_id mediumint(8) NOT NULL auto_increment,
topic_id mediumint(8) NOT NULL default '0',
forum_id smallint(5) NOT NULL default '0',
user_id mediumint(8) default NULL,
post_time varchar(13) default NULL,
poster_ip varchar(15) default NULL,
enable_bbcode tinyint(1) NOT NULL default '1',
enable_html tinyint(1) NOT NULL default '1',
enable_smilies tinyint(1) NOT NULL default '1',
enable_sig tinyint(1) NOT NULL default '1',
post_edit_time varchar(13) default NULL,
post_edit_count smallint(5) NOT NULL default '0',
status tinyint(1) default '1',
PRIMARY KEY (post_id),
KEY (user_id),
KEY (topic_id),
KEY (forum_id)
) TYPE=InnoDB;
[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed, RC5 uses varchar, but not the development version. The ">" problem was reported by some postgresql users. We can take a closer look, anyway.

It is recommended that you get jforum from cvs, since the table structure changed a quite.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic