You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "V.Narayanan (JIRA)" <ji...@apache.org> on 2007/02/16 13:41:05 UTC
[jira] Created: (DERBY-2345) truncate on a Blob does not work when
the Blob is in memory
truncate on a Blob does not work when the Blob is in memory
-----------------------------------------------------------
Key: DERBY-2345
URL: https://issues.apache.org/jira/browse/DERBY-2345
Project: Derby
Issue Type: Bug
Components: JDBC
Reporter: V.Narayanan
Priority: Minor
I tried the following repro. After calling the truncate the Blob object still returns the length as 29 (its original length) .
import java.sql.*;
public class TruncateBugRepro {
Connection con = null;
public Connection getEmbeddedConnection() throws Exception {
if(con == null) {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
con = DriverManager.getConnection
("jdbc:derby:DB1;create=true");
}
return con;
}
public void testTruncate() throws Exception {
//String used to getBytes from and insert into Blob.
String str = new String("I am a Blob!!! I am a Blob!!!");
Connection con = getEmbeddedConnection();
//create the blob
Blob blob = con.createBlob();
//insert bytes
blob.setBytes(1,str.getBytes());
//Retuns the Blob length as 29
System.out.println("" + blob.length());
blob.truncate(14);
//returns the Blob length as 29
System.out.println("" + blob.length());
}
public static void main(String[] args) throws Exception {
TruncateBugRepro t = new TruncateBugRepro();
t.testTruncate();
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (DERBY-2345) truncate on a Blob does not work when
the Blob is in memory
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kristian Waagan resolved DERBY-2345.
------------------------------------
Resolution: Fixed
Fix Version/s: 10.3.0.0
Committed with revision 509375.
> truncate on a Blob does not work when the Blob is in memory
> -----------------------------------------------------------
>
> Key: DERBY-2345
> URL: https://issues.apache.org/jira/browse/DERBY-2345
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Reporter: V.Narayanan
> Assigned To: Anurag Shekhar
> Priority: Minor
> Fix For: 10.3.0.0
>
> Attachments: derby-2345.diff
>
>
> I tried the following repro. After calling the truncate the Blob object still returns the length as 29 (its original length) .
> import java.sql.*;
> public class TruncateBugRepro {
>
> Connection con = null;
>
> public Connection getEmbeddedConnection() throws Exception {
> if(con == null) {
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
> con = DriverManager.getConnection
> ("jdbc:derby:DB1;create=true");
> }
> return con;
> }
>
> public void testTruncate() throws Exception {
> //String used to getBytes from and insert into Blob.
> String str = new String("I am a Blob!!! I am a Blob!!!");
> Connection con = getEmbeddedConnection();
> //create the blob
> Blob blob = con.createBlob();
> //insert bytes
> blob.setBytes(1,str.getBytes());
> //Retuns the Blob length as 29
> System.out.println("" + blob.length());
> blob.truncate(14);
> //returns the Blob length as 29
> System.out.println("" + blob.length());
> }
>
> public static void main(String[] args) throws Exception {
> TruncateBugRepro t = new TruncateBugRepro();
> t.testTruncate();
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-2345) truncate on a Blob does not work
when the Blob is in memory
Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474126 ]
V.Narayanan commented on DERBY-2345:
------------------------------------
The repro gives the correct result after the patch is applied. Thank you for the patch.
> truncate on a Blob does not work when the Blob is in memory
> -----------------------------------------------------------
>
> Key: DERBY-2345
> URL: https://issues.apache.org/jira/browse/DERBY-2345
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Reporter: V.Narayanan
> Assigned To: Anurag Shekhar
> Priority: Minor
> Attachments: derby-2345.diff
>
>
> I tried the following repro. After calling the truncate the Blob object still returns the length as 29 (its original length) .
> import java.sql.*;
> public class TruncateBugRepro {
>
> Connection con = null;
>
> public Connection getEmbeddedConnection() throws Exception {
> if(con == null) {
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
> con = DriverManager.getConnection
> ("jdbc:derby:DB1;create=true");
> }
> return con;
> }
>
> public void testTruncate() throws Exception {
> //String used to getBytes from and insert into Blob.
> String str = new String("I am a Blob!!! I am a Blob!!!");
> Connection con = getEmbeddedConnection();
> //create the blob
> Blob blob = con.createBlob();
> //insert bytes
> blob.setBytes(1,str.getBytes());
> //Retuns the Blob length as 29
> System.out.println("" + blob.length());
> blob.truncate(14);
> //returns the Blob length as 29
> System.out.println("" + blob.length());
> }
>
> public static void main(String[] args) throws Exception {
> TruncateBugRepro t = new TruncateBugRepro();
> t.testTruncate();
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (DERBY-2345) truncate on a Blob does not work when
the Blob is in memory
Posted by "Anurag Shekhar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Anurag Shekhar reassigned DERBY-2345:
-------------------------------------
Assignee: Anurag Shekhar
> truncate on a Blob does not work when the Blob is in memory
> -----------------------------------------------------------
>
> Key: DERBY-2345
> URL: https://issues.apache.org/jira/browse/DERBY-2345
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Reporter: V.Narayanan
> Assigned To: Anurag Shekhar
> Priority: Minor
>
> I tried the following repro. After calling the truncate the Blob object still returns the length as 29 (its original length) .
> import java.sql.*;
> public class TruncateBugRepro {
>
> Connection con = null;
>
> public Connection getEmbeddedConnection() throws Exception {
> if(con == null) {
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
> con = DriverManager.getConnection
> ("jdbc:derby:DB1;create=true");
> }
> return con;
> }
>
> public void testTruncate() throws Exception {
> //String used to getBytes from and insert into Blob.
> String str = new String("I am a Blob!!! I am a Blob!!!");
> Connection con = getEmbeddedConnection();
> //create the blob
> Blob blob = con.createBlob();
> //insert bytes
> blob.setBytes(1,str.getBytes());
> //Retuns the Blob length as 29
> System.out.println("" + blob.length());
> blob.truncate(14);
> //returns the Blob length as 29
> System.out.println("" + blob.length());
> }
>
> public static void main(String[] args) throws Exception {
> TruncateBugRepro t = new TruncateBugRepro();
> t.testTruncate();
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-2345) truncate on a Blob does not work when
the Blob is in memory
Posted by "Anurag Shekhar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Anurag Shekhar updated DERBY-2345:
----------------------------------
Attachment: derby-2345.diff
I had missed reassigning the truncated byte array over original byte array hence this bug. The bug went undetected because the tests i added as part of 2247 wasn't testing truncate for small blob (less than 4k).
In this patch I have fixed this bug and added a test for small blob.
> truncate on a Blob does not work when the Blob is in memory
> -----------------------------------------------------------
>
> Key: DERBY-2345
> URL: https://issues.apache.org/jira/browse/DERBY-2345
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Reporter: V.Narayanan
> Assigned To: Anurag Shekhar
> Priority: Minor
> Attachments: derby-2345.diff
>
>
> I tried the following repro. After calling the truncate the Blob object still returns the length as 29 (its original length) .
> import java.sql.*;
> public class TruncateBugRepro {
>
> Connection con = null;
>
> public Connection getEmbeddedConnection() throws Exception {
> if(con == null) {
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
> con = DriverManager.getConnection
> ("jdbc:derby:DB1;create=true");
> }
> return con;
> }
>
> public void testTruncate() throws Exception {
> //String used to getBytes from and insert into Blob.
> String str = new String("I am a Blob!!! I am a Blob!!!");
> Connection con = getEmbeddedConnection();
> //create the blob
> Blob blob = con.createBlob();
> //insert bytes
> blob.setBytes(1,str.getBytes());
> //Retuns the Blob length as 29
> System.out.println("" + blob.length());
> blob.truncate(14);
> //returns the Blob length as 29
> System.out.println("" + blob.length());
> }
>
> public static void main(String[] args) throws Exception {
> TruncateBugRepro t = new TruncateBugRepro();
> t.testTruncate();
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (DERBY-2345) truncate on a Blob does not work when
the Blob is in memory
Posted by "V.Narayanan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
V.Narayanan closed DERBY-2345.
------------------------------
The final patch has been committed for this issue. Thanks to Anurag and kristian for the good work!
> truncate on a Blob does not work when the Blob is in memory
> -----------------------------------------------------------
>
> Key: DERBY-2345
> URL: https://issues.apache.org/jira/browse/DERBY-2345
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Reporter: V.Narayanan
> Assignee: Anurag Shekhar
> Priority: Minor
> Fix For: 10.3.1.4
>
> Attachments: derby-2345.diff
>
>
> I tried the following repro. After calling the truncate the Blob object still returns the length as 29 (its original length) .
> import java.sql.*;
> public class TruncateBugRepro {
>
> Connection con = null;
>
> public Connection getEmbeddedConnection() throws Exception {
> if(con == null) {
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
> con = DriverManager.getConnection
> ("jdbc:derby:DB1;create=true");
> }
> return con;
> }
>
> public void testTruncate() throws Exception {
> //String used to getBytes from and insert into Blob.
> String str = new String("I am a Blob!!! I am a Blob!!!");
> Connection con = getEmbeddedConnection();
> //create the blob
> Blob blob = con.createBlob();
> //insert bytes
> blob.setBytes(1,str.getBytes());
> //Retuns the Blob length as 29
> System.out.println("" + blob.length());
> blob.truncate(14);
> //returns the Blob length as 29
> System.out.println("" + blob.length());
> }
>
> public static void main(String[] args) throws Exception {
> TruncateBugRepro t = new TruncateBugRepro();
> t.testTruncate();
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-2345) truncate on a Blob does not work
when the Blob is in memory
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474130 ]
Kristian Waagan commented on DERBY-2345:
----------------------------------------
I'm running tests and will commit this patch shortly.
> truncate on a Blob does not work when the Blob is in memory
> -----------------------------------------------------------
>
> Key: DERBY-2345
> URL: https://issues.apache.org/jira/browse/DERBY-2345
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Reporter: V.Narayanan
> Assigned To: Anurag Shekhar
> Priority: Minor
> Attachments: derby-2345.diff
>
>
> I tried the following repro. After calling the truncate the Blob object still returns the length as 29 (its original length) .
> import java.sql.*;
> public class TruncateBugRepro {
>
> Connection con = null;
>
> public Connection getEmbeddedConnection() throws Exception {
> if(con == null) {
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
> con = DriverManager.getConnection
> ("jdbc:derby:DB1;create=true");
> }
> return con;
> }
>
> public void testTruncate() throws Exception {
> //String used to getBytes from and insert into Blob.
> String str = new String("I am a Blob!!! I am a Blob!!!");
> Connection con = getEmbeddedConnection();
> //create the blob
> Blob blob = con.createBlob();
> //insert bytes
> blob.setBytes(1,str.getBytes());
> //Retuns the Blob length as 29
> System.out.println("" + blob.length());
> blob.truncate(14);
> //returns the Blob length as 29
> System.out.println("" + blob.length());
> }
>
> public static void main(String[] args) throws Exception {
> TruncateBugRepro t = new TruncateBugRepro();
> t.testTruncate();
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.