maybe a bug? idk #2

Closed
opened 2024-04-16 14:42:22 +00:00 by shiromimochi · 2 comments

i join to musiclist but back this error for me
——————————————————————————————————————————————

Unhandled Runtime Error
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INT) IS NULL THEN NULL
    WHEN CAST(score.scoreMax AS INT) >= 1009000 THEN (CAS' at line 3

Source
src\actions\chuni\music.ts (13:9) @ async $$ACTION_0

  11 | 	const user = await getUser();
  12 |
> 13 | 	return await db.selectFrom('chuni_static_music as music')
     | 	       ^
  14 | 		.leftJoin('chuni_score_best as score', join =>
  15 | 			join.onRef('music.songId', '=', 'score.musicId')
  16 | 				.onRef('music.chartId', '=', 'score.level')

——————————————————————————————————————————————
If I solve this sql_mode problem, the next step into userbox will error:

Unhandled Runtime Error
Error: "[object Object]" is not valid JSON

Source
src\helpers\parse-json-result.ts (23:66) @ parse

  21 |             console.log("Key:", key);
  22 |             console.log("Value before parsing:", val);
> 23 |             const parsedValue = keys.includes(key as any) ? JSON.parse(val as any) : val;
     |                                                                  ^
  24 |             console.log("Value after parsing:", parsedValue);
  25 |             return [key, parsedValue];
  26 |         }));
Call Stack
Show collapsed frames
i join to musiclist but back this error for me —————————————————————————————————————————————— ``` Unhandled Runtime Error Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INT) IS NULL THEN NULL WHEN CAST(score.scoreMax AS INT) >= 1009000 THEN (CAS' at line 3 Source src\actions\chuni\music.ts (13:9) @ async $$ACTION_0 11 | const user = await getUser(); 12 | > 13 | return await db.selectFrom('chuni_static_music as music') | ^ 14 | .leftJoin('chuni_score_best as score', join => 15 | join.onRef('music.songId', '=', 'score.musicId') 16 | .onRef('music.chartId', '=', 'score.level') ``` —————————————————————————————————————————————— If I solve this sql_mode problem, the next step into userbox will error: ``` Unhandled Runtime Error Error: "[object Object]" is not valid JSON Source src\helpers\parse-json-result.ts (23:66) @ parse 21 | console.log("Key:", key); 22 | console.log("Value before parsing:", val); > 23 | const parsedValue = keys.includes(key as any) ? JSON.parse(val as any) : val; | ^ 24 | console.log("Value after parsing:", parsedValue); 25 | return [key, parsedValue]; 26 | })); Call Stack Show collapsed frames ```
Author

ok...maybe I solved the second problem....
i use this

export const parseJsonResult = (<T extends object, K extends ParseableKeys<T>>(data: T | T[], keys: K[]) => {
    if (Array.isArray(data))
        return data.map(d => parseJsonResult(d, keys));
    
    const parsedData = Object.fromEntries((Object.entries(data) as Entries<T>)
        .map(([key, value]) => {
            console.log("Key:", key);
            console.log("Value before parsing:", value);
            const parsedValue = keys.includes(key as any) && typeof value === 'string' ? JSON.parse(value) : value;
            console.log("Value after parsing:", parsedValue);
            return [key, parsedValue];
        }));

    console.log("Parsed data:", parsedData);

    return parsedData;
}) as ParseJSONResultOptions;
ok...maybe I solved the second problem.... i use this ``` export const parseJsonResult = (<T extends object, K extends ParseableKeys<T>>(data: T | T[], keys: K[]) => { if (Array.isArray(data)) return data.map(d => parseJsonResult(d, keys)); const parsedData = Object.fromEntries((Object.entries(data) as Entries<T>) .map(([key, value]) => { console.log("Key:", key); console.log("Value before parsing:", value); const parsedValue = keys.includes(key as any) && typeof value === 'string' ? JSON.parse(value) : value; console.log("Value after parsing:", parsedValue); return [key, parsedValue]; })); console.log("Parsed data:", parsedData); return parsedData; }) as ParseJSONResultOptions; ```
Owner

Just pushed some fixes for MySQL server that should fix these bugs, please open a new issue if you run into any other MySQL server compatibility issues.

Just pushed some fixes for MySQL server that should fix these bugs, please open a new issue if you run into any other MySQL server compatibility issues.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sk1982/actaeon#2
No description provided.