MySql

16 views
Skip to first unread message

PaulANormanNZ

unread,
Sep 27, 2011, 7:10:02 AM9/27/11
to glues...@googlegroups.com
Hi when using MySql with this script (based on one of the samples),

I do not get discrete field output. My MySql database is utf8, and when the database is set up it reports as Latin1 and then after successful connection as expected as utf8, but the sample output below the script shown here, suggests that utf8 is perhaps upsetting the field boundaries in the returned records? The beginning of the next and sometimes three fields info is at least partially shown.

Do I need to set anything else please?

Paul

var wx = require("wx");
var mysql = require("mysql");

var db = new mysql.Database();

  print(db.characterSet + "\n\n");

var dlg = new wx.PasswordEntryDialog(null, "Please enter the password for user 'root' of the database 'test'", "Enter a password");
if ( dlg.showModal() == wx.Id.OK )
{
  var pwd = dlg.value; 
  if ( db.connect("localhost", "root", pwd, "jabref") )
  {
print(db.characterSet + "\n\n");
    // wx.messageBox("Connection ok");
    var result = db.query("SELECT * FROM entries");
    if ( result )
    {
      var row;
      while(row = result.fetchObject())
      {       
for(i in row)
        {
        if (i == 'author')
print(row[i] , "\n\n");
}
        }
        print("\n");
      }
    }
  }
  else
  {
    wx.messageBox("Connection failed");
  }
}




glue.log.level = warning
latin1

utf8

ARCHIBALD THOMAS ROBERTSON A.M., D.D., LL.D., Litt.D. WORD PICTURE

Eberhard Arnold The Early Christians In Their Own words 1970 http:

Anthony F. Aveni NASCA Eigth Wonder of hte World? 2000 ISBN 978071

Benge, J. and Benge, G. John Williams messenger of peace 2002 BTAB

Franky Braem

unread,
Sep 27, 2011, 7:23:43 AM9/27/11
to GLUEscript
When a connection is successful, GLUEscript will call
mysql_set_character_set to set the char set to utf-8. Internally
GLUEscript works with utf-8.

Franky

PaulANormanNZ

unread,
Sep 27, 2011, 7:34:25 AM9/27/11
to glues...@googlegroups.com
Thanks Franky,

Would you have any other thoughts on what might cause field values to run together like that?

Paul

Franky Braem

unread,
Sep 27, 2011, 2:48:49 PM9/27/11
to GLUEscript
I can't reproduce your output. Can you give me your table definition?

Franky

Paul A Norman

unread,
Sep 27, 2011, 4:44:19 PM9/27/11
to glues...@googlegroups.com
Sure, I have to wait until I am at my machine again.

Paul

> --
> You received this message because you are subscribed to the Google Groups "GLUEscript" group.
> To post to this group, send email to glues...@googlegroups.com.
> To unsubscribe from this group, send email to gluescript+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/gluescript?hl=en.
>
>

Paul A Norman

unread,
Sep 27, 2011, 7:04:20 PM9/27/11
to glues...@googlegroups.com
Thanks Franky,

This is the MySql to create the database, or did you want a data dump as well?

The database is generated by JabRef ( http://jabref.sourceforge.net/ )
as an export into MySql, and has been a very stable process over many
years.

Paul

CREATE TABLE `entries` (
`entries_id` INT(11) NOT NULL AUTO_INCREMENT,
`jabref_eid` VARCHAR(8) NULL DEFAULT NULL,
`entry_types_id` INT(10) UNSIGNED NULL DEFAULT NULL,
`cite_key` VARCHAR(100) NULL DEFAULT NULL,
`author` TEXT NULL,
`title` TEXT NULL,
`journal` TEXT NULL,
`year` TEXT NULL,
`volume` TEXT NULL,
`pages` TEXT NULL,
`number` TEXT NULL,
`month` TEXT NULL,
`part` TEXT NULL,
`eid` TEXT NULL,
`note` TEXT NULL,
`crossref` TEXT NULL,
`keywords` TEXT NULL,
`doi` TEXT NULL,
`url` TEXT NULL,
`file` TEXT NULL,
`citeseerurl` TEXT NULL,
`pdf` TEXT NULL,
`abstract` TEXT NULL,
`comment` TEXT NULL,
`owner` TEXT NULL,
`timestamp` TEXT NULL,
`review` TEXT NULL,
`search` TEXT NULL,
`publisher` TEXT NULL,
`editor` TEXT NULL,
`series` TEXT NULL,
`address` TEXT NULL,
`edition` TEXT NULL,
`howpublished` TEXT NULL,
`lastchecked` TEXT NULL,
`booktitle` TEXT NULL,
`organization` TEXT NULL,
`language` TEXT NULL,
`chapter` TEXT NULL,
`type` TEXT NULL,
`school` TEXT NULL,
`nationality` TEXT NULL,
`yearfiled` TEXT NULL,
`assignee` TEXT NULL,
`day` TEXT NULL,
`dayfiled` TEXT NULL,
`monthfiled` TEXT NULL,
`institution` TEXT NULL,
`revision` TEXT NULL,
PRIMARY KEY (`entries_id`),
INDEX `entry_types_id` (`entry_types_id`),
CONSTRAINT `entries_ibfk_1` FOREIGN KEY (`entry_types_id`) REFERENCES
`entry_types` (`entry_types_id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=70;

Franky Braem

unread,
Oct 2, 2011, 3:53:42 PM10/2/11
to GLUEscript
Can you send me some sample input? I've tried this, but I don't have
this problem.

Franky
> On 28 September 2011 09:44, Paul A Norman <paul.a.nor...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Sure, I have to wait until I am at my machine again.
>
> > Paul
>

Paul A Norman

unread,
Oct 2, 2011, 8:43:58 PM10/2/11
to glues...@googlegroups.com
Dear Franky,

Here is an MySql export done via Heidi ( http://www.heidisql.com - an awesome free programme).

This completely replicates exactly what I was working from. Regarding data integrity, so far I have had no problems in accessing and using this from other applications, for some years.

The .7z has all the tables with MySql insert statements for data, in case the tables are needed, but the only table you'll probably need is "entries".

Thanks

Paul
jabref.7z

Franky Braem

unread,
Oct 5, 2011, 2:54:09 PM10/5/11
to GLUEscript
Solved in the 0.2.0 branch: For BLOB and TEXT values we have to call
mysql_fetch_lengths to get the real length of the value.
Thanks for finding this bug!

Franky

On 3 okt, 02:43, Paul A Norman <paul.a.nor...@gmail.com> wrote:
> Dear Franky,
>
> Here is an MySql export done via Heidi (http://www.heidisql.com- an
> awesome free programme).
>
> This completely replicates exactly what I was working from. Regarding data
> integrity, so far I have had no problems in accessing and using this from
> other applications, for some years.
>
> The .7z has all the tables with MySql insert statements for data, in case
> the tables are needed, but the only table you'll probably need is "entries".
>
> Thanks
>
> Paul
>
>  jabref.7z
> 26KWeergevenDownloaden

Paul A Norman

unread,
Oct 5, 2011, 6:26:58 PM10/5/11
to glues...@googlegroups.com
That's great Franky,

Off-sets, makes sense that's what looked like in use - displacement over field boundary. 

0.2 -  do I need to set up to compile sources to get all these advances you've made, especially the ability to use other dlls, or is it better to wait for a binary release, I have gathered from what you have written elsewhere that setting up to compile under Windows may not be a trivial matter.

Paul
Reply all
Reply to author
Forward
0 new messages